Repository navigation
rdna2spirv: translate FLAT loads and stores as global accesses - #9790
Open
tiagonogueiraa-bit wants to merge 2 commits into
Open
tiagonogueiraa-bit wants to merge 2 commits into
tiagonogueiraa-bit wants to merge 2 commits into
Conversation
flat_load_* / flat_store_* with a 64-bit VGPR address emit the global_* code with `off` (Gen.global_mem / Gen.global_sub). An address outside the LDS and private apertures is a global access on RDNA2; the aperture bases (src_shared_base / src_private_base) are refused, so no translated program builds an aperture address from them. A non-zero instruction offset, the FLAT atomics and a 32-bit address stay Unsupported. The first-read analysis counts a FLAT d16 load's vdst, the interp copy analysis and ab_control_flow treat flat_store like global_store. CPU-checked by tests/semantic/test_flat_mem.py; contract row in docs/design.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review on ItsNotRexed#8823 (wavehs): NEEDS listed flat_store but not flat_atomic, which writes memory as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
Exercised on hardware: 55 translated modules differ from the base build (the FLAT rename reaches the buffer/image fixtures) and all pass. Counts and pass/fail only; no game files. AI-assisted (DeepSeek V4.1 Flash coding agent). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resubmission of #8823, unchanged (head
fbe718a46). #8823 was 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: #8683 (comment)What
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