Repository navigation
Conversation
One add / subtract of the wave's active-lane count at the offset address, done by the first active lane; the old value to every active lane by a subgroup shuffle (an exchange round under --wave64-emulate). Measured natively on gfx1036: the offset alone is the address, M0 does not move it. The gds form stays Unsupported. GPU fixtures cs_w32/w64_ds_append, semantic test test_ds_append.py, design.md row. AI-assisted.
|
Tested 0fc8a15 on NVIDIA GeForce RTX 4090 (driver 32.0.16.2101) and on AMD Radeon(TM) Graphics (driver 32.0.21043.5001), Windows 11, MSVC 14.51: pass. Vulkan reports subgroup sizes 32..64 on the AMD GPU and 32..32 on the NVIDIA GPU. The runner confirmed the compute subgroup size of each dispatch. I translated the checked-in synthetic disassembly with the translator of this head. For each of
This pull request does not change runtime C++ code. I did not make the disassembly again with LLVM, and I did not run the full CTest suite on this head. AI-assisted. |
|
Tested 0fc8a15 (contains Native,
GPU fixtures,
CPU: AI-assisted (Claude Code). |
|
Tested 0fc8a15 (up to date with main aa2988c) on three setups,
Also OK: AI-assisted. |
|
Tested |
|
AI-assisted. No game files used. Tested 0fc8a15 with four waves per workgroup sharing one LDS counter: Ryzen 5 7600X iGPU (RDNA2 gfx1036, AMD 26.10.1), Windows 11 build 26200, llvm-mc 23.1.6, Four local fixtures (not part of the PR), each with 4 waves in one workgroup on the same LDS words:
Each run's whole 200 runs per mode on the AMD iGPU, all passing:
The validated loop histories are highly interleaved: sorted by returned counter value, 254 or 255 of the 255 adjacent append pairs belong to different waves. This describes observed counter order, rather than measuring simultaneous hardware execution. On the parent, all four fixtures fail to translate ( Negative control: in a local copy of the translator, I replaced the one
So in this sample the one-wave fixtures don't detect a non-atomic implementation, and the multi-wave ones do. One of them might be worth adding to the suite. cs_w32_ds_append_mw.asm (wave32, one append + one consume per wave; the others are similar)Not run: NVIDIA, RDNA1, the |
|
Tested 0fc8a15 (contains main aa2988c) on AMD Radeon RX 6650 XT (gfx1032, discrete RDNA2, subgroup 32..64), driver 32.0.21045.29003, Windows 11, MSVC 19.44, llvm-mc 21.1.8 (built with scripts/build_llvm_mc.ps1): pass.
The PR changes no C++, so the test programs were built from aa2988c. No game files used. AI-assisted. |
slopradish
left a comment
There was a problem hiding this comment.
CPU verification: checked out pull/3976/head in an isolated worktree and ran pytest -q tests/semantic/test_ds_append.py: 4 passed, 8 subtests passed.
The implementation matches the documented hardware behaviour: one LDS add/subtract per wave by the first active lane, with the old value broadcast to the other active lanes via subgroup shuffle (or an exchange round under wave64 emulation). The semantic test checks the count, the performing lane, and that inactive lanes keep vD — those are exactly the parts most likely to be wrong in a first implementation.
The change also updates the contract table, GPU fixtures, checker word lists and GPU runner registration together, so the CPU test won't silently drift from the hardware fixture. I could not run the GPU fixtures here, so the RDNA2/RTX measurements remain the author's; the CPU path is verified.
No game files or keys involved.
docs/design.md AI-assisted.
|
Tested
No game files. AI-assisted (Claude Code). |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-DS-APPEND, #3796 (comment)
What and why
ds_appendandds_consumeraisedUnsupported. Compute shaders use these GFX10 LDS ops for wave-level stream compaction. I found them by translating every gfx1013 opcode form onmain. In the open PRs they appear only in #2323's decoder tables and in a CI script comment.Change (
tools/rdna2spirv.py,Gen.ds_append):s_bcnt1does.x_round) under--wave64-emulate. Without emulation, a wave64 on 32-wide subgroups is only right in the half that holds the first active lane. That is the known cross-half approximation.lds_op's per-lane EXEC selection, so the subgroup operations stay in uniform control flow.gdsform staysUnsupported.Measured natively on RDNA2 gfx1036 (Radeon iGPU of a Ryzen 9 9950X3D, driver 26.10.1,
tools/hw_oracleraw kernels, wave32 and wave64):ds_consume offset:8on 3 lanes subtracts 3.s_nops after the write) do not move the address. The offset field alone is the address. RDNA1 is not measured.New contract row in
docs/design.md.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 ds_append:cs_w32_ds_appendcs_w64_ds_append100 57005 200 57005 108 197 108 140100 100 57005 103 200 199 103 167LEONIDA_W64_EMULATE=1, same words (SKIP without: no 64-wide subgroup)New fixtures:
runtime/test/shaders/cs_w32_ds_append.asmandcs_w64_ds_append.asm. They cover partial-EXEC append and consume, the returned value read in active and inactive lanes (lanes 32, 33 and 63 for wave64), the LDS words, and a full-wave append. The words are derived in their headers. Both are registered incheck.py,run_gpu_tests.pyandregen_fixtures.py.New test:
tests/semantic/test_ds_append.py.spirv_mini_interpkeeps one LDS copy per invocation, so the test checks the parts that don't need shared LDS against a plain-Python reference:gdsis refused.The shared-LDS words are checked by the GPU fixtures.
Red on
main: the test errors withUnsupported: ds_append/ds_consume.Negative control: I made every active lane perform the op. The test fails, and on the Radeon both fixtures fail: the first append leaves
164instead of108, and the wave64 one109instead of103. Then I reverted it.Passing:
python -m unittest discover -s tests/semantic(no new failures: the 7 failures and 3 errors it reports fail the same way onmainaa2988cc, intest_loop_ballot_barrier(emulate),test_vcmp16_opsel(spirv-val),test_cmp_class_f64(TEST-853) andtest_mutations(v_mul_legacy_f32anchor)),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.AI-assisted.
Checklist
docs/design.md, with how it was confirmed.