Repository navigation
tests: GPU fixtures for the ds_wrxchg2_rtn_b32 pair cases and ds_wrxchg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT) - #857
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Audited and verified. Adds synthetic GPU test fixtures cs_w32_wrxchg2_ext.asm and cs_w32_wrxchg2st64.asm along with runner integrations in
untime/test/shaders/check.py and scripts/run_gpu_tests.py, exercising 2-element LDS exchange return pairs, register aliasing, and stride-64 scaling. Clean-room compliant with zero game data. Approved.
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Clean-Room Audit & Shader Verification — PR #857 (TEST-WRXCHG2-B32-EXT)
Excellent GPU and runner conformance fixtures for dual-word LDS exchanges.
Technical Verification
- LDS Atomic Exchanges:
- Fixtures
cs_w32_wrxchg2_ext.asmandcs_w32_wrxchg2st64.asmthoroughly exercise dual-word return values, offset aliasing on a single dword, and vdst/data register overlap fords_wrxchg2_rtn_b32andds_wrxchg2st64_rtn_b32. - Lane 0 gating correctly prevents hardware execution races across wavefronts.
- Fixtures
- Runner Integration:
- Cleanly added to
WAVE32_LANE_DUMPS,cs_dump_wants, andjudge_cs_dumpinruntime/test/shaders/check.pyandscripts/run_gpu_tests.py.
- Cleanly added to
- Clean-Room Compliance:
- Fully documented, synthetic hand-crafted assembly with zero game assets.
Verdict: APPROVED
Independent verification — Turing and BlackwellPR head: Environment
Vulkan validation, GPU-assisted validation and synchronization validation enabled. Three repetitions with and without the wave64 emulation setting on each GPU. Results
Both shaders translated successfully and passed spirv-val in every run. All 192 output words matched the expected values exactly across the 24 test executions. The shaders remain wave32 in both configurations, as confirmed by the generated index metadata. GPU-assisted validation failureDespite exact output values, every execution reports one shared-memory data race: The reported instruction pairs are identical across both GPUs and all repetitions:
Total: 24 validation errors across 24 test executions. Conclusion
Synthetic fixtures only. No game files used. AI-assisted test automation and result analysis. |
…hg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT)
docs/design.md's ds_wrxchg2_rtn_b32 row names cs_w32_new_ops as its fixture, and that fixture
compares only the first returned word and data1 in LDS. Four things the row states were therefore
never checked on a GPU: the second returned word, data0, the st64 step, and vdst aliasing the data
VGRs. The row's own note also records the non-st64 step indirectly only on gfx1100.
Two branchless fixtures, one lane each (32 lanes on one LDS address would race):
cs_w32_wrxchg2_ext both offsets on one dword: the first exchange returns the old word and the
second returns data0, not the word the first wrote; a neighbouring LDS word
is untouched; with vdst aliased onto the data VGPRs the data is read before
the result is written, so vdst gets the old pair and LDS the new one.
cs_w32_wrxchg2st64 the st64 unit is 64 dwords: base 0x80 with offsets 1/2 addresses 0x180 and
0x280. 0x84/0x88 (where a 4-byte step would land) and 0x140/0x2c0 (one step
either side of the real elements) are seeded and must come back untouched,
which is what pins the stride rather than assuming it.
Both are registered in check.py (CS_DUMPS, WAVE32_DUMPS, WAVE32_LANE_DUMPS) and
scripts/run_gpu_tests.py, and judge all eight words in hex.
Measured on a Radeon RX 6900 XT (RDNA2, GFX1030, RADV Mesa 26.2.4, Nobara Linux 44), main d0da7da:
build.py 283 shaders: 283 translated, 283 pass spirv-val
check.py 217 of 222 pass, 3 skipped, 2 failed
run_gpu_tests.py 233/251 passed, 16 skipped, 2 failed (native and LEONIDA_W64_EMULATE=1 alike)
--filter wrxchg2 2/2 PASS both modes, every word exact (16/16)
The two failures in the full runs are cs_imgload_tfe and cs_imgload_d16_tfe, the pre-existing
SHADER-1266/ProjectLeonida#31 pair, unchanged by this commit.
No game files, nothing online. AI-assisted (Hermes Agent).
|
Thanks for this — 192 words exact across 24 executions on two NVIDIA generations (Turing 2060 SUPER and Blackwell 5070) is a stronger portability result than I could get alone. One correction to my own framing up front: I had been calling that "cross-vendor", which is wrong — both of your cards are NVIDIA. It is two architectures from one vendor. Same SPIR-V, two vendors: 16/16 words identicalSince your run was all NVIDIA, I measured the other side myself. I built both fixtures on Linux, then ran the identical
16 of 16 words identical. Because both runs used the same That does not speak to the validation warning — values matching and the layer complaining are separate observations, which is exactly why your report is useful. I believe it is not a cross-invocation race (static analysis, unconfirmed)I could not reproduce the GPUAV report. What the reported pair most likely isYour message names the colliding operations as Both fixtures do an atomic exchange on a workgroup word and then a plain load of the same word, to read back what the exchange stored. The first of the two cases in Same word
Why I do not think two invocations are involvedBoth fixtures cut EXEC to lane 0 with
Every workgroup access is behind a real Disclosures
One test would narrow it a lotRun one fixture with a single invocation — change With one invocation there is no second invocation to race with. If the error still fires, it cannot be a cross-invocation race, and the mixed atomic/plain access above becomes the likely trigger. If it goes quiet, that removes support from the single-invocation explanation — it would not by itself tell us what the guard is doing, since a detector that only flags when more than one invocation exists would also fall silent. Two controls, in order of usefulness:
I would not use What these runs would and would not showIf the merged fixtures report the same warning, that shows the finding predates this PR — it does not by itself show the warning is spurious, because a shared translator bug would produce the same result. So "two runs would narrow it", not "settle it". If they are clean and mine report, then my fixtures differ from the merged ones in some way that matters and I would want the two modules' workgroup blocks compared instruction by instruction before anyone argues for merging. I am not asking you to accept this as proven, and I would rather keep the warning visible in the fixture headers than quietly drop it. AI-assisted (Hermes Agent): built five fixtures, ran the two under review on an RX 6900 XT (RADV) and an RTX 5090 (NVIDIA) from the same SPIR-V, traced the EXEC guard and enumerated the workgroup blocks, and identified the atomic-then-plain-load pattern; could not run GPUAV here without the validation layer. |
5ce143e to
a9761ab
Compare
|
GPU test on an NVIDIA Ada card, for the record: this passes on an RTX 4090.
Only the filtered fixture(s) were run for this PR, not the full suite or ctest; the full-suite baseline for this card on |
|
Merged, thanks! The new test fails on
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: TEST-WRXCHG2-B32-EXT
Depends on: #413 (conflicts only — it rewrites this row's prose and I add fixtures plus runner lists; if it lands first I rebase onto it and re-check the row text).
What and why
docs/design.md'sds_wrxchg2_rtn_b32row namescs_w32_new_opsas its GPU fixture. That fixture compares only the first returned word anddata1in LDS — so four things the same row states had never run on a GPU:data0as the second exchange's return when both offsets name one dword,vdstaliasing the data VGPRs (the data must be read before the result is written),st64step at all (the row records it from a gfx1100 measurement, not from a fixture).Two branchless, one-lane fixtures (32 lanes on one LDS address would race — which lane's exchange runs first is up to the hardware, as the existing
cs_w32_new_opsheader notes):cs_w32_wrxchg2_ext.asm1/1on one dword: first exchange returns the old word, second returnsdata0(not the word the first wrote),M[0x204]ends asdata1, a seeded neighbour at0x700is untouched; thenvdstaliased onto the data VGPRscs_w32_wrxchg2st64.asmst64= 256 bytes: base0x80offsets1/2must address0x180/0x280The
st64fixture is built so the stride is proven, not assumed: it seeds0x84/0x88(where a 4-byte step would land) and0x140/0x2c0(one 256-byte step either side of the real elements), and requires all four to come back untouched. A translator that used the wrong unit fails on those words rather than passing by luck.Both judge all eight words in hex, and are registered in
runtime/test/shaders/check.py(CS_DUMPS,WAVE32_DUMPS,WAVE32_LANE_DUMPS) andscripts/run_gpu_tests.py(the shared branch, itscs_dump_wants, the wave32-waiver list and the hex list).Scope note: this deliberately does not edit the
docs/design.mdrow's prose — #413 is rewriting that row and owns it. Once #413 lands, the row can name these two fixtures in the same pass that names the others.Tested
On current
maind0da7da(the branch's base), Radeon RX 6900 XT (RDNA2 / GFX1030, Navi 21), RADV Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44 (kernel 7.2.10), llvm-mc 22.1.8, SPIRV-Tools v2026.1, GCC 16.2.1:Both new fixtures pass in all four runs, with every word exact (16/16). Before this commit the same suite was 231/249 passed, 16 skipped, 2 failed on this card — the
+2 passedis exactly these two fixtures.The two failures in the full runs are
cs_imgload_tfeandcs_imgload_d16_tfe("r32 sint (sint view): 64 bad, texel(5,3) = 2071") — the pre-existing SHADER-1266 / #31 pair, reproduced from stockmainand unchanged by this commit.LEONIDA_W64_EMULATE=1gives byte-identical verdicts, as expected for single-lane shaders with no cross-lane operation.Also:
python -I scripts/check_no_game_data.pyon all four changed files is clean,python -m compileallontools tests scriptsand the two edited Python files passes, and the fixtures are LF with a trailing newline like the neighbouring.asmfiles.ctest/translator suite not run — no translator or runtime C++ change.GPUs tested: AMD Radeon RX 6900 XT (RDNA2, GFX1030, Navi 21, PCI 1002:73bf), RADV / Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44 (Fedora 44), kernel 7.2.10-200.nobara.fc44.x86_64.
AI-assisted: yes (Hermes Agent) — wrote the two fixtures, derived their expected words from the ISA and the row, ran them, and registered them in both runners.
Checklist
mainand merges cleanly.docs/design.md— n/a, no translator change.