Repository navigation
Conversation
…rd*) s_store_dword/x2/x4 and s_buffer_store_dword/x2/x4 exist on gfx1010-gfx1013 (the console) only. They now write SDATA as PhysicalStorageBuffer stores at the address an s_load / s_buffer_load of the same operands reads, with the buffer bound; a lane-mask source is refused. Scalar atomics stay Unsupported. Not measurable on the gfx1036 oracle. GPU fixture cs_w32_scalar_store, semantic test ScalarStores, design.md row; the old contract test that expected Unsupported now checks the emitted stores. AI-assisted.
s_atomic_* and s_buffer_atomic_* (the 32-bit buffer atomic kinds, inc/dec, cmpswap, and the and/or/xor/swap _x2 forms as one 32-bit atomic per dword) are performed by the invocation in hardware lane 0 of the wave, at the s_load / s_buffer_load address; with glc the old value is shuffled to every lane (an exchange round under --wave64-emulate). Compute and mesh only. GPU fixtures cs_w32_scalar_atomic / cs_w64_scalar_atomic, semantic test ScalarAtomics. AI-assisted.
AI-assisted.
…omic AI-assisted.
# Conflicts: # docs/design.md
|
Independent CPU review at
AI-assisted. |
kacper-serewis
left a comment
There was a problem hiding this comment.
CPU review at 5c7c476; 88ef3e8 changes only docs/design.md relative to the tested tree. With two logical wave32s in one synthetic 64-wide subgroup, two adds of 3 correctly move 100 to 106 but both waves receive old value 100. The return shuffle at rdna2spirv.py:8974 reads lane 0 for both; the second logical wave needs lane 32. With 32-wide subgroups the returns are 100 and 103. Separately the _x2 lowering near line 8944 uses independent 32-bit atomics, allowing a torn pair under contention (source finding). Preserve 64-bit atomicity or explicitly reject unsupported forms. Three focused CPU tests passed. AI-assisted; no GPU execution.
|
Tested
No game files. AI-assisted (Claude Code). |
runtime/test/shaders/check.py scripts/run_gpu_tests.py tools/rdna2spirv.py AI-assisted.
|
Tested 4458ea1 on NVIDIA RTX 4080, driver 610.88, Windows 11: pass This head is the merge of
Not run here: native GFX10.1 hardware. The description notes the gfx1036 oracle can't assemble scalar atomics. Review: no new findings. The AI-assisted. |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-SMEM-ATOMIC, #3574 (comment)
Depends on: #3589 (scalar stores). This branch is stacked on it, and only the last two commits are new here.
What and why
s_atomic_*ands_buffer_atomic_*raisedUnsupported. Like the scalar stores, they exist on GFX10.1 only (gfx1010-gfx1013, which includes the console). Each one is a single atomic per wave, at the address ans_load/s_buffer_loadof the same operands reads. Withglc, SDATA gets the value from before the op.Change (
tools/rdna2spirv.py,Gen.scalar_load(..., atomic=kind)andGen.scalar_atomic):--wave64-emulateand when a wave64 spans two 32-wide subgroups. Other stages raiseUnsupported.glc). Every lane gets lane 0's value, throughOpGroupNonUniformShufflefrom lane 0, or through an exchange round (x_round) under--wave64-emulate. A wave64 on 32-wide subgroups without emulation gets the value in lanes 0-31 only, the same known cross-half approximation as the other cross-lane ops._x2forms are translated as one 32-bit atomic per dword, asbuffer_atomic_*_x2does._x2forms stayUnsupported.s_buffer_atomicwhose element ends past the V# limit does nothing and returns 0, as the load reads 0 there. This is inferred.s_storefollowed by ans_atomicon the same address in one wave can see the store land after the atomic. This is documented in the scalar-store row, and the semantics are unchanged.Not measured natively. The gfx1036 oracle has no scalar atomics (
llvm-mcrejects them for gfx1030/gfx1036). An RDNA1 part (gfx1010-gfx1013) could check them natively, for example the V540 farm announced in the coordination issue.New contract row in
docs/design.md. The scalar-store row now points to it.Tested
Windows 11, LLVM
llvm-mc(-mcpu=gfx1013),VK_LOADER_LAYERS_DISABLE=~implicit~, one GPU at a time,python -I scripts/run_gpu_tests.py --filter scalar_atomic. Thevk_compute_testdevice lines wereAMD Radeon(TM) Graphics (subgroup 32..64)(withcompute subgroup size: 64for wave64) andNVIDIA GeForce RTX 5080 (subgroup 32..32).cs_w32_scalar_atomiccs_w64_scalar_atomic100 7 240 5 103 5 15 6100 100 240 5 103 15 255 261LEONIDA_W64_EMULATE=1, same words (SKIP without: no 64-wide subgroup)runtime/test/shaders/cs_w32_scalar_atomic.asm: add, sub, cmpswap and inc, withs_buffer_atomicands_atomic, returned values read in lane 31.cs_w64_scalar_atomic.asm: add, cmpswap andor_x2, returned values read in lanes 0 and 63.check.py,run_gpu_tests.pyandregen_fixtures.py.ScalarAtomicsintest_value_semantics.pyruns every lane of one wave (wave64 on a 64-wide subgroup), checks the words against a plain-Python reference, and checks the refusals (a pixel shader,s_atomic_add_x2).Unsupported: s_atomic_addands_buffer_atomic_add.ScalarAtomicsfails, and on the Radeon both fixtures fail, with the add target at196(100 + 32 × 3) and292(100 + 64 × 3). Then I reverted it.python -m unittest discover -s tests/semantic,python tests/semantic/regen_fixtures.py --check(clean),python -I tests/test_shader_checks.py, andpytest tests/test_docs_design_rows.py tests/test_run_gpu_tests.py tests/test_shader_meta.py.AI-assisted.
Checklist
docs/design.md, with how it was confirmed.