Repository navigation
rdna2spirv: wave64 emulation resets shared words with OpAtomicStore (SHADER-W64-SINK-RACE-CARRY) - #1110
Conversation
The emulated scheduler resets %x_buf words every round. The lane that owns a word stores to it and every other lane aims the same store at one sink word; the prologue's zeroing clamps its index the same way. Several invocations therefore store to one Workgroup word at once: a data race, harmless because the word is never read, but GPU-assisted validation reports it in every emulated shader and so hides any real race. Those 16 stores are now OpAtomicStore (Workgroup scope, relaxed), the same operands as the OpAtomicOr already used on this buffer. The values written are unchanged. On an RTX 3080 Ti, run_gpu_tests.py with LEONIDA_W64_EMULATE=1 under GPU-assisted validation goes from 44 failed fixtures to 12; without it the result is unchanged (229/248). Two test-local interpreters learn OpAtomicStore, and a new case checks that no plain OpStore targets a shared %x_buf word. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Reviewed and verified. Eliminates Vulkan validation layer data race errors by using OpAtomicStore (Workgroup scope, relaxed semantics) when zeroing the %x_buf sink word across multiple lanes during wave64 emulation. Verified with ests/semantic/test_wave64_emulate_opt.py and semantic suite. 100% clean-room compliant.
|
Recommendation: [MERGE] Reasoning: Carries #382: wave64 emulation resets shared Impact level: 5/10 |
|
Follow-up measurement: the description says I had no validation layer and quoted the author's GPU-assisted validation count. I have the layer now (
The 32 fixtures that become clean are the wave64-emulated ones ( The 8 that remain are the same 8 a native run (no emulation) reports on A control run confirmed the setup reports errors: a compute module given to GPU: NVIDIA GeForce RTX 3060 Ti, driver 621.14, Vulkan 1.4.357, Windows 11 26200 (32-wide subgroups). AI-assisted (Claude Code); measured on that machine. |
|
Merged. Thanks for carrying this, and to natterman12 for the original (#382).
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: SHADER-W64-SINK-RACE-CARRY
What and why
This carries #382 by @natterman12 onto current
main: one commit,5cb32c2b3, cherry-picked with its author kept and no change of mine. #382 was closed by its author on 24 November along with his other open pull requests, after three independent GPU verifications (RTX 3080 Ti Laptop, RTX 4080, Radeon RX 6900 XT on RADV).mainstill has the plain stores, and no open pull request carries the fix.The wave64 emulation resets words of
%x_bufevery round. The lane that owns a word stores to it and every other lane aims the same store at one sink word, so several invocations write one Workgroup word at once. The word is never read, but GPU-assisted validation reports the race in every emulated shader, which hides any real one. Those 16 stores becomeOpAtomicStore(Workgroup scope, relaxed), the same operands as theOpAtomicOralready used on the buffer. The values written do not change.@natterman12: this is your work. If you reopen #382 or want this branch, say so and I will close this.
Tested
Windows 11 26200.9974, Python 3.13.14,
llvm-mc23.1.6 (conda-forge, AMDGPU target), SPIRV-Tools v2026.4. Runtime test programs built frommain3aa975421with MSVC 19.44; this change does not touchruntime/.maintests/semantic/test_wave64_emulate_opt.pywith the newSharedWordStoresTestsOpStorelines)tests/semantic/test_loop_ballot_barrier.pyscripts/run_semantic_tests.py tests/semanticrun_gpu_tests.py, nativerun_gpu_tests.py,LEONIDA_W64_EMULATE=1The first row's
maincolumn is the new test file run againstmain's translator. I do not haveVK_LAYER_KHRONOS_validationinstalled, so the GPU-assisted validation count (44 failed fixtures down to 12 on the author's RTX 3080 Ti) is the original measurement, not mine; what I measured is that the emulated run is unchanged on a 32-wide-subgroup device.python -I scripts/check_no_game_data.pyon the three changed files: no hits.git diff --check: clean.GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Vulkan 1.4.357, Windows 11 26200
AI-assisted: yes (Claude Code; run and measured on the machine above)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed: n/a (no new rule; the stores write the same values).🤖 Generated with Claude Code