startup: lower a bounded LDS dword exchange across a group barrier #2319
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2327"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T12:29:18Z.
First startup-compute LDS slice from the Part A claim.
The startup translator can now dispatch a straight-line exchange between workgroup lanes. Each thread in a 1D group fills one distinct LDS dword. A completed LGKM wait and an unconditional
s_barrierpublish the span. Subsequentds_read_b32instructions read a proven, aligned address in that span and wait for completion. The fill address islocal X << 2. Each read uses an immediately preceding literal move or a literal mask that bounds its byte address. The translator checks instruction offsets and the allocation fromCOMPUTE_PGM_RSRC2, and retains named refusals for other shapes. This permits two 32-lane halves to communicate without assuming a guest wave width. AMD RDNA 2 DS instructions · LLVM AMDGPU register fields · HLSL group barrier.Case F is a 116-byte LLVM 15 gfx1013 program. Two 64-thread groups write distinct values and read both the opposite half's lane and lane 37. The strict CPU oracle checks all 256 output words and 64 sentinels.
The real
--pendingpath compiled the accepted request with DXC 1.9.2609.5. All three adapters dispatched that published bytecode.--refusalsexamined three requests; removing the barrier or declaring zero LDS produced the expected refusal and no manifest. Before this change the valid source was refused atds_write_b32.On the final head, all 63 host scripts passed. LLVM 15.0.7 reproduced the recorded bytes. The controls cover bounds, control flow, and the first and last legal allocation sizes. A host assertion checks barrier placement independently of GPU scheduling. After #2325 merged, the normal unfiltered dispatch entry passed all seven programs on each adapter, and its two LDS mutations reported the predicted first bad words on all three. The desktop D3D12 debug layer was unavailable.
Refs #2274 and #1541.
The Windows debug-layer run at fff661e0 passed all 10 selected CTests with no skips. WARP matched 320/320 in case F, the two controls failed at words 0 and 1 as predicted, and the D3D12 debug layer reported zero warnings and errors.
Agent environment: Codex + GPT-6.2 Astra xhigh.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:31:51Z.
Review: COMMENTED
Review of head
fff661e062e5716edf2e799e357a99b5c4964c9f(comment only, not an approval).Scope:
tools/startup/gfx2hlsl.py(check_lds_exchange, DS/barrier lowering,lds_wordsfrom RSRC2),CMakeLists.txt(two new controls),tests/startup_gfx2hlsl_compute_check.py(case F),docs/experiments.md.Commands executed locally (Linux):
git diff --stat origin/main...HEAD-> 4 files, +199/-2python3 -B tests/startup_gfx2hlsl_compute_check.py-> pass (includes the newcheck_lds()refusal matrix)python3 tests/docs_links_check.py-> pass (18 files, 451 links)python3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> cleanhigh % 4alignment guard on the masked read -> the suite fails (expected a refusal naming 'aligned'). Killed.expected a refusal naming 'completed fill'). Killed.git checkout -- ..Logic read-through:
v_lshlrev_b32 vN, 2, v0directly before a singleds_write_b32, with no earlier VALU that can write v0 (v_swap and 64-bit forms are refused). One write per lane and a bounded span look correct.v_movor a literalv_andmask directly before the read, an aligned span check, and a followinglgkmcnt(0). I could not construct an accepted program that reads outside the span.Findings: P1 = 0, P2 = 0.
check_lds_exchangeruns the scalar/VALU guard only before the first write. This is fine because later reads are address-proven from literals, but a short comment saying so would help the next opcode extension.s_barrieris matched by the exact texts_barrier 0x0. A different assembler spelling is refused, not mis-translated. That is safe, just narrow.Not run: the Windows WARP readback (case F
f-peerandf-broadcastcontrols). The PR body reports it, and CI Windows jobs were still pending at review time. I did not re-run it myself.Checks / hygiene: title is neutral, the PR is not Draft, mergeable state was UNKNOWN (CI pending).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T12:36:17Z.
Addressed the two notes in
a0122ece. The prefix comment explains why later reads no longer depend on the entry X ID. The barrier now checks its parsed operand and accepts zero or an omitted immediate; a source-word control checks rejection of a nonzero reserved immediate. The host refusal matrix and the real offline request plus WARP/RTX/UHD readbacks passed again. The original Windows WARP debug-layer run passed 10/10, and the new run pins this reviewed head.