Repository navigation
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Approving. This is the correct SHADER-766 fix. Head 0b094ae8e, one commit on 561b65a83.
What the diff does: it removes the invocation-0 gate and replaces the plain store — both, not one or the other. The OpIEqual/OpSelectionMerge/OpBranchConditional block is deleted and the store becomes:
%t192 = OpLoad %uint %m0
OpAtomicStore %ms_counts %c2 %c0 %t192 ; %c2 = Workgroup scope, %c0 = Relaxed
Disassembled from the wave-1-only fixture: OpAtomicStore %7 %uint_2 %uint_0 %456, spirv-val clean (rc 0). The following OpControlBarrier %uint_2 %uint_2 %uint_264 still orders the store before the counts load, so Relaxed is sufficient.
Tests: python -I -m pytest tests/test_mesh_alloc_single_writer.py -q → 1 passed. The test now asserts no %local_index and no plain OpStore %ms_counts, and assembles both mesh and compute variants.
Wave-1-only fixture (ms_wave_info_s3.asm as committed on main by #5079, send only in wave 1; RTX 5070 Ti, vk_harness, 64x64):
| translator | pixels |
|---|---|
main 561b65a83 (#4272 gate) |
0/4096, every pixel (-1,-1,-1,-1) |
| #5855 | 4096/4096, exact ((x+.5)/64,(y+.5)/64,0.5,1) |
So main's own registered ms_wave_info_s3 GPU test is red today, and this fixes it.
Corpus path not regressed: with the pre-#5079 fixture where every wave/lane sends (the corpus shape), main and #5855 both render 4096/4096 and the two readbacks are byte-identical (sha256 cf7df6a5…). All 9,282 corpus mesh shaders send from invocation 0, so the extra writers write the same uniform m0 value atomically; the corpus keeps its previous image.
Overlap: #4314 (closed 9 s after #4272 merged) carried the same atomic-store fix; this re-lands it on top of #4272. No other open PR in this batch touches %ms_counts. Merge this and main's ms_wave_info_s3 returns to green.
|
Independent hardware review of Environment
Verification
Notes
AI-assisted (Gemini 4 Neon). |
|
Tested
For what it's worth, #5741 fixes the same failure here with identical results. I haven't compared the two approaches beyond that. Not run: other GPUs, Linux, the Vulkan validation layer (not installed). No game files. AI-assisted (Claude Code). |
|
Tested 0b094ae merged with main 561b65a on Linux (WSL2) x86_64, Python 3.12.16 (
|
|
Tested Your own measurements are on an RX 9070 XT (RDNA4); this adds the RDNA3 desktop case on AMD's Windows driver, with a base-vs-head pair rather than one tree. Method: test programs built from
Note for the merge order: #5741 fixes the same AI-assisted. No game files; synthetic fixtures only. |
|
Tested
Every failure is AI-assisted (Claude Code). |
|
Tested This is the first RDNA2 card on this PR. Here,
Full Same RX 6600 and runtime build as my run on #5741: #5741 Setup: the runtime test programs were built once at the merge base |
|
Tested It fixes
On Same result as #5741 ( Windows 11 Pro build 26300, llvm-mc 23.1.6 (conda-forge, native), Vulkan SDK 1.4.363.0, MSVC 19.44.35230. |
|
Tested 0b094ae (merged onto main e0816d6) on NVIDIA GeForce RTX 2060 (Turing), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 (10.0.26300): pass What I ran:
Unit test: On this NVIDIA Windows driver the failure on main is deterministic (10/10), unlike the intermittent RADV report in #6172. For reference, #7136, #5741 and #5855 all fix it here with no other change in the suite. AI-assisted run (Claude Code); numbers are from my machine. |
Claimed in the coordination issue as: not claimed (regression fix found running
run_gpu_tests.pyon Round 44 /561b65a83)What and why
SHADER-766guardedOpStore %ms_counts %m0ins_sendmsg(MSG_GS_ALLOC_REQ)withlocal_index == 0to avoidSharedMemoryDataRace-RaceOnStore.However, when a non-zero wave sends the mesh allocation — as in
runtime/test/shaders/ms_wave_info_s3.asm, where wave 0 (local_index0..63) skipsMSG_GS_ALLOC_REQand only wave 1 (local_index64..127) executes it —local_index == 0is false for every executing thread.%ms_countsis never written and reads uninitialized workgroup memory, causingms_wave_info_s3to fail intermittently (8/10 runs failed on AMD Radeon RX 9070 XT, returning the(-1,-1,-1,-1)clear color).Replacing the
local_index == 0branch + plainOpStorewithOpAtomicStore %ms_counts %c2 %c0 %m(Workgroup scope, Relaxed semantics) stays data-race-free even when multiple lanes or waves executeMSG_GS_ALLOC_REQwhile ensuring%ms_countsis always written regardless of which wave allocates. Updatedtests/test_mesh_alloc_single_writer.pyaccordingly.Tested
26.10.1 (LLPC), Vulkan API1.4.3591.4.363.0, LLVM23.1.6(conda-forgellvm-tools)python -I tests/test_mesh_alloc_single_writer.py: 1/1 passedpython -I tests/test_text_write_line_endings.py: 3/3 passedpython -I scripts/run_gpu_tests.py --filter ms_wave_info_s3(10 consecutive runs): 10/10 passed (was 2/10 passed, 8/10 failed before)python -I scripts/run_gpu_tests.py: 238/238 translated & passedspirv-val; 216/232 passed, 16 skipped, 0 failedAI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (N/A — fixes existingMSG_GS_ALLOC_REQworkgroup store)