Repository navigation
Conversation
|
Review of head a509b37 (AI-assisted, CPU only). Environment: Linux (WSL2), Python venv, no GPU, no spirv-val/spirv-as installed. What ran:
Reading of the emitted SPIR-V (not run through spirv-val here): atomic load, then a loop whose header computes docs/design.md row: says how it was confirmed (CPU test plus a GPU run of the two-lane case on an RTX 3080, with the old and new results). The gfx1036 32-lane lane-order measurement stays and the row says the CAS lowering does not promise that order. Fine. Not tested: any GPU run, spirv-val on the module, wave64 emulation, the corpus slice before/after counts. No defects found. Review written by Claude (Claude Code, Opus 5.5), an AI agent, posted from a contributor's account. |
…contention # Conflicts: # docs/design.md
… page with ProjectLeonida#522's ds_mskor row The keep-both resolution of ProjectLeonida#522's conflict also restored main's copies of the ds_{inc,dec,rsub}, ds_wrxchg2 and ds_mskor rows that ProjectLeonida#413 had edited (test_design_contract_rows, test_docs_design_rows). The page is now the one before the merge with ProjectLeonida#522's ds_mskor row in place, which keeps ProjectLeonida#413's GPU-fixture note, marked as measured on the earlier two-atomic emission. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed as SHADER-LDS-MSKOR-ATOMIC.
Depends on: #413 (documentation-row overlap only; no code dependency). Whichever merges second should retain that PR's fixture attribution and this corrected atomicity contract. Draft #173 adds a separate single-active-lane fixture and is not a dependency.
What and why
The operation is specified in the AMD RDNA2 ISA guide, section 12.13. Two lanes updating the same LDS word with
ds_mskor[_rtn]_b32can currently produce a value no atomic execution permits. From zero, lane 0 clears bit 0 and sets bit 1, while lane 1 clears bit 1 and sets bit 0. A complete masked-OR operation must leave 1 or 2. The translator's separate atomic AND and OR leave 3; both lanes return zero.Replace the split operations with a Workgroup-scope atomic load/compare-exchange loop. A failed exchange supplies the next old word, and the loop recomputes the entire update. The returning form exposes the old word of its successful exchange. Existing EXEC and LDS-bound guards remain around the operation; address/mask/data are captured before a potentially aliasing destination is written.
The regression checks both valid serial orders, both instruction forms and offsets 0/12. Additional coverage checks destination aliasing and inactive lanes. Update the existing contract row with measured translator results and the limitation that host atomic ordering does not promise the lane order measured on native RDNA2.
Tested
Native RTX 3080, one hand-written 32-thread wave with two active update lanes; fields below are
[old0, final0, old1, final1]:[0,3,0,3][0,1,2,1]Both modules translated, assembled and passed
spirv-valfor Vulkan 1.2. Both native dispatches completed with GPU-assisted validation enabled and zero validation errors; only the old translation violated the result oracle. Used SPIRV-Tools 2026.4, Khronos validation layers 1.4.357.0,LEONIDA_VK_VALIDATION=1,VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1and subgroup size 32.No retail/game data was used. These measurements establish synthetic shader translation behavior, not a retail-game rendering result.
GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 build 26300.
AI-assisted: yes (Codex); independently reviewed by a second agent.
Checklist
main; code and tests merge cleanly. Documentation overlap with docs/design.md: name the GPU fixtures of six atomics rows (DOC-GPU-VERIFIED-ATOMICS) #413 noted above.