mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #65] rdna2spirv: translate FLAT loads and stores as global accesses #116
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#116
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/65
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9790📝 Commits (2)
f797e73rdna2spirv: translate FLAT loads and stores as global accessesfbe718aab_control_flow: leave flat_atomic out of the A/B sweep too📊 Changes
4 files changed (+214 additions, -3 deletions)
View changed files
📝
docs/design.md(+1 -0)➕
tests/semantic/test_flat_mem.py(+168 -0)📝
tools/ab_control_flow.py(+1 -1)📝
tools/rdna2spirv.py(+44 -2)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Resubmission of
#8823, unchanged (headfbe718a46).#8823was closed at 22:39 UTC during the move to ProjectLeonida, with no comment and notriage:line, and the API refuses to reopen it. It had about ten independent passes (CPU and GPU on Linux, Windows and macOS; see#8823's comments). On today'smain2d53a8055the branch merges without conflicts, and its 12test_flat_memtests pass. Originally claimed in#8683: https://github.com/ProjectLeonida/Leonida/issues/8683#issuecomment-7111644742What
flat_load_*andflat_store_*used to reach the translator's finalUnsupported(op).tools/isa_coverage.pylisted all 54 FLAT opcodes as unknown, and no open PR translates them.Gen.flat_memnow emits the same code as the GLOBAL access withoff, throughGen.global_mem/Gen.global_sub. That covers:dword,x2,x3,x4);Inactive lanes don't access memory, as with
global_*.Why global
off.src_shared_base/src_private_base. The translator refuses those operands, so a program that builds an aperture address from them is refused as a whole. A test covers this.docs/design.mdrow says so.Refused (
Unsupported)FeatureFlatSegmentOffsetBug("inst_offset is ignored when flat instructions access global memory") and folds no offset into a FLAT access there.flat_atomic_*.Also changed
read_before_write_vgprs): it counts thevdstof a FLAT d16 load as read, the same as forglobal_load_*_d16.flat_storelike the other stores.tools/ab_control_flow.py: it listsflat_storeamong the memory writes the harness can't set up, next toglobal_store.docs/design.md.Tests
tests/semantic/test_flat_mem.pyis new. Each program is translated, run withspirv_mini_interp, checked against words worked out by hand, and checked to leave the same memory as itsglobal_* ..., offspelling. It covers:v_cmpx;What I ran, on macOS 26 with an Apple M4 (CPU only) and Python 3.12.13:
python -I scripts/run_semantic_tests.py -j 4 tests/semantic: 448 files, 5,969 tests; 446 files pass. The two that fail,test_image_atomics_guard(47) andtest_image_store_d16(1), fail the same way onmain867d922f.tests/test_isa_coverage.py,tests/test_semantic_translator_use.py,tests/test_ab_control_flow.py,tests/test_design_contract_rows.py,tests/test_docs_repo_paths.py: all pass.tests/test_docs_design_rows.pyandtests/test_docs_links.pyfail the same way onmain(ondocs/README.mdanddocs/dev-tools.md, which this PR doesn't touch).scripts/check_no_game_data.pypasses on the changed files.Not GPU-verified. No game files were used.
AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.