rdna2spirv: keep DATA0 for equal paired LDS write offsets (SHADER-LDS-EQUAL-WRITES) #966
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/966"
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?
Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-24T15:59:30Z.
Claimed in the coordination issue as: SHADER-LDS-EQUAL-WRITES
What and why
For compute-shader
ds_write2andds_write2st64(b32 and b64), equal offsets now emit only the DATA0 store. Both operands are still validated. Distinct offsets store both values, and paired reads are unchanged. AMD RDNA 2 ISA §10.4.3, printed p. 96PortBridge linked THE-PRO-GAME’s finding in VIctory #1088 to the same lowering here. The XCL result uses the same rule.
Tested
a2892784: the hand-written fixture returned DATA1 in all five equal-offset cases, including the implicit zero-offset case. Existing paired read/write controls passed.9ae6f12, all 379 LDS semantic tests passed without skips, including the five address cases and three malformed-operand controls. The no-game-data guard passed.LLVM_MCpath issue. All nine tests in that file passed after normalizing the path. The final head was retested with the LDS suite and Vulkan fixture.GPUs tested: NVIDIA RTX 4070 Ti SUPER, driver 617.14, Windows 11 build 28000. All inputs are synthetic. AMD, retail inputs and the separate legacy geometry path were outside this check.
AI-assisted: yes, Codex assisted implementation and ran the checks.
Checklist
main(a2892784for the baseline comparison). GitHub reports a clean merge with currentmain.docs/design.mdcontract row.Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T16:02:58Z.
Review: APPROVED
Verified the submitted head
9ae6f1253ffc45cc1ebf774dcaa630959111ccb0. The equal-offset regression passes 2/2 and the existing paired LDS b64 suite passes 6/6 on Linux. The new test covers b32/b64, st64, implicit zero offsets and malformed second operands; it confirms the DATA0 result without relying on paired reads.check_no_game_data.pyandgit diff --checkpass. I did not run a GPU test locally.Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-24T16:27:25Z.
One additional result for the upstream fixture: nullmarsh ran all four paired LDS checks successfully at VIctory
59ab6b7on an AMD Steam Deck through vkd3d-proton. This adds a translated RDNA2 check for the VIctory side of the comparison. Original report · PortBridge caseI also tried the PortBridge prior-work summary with this PR’s URL. The GitHub Actions summary surfaced the original VIctory change and the exact XCL test result in one place.
For a future shader review, would anyone on Continued like to try the same lookup on one PR they already care about? You can paste a PR URL into the public catalog to try it immediately. If it helps, maintainers can opt into the manual job-summary workflow, which adds an optional read-only summary. A link to a test you actually reused would help assess the trial.
Imported from ubiquitarianism/leonida. Originally posted by Poussistar on 2026-11-24T16:52:09Z.
Checked this diff on today main (
3ed8e50b7, Linux, CPython 3.14.7): it applies except one hunk,docs/design.md:423. That table moved since the PR opened, sogit applystops there and leaves everything after it unapplied.With
git apply --exclude=docs/design.mdthe rest applies, and the new test passes:Negative control, so the fixture is not vacuous: keeping the new test and reverting
tools/rdna2spirv.pyto main givesFAILED (failures=5, errors=1)with- (858993459, 1145324612)/+ (286331153, 572662306).So the translator change and its fixture are sound on current main; rebasing the
docs/design.mdhunk is what is left. I ran this one file, not the whole translator suite. AI-assisted. No game files.Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-24T17:04:23Z.
Thanks for checking this and including the negative control. I reproduced the plain
git apply --checkfailure atdocs/design.md:423. The neighboring Typed image stores row changed after the branch opened, so the old patch context no longer matches.On both
3ed8e50bandfce586c6,git apply --check --3waysucceeded with the patch’s base blobs available. I also ran a three-way merge check onfce586c6against this PR’s9ae6f125head and confirmed the result contains both documentation rows and all four changed files. Your 2/2 Linux test result is linked in the PortBridge coordination log. The PR head is unchanged.Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T20:07:35Z.
CPU check of
9ae6f1253merged onto main3aa97542(CachyOS, Python 3.14).test_lds_write2_equal_offsets.py: 2 pass; 5 failures and 1 error with main'srdna2spirv.py.run_semantic_tests.py tests/semantic: 471 files / 6,170 tests, 0 failed.wave_diff.py(600 programs) is clean on both.Not tested: GPU, hardware, game corpus. AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T23:33:53Z.
Native RDNA2 result that contradicts this PR, and a follow-up to my CPU check above.
On gfx1036 (Ryzen 7 7800X3D iGPU,
tools/hw_oraclethrough libdrm, CachyOS), equal offsets keep DATA1:ds_write2_b32,ds_write2st64_b32,ds_write2_b64andds_write2st64_b64, offset0 = offset1 = 3, both data orders, wave32 (1 and 32 threads, lane 0 on) and wave64, 10 runs each: 240 of 240. Control: distinct offsets store both values. I read back withds_read_b32.Main's behavior matches this, so I think the change should wait until someone explains the difference from ISA §10.4.3. My CPU check only showed that the code does what its test says.
One chip only; the console is a custom RDNA2. AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T02:47:51Z.
Thanks. Holding this for now, because a hardware measurement in this thread points the other way.
tools/hw_oracle) keeps DATA1 for equal paired offsets in 240 of 240 runs, which is whatmainalready does. The rule here keeps DATA0, backed by the ISA text and other projects' code, but not yet by a hardware run.main, and the new tests fail onmainand pass with the change.ds_write2, 5 listings have equal offsets, and none of their translated modules changes either way.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T19:06:55Z.
Review: APPROVED
Approving. Merged into current main (
9f9a7c5) with no conflicts.test_lds_write2_equal_offsets.pypasses, and the full translator suite gives 491 files / 6,294 tests with onlytest_int32_to_f64failing, the same baseline failure as main here (Linux, Python 3.13).I checked the cited rule in the RDNA 2 ISA (the LDS addressing section, p. 104 of the PDF): "Specify only one address by setting both offsets to the same value. This causes only one read or write to occur and uses only the first DATA0." The change follows it for all four write2 forms: the second store is skipped when its offset equals the first, and the operand checks now run before that skip, so a bad operand is still refused.
AI-assisted (Claude).
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:46:08Z.
#966 | head
9ae6f1253ffc45cc1ebf774dcaa630959111ccb0|python3 -m unittest discover -s tests/semantic -p test_lds_write2_equal_offsets.py -v| red: 2 run, 5 failures, 1 error | green: 2 passed | Red → greenEqual-offset write2 cases on main failed the DATA0 selection and operand-validation checks.
Captured 1 distinct complete SPIR-V module(s) emitted while rerunning test_lds_write2_equal_offsets.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.
Base
3bd936ecd98995bca3e1da83d5e28d2343001aefwas merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:52:15Z.
Merged, thank you @akimfomin! This translator PR (rdna2spirv: keep DATA0 for equal paired LDS write offsets (SHADER-LDS-EQUAL-WRITES)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.