compute: LDS reads, writes and atomics plus s_barrier (groupshared lowering) #1541
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1541
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@denn0x on GitHub · 2026-11-24 13:47 UTC · original
Problem
The compute translators have no LDS. Measured on the 349 gfx1013 compute programs (device slot 67 pipelines) that the executable created in one run past start-up, and on the 627 dispatches of one busy frame after loading. 38 programs (44 of the busy frame's dispatches) stop at a
ds_*instruction; across all programs the forms are
ds_read_b64(811 sites),ds_write_b128(550),ds_read2_b32(416),
ds_read_b32,ds_write_b32,ds_write2_b32,ds_write2st64_b32,ds_read2st64_b32,ds_write_b64,ds_min_u32,ds_max_u32,ds_add_u32,ds_add_rtn_u32,ds_or_b32,ds_wrxchg_rtn_b32, ands_barrier(140 sites).
Proposal
groupshared uint lds[N]with N fromCOMPUTE_PGM_RSRC2.LDS_SIZE(bits 23:15, 512-byte units on gfx10); refuseabove the 32 KiB D3D12 limit.
ds_write*_bNN addr, data offset:kstores dwords at(addr + k) >> 2;ds_write2*usesoffset0/offset1scaled by the element size, and by 64 elements for the
st64forms. Reads mirror this.ds_{add,min,max,or,and}_u32map toInterlocked*onlds[]; the_rtnforms return the old value.s_barriermaps toGroupMemoryBarrierWithGroupSync(). fxc refuses a barrier under per-lane control flow(X3663) even where the machine program is wave-uniform; compiling those with dxc (cs_6_0) works.
A local experiment lowers these as above; with it, LDS stops no longer appear in the census.
Alternatives
Refuse every program with LDS (current behaviour).
Verification
A source-built gfx1013 fixture (LLVM 15
llvm-mc, as the existingcompute_store_check.pyandpixel_aot_check.pyfixtures) that uses the instructions, translated and dispatched on WARP, with the UAV read back and compared with
expected words. Include a negative control (an operand form or modifier the lowering refuses).
Checklist
AI-assisted (Claude Code).
@Vladimir-Human on GitHub · 2026-11-25 13:05 UTC · original
Claiming a narrow follow-up to #2327: bounded 64-bit group-shared LDS exchanges (\ds_write_b64\ and \ds_read_b64\ across \s_barrier\ in 1D compute groups) in \ ools/startup/gfx2hlsl.py, leaving \ds_read2_b32\ (#2274) and dynamic-EXEC forms untouched. PR incoming with WARP and desktop GPU readback checks plus negative controls.
AI-assisted.
@Vladimir-Human on GitHub · 2026-11-25 14:40 UTC · original
Claiming bounded 128-bit group-shared LDS exchanges (
ds_write_b128andds_read_b128acrosss_barrierin 1D compute groups) intools/startup/gfx2hlsl.py, extending the 64-bit LDS exchange path with mixed-width uint-array interoperability, bounds/alignment refusals, Python unit tests, and WARP + desktop GPU readback checks.AI-assisted.
@RavenCurseBurg on GitHub · 2026-11-26 02:41 UTC · original
I will take a test-only fix for the startup LDS readback fixtures on a secondary adapter. Their successful-path checks currently treat the hardware enumeration notice as a test error, and the mutation summary can print the notice instead of the differing word. I will reproduce on Intel UHD 770 with RTX 4060 and WARP controls, keep genuine stderr, skips and debug-layer checks, and verify the mutation diagnostics.
@RonLogic on GitHub · 2026-11-26 04:37 UTC · original
Independent post-merge check for the standalone
compute_store_aotslice in #1566. Ranpython -B tests/pyc_main.py compute_store_check draw-lds-shared <dxc> <offscreen_check> <backend>at343dc04fwith SDK DXC1.9.2602.17and a matching MSVC Release runner on Windows26300.10075. In-box WARP10.0.26100.10068and physical RTX 407032.0.16.2124both passed without skips. The D3D12 debug layer reported zero errors and warnings. The three mutations were caught at words 0, 1 and 11 on each backend. This adds a result on in-box WARP and a second physical adapter for that one-guest-wave fixture.