gfx2hlsl: prove lane-local compute readfirstlane waterfall bodies #2686
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2694"
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-26T02:18:27Z.
Change
This implements the numeric and fixed raw-buffer part of #2644 T1. A compute loop can use a lane-varying
v_readfirstlane_b32key when the next compare selects that key's lanes, the saved remaining mask is intact, ands_andn2_wrexec_b32pluss_cbranch_scc1closes the loop. The fixture covers groups of up to 32 threads for the low-word mask.Each active lane receives its own key on its one participating visit. The proof reuses the compute scalar effect sets, exit liveness and branch targets. It checks the mask copy, entry edges, loop-carried scalars, the straight-line body and the registers that can escape. The output SGPR is marked varying. Per-key byte offsets are supported in a fixed bound raw buffer. Per-key resource selection still requires T3's bound heap range. AMD describes the waterfall and the two WREXEC widths in RDNA 2 ISA §12.3, opcodes 58 and 71.
Verification
Both complete synthetic programs stop at
v_readfirstlane_b32 requires a proven uniform sourceon the parentf06646ba. The host and LLVM 15.0.7 reassembly modes pass on the candidate. They cover a store, a read of the actual active-mask rank, a changed saved mask, a different compare source, a second entry edge, an escaping scalar on one or all paths, loop-carried SGPR/SCC, a per-key descriptor and a group with 33 threads. Overwriting the escaping scalar on every path is a positive control.The independent host reference covers 1,215 input and active-mask combinations. An active-mask-rank body produced 495 counterexamples to singleton execution and has a named refusal here. The synthetic fixtures use no captured input.
The registered dispatch fixture passed on WARP, GeForce RTX 4060 and Intel UHD 770 at
4fe7a4a5. Each run checked active counts from zero to four, an arithmetic overflow case, fixed-buffer reads, and two deliberately wrong references. The affected fixture also retains its original uniform-source and mutation checks.I separately compiled both programs with an input-configurable mask. For each adapter, five key tuples crossed with all 16 four-lane masks gave 80 arithmetic and 80 fixed-buffer readbacks. All 480 outputs matched the independent reference over all 320 words. A separately compiled mutant used the same lane's key for everyone. On each adapter, its first mismatch was word 1 in both programs (arithmetic expected
0x30, got0x50; fixed buffer expected0x91, got0x119). All 97 selected host-side translator and documentation checks passed. Two neighboring graphics fixtures also passed in their actual WARP draw modes.The branch includes #2693, which lets the existing fixture accept the renderer's adapter-selection notice when testing a secondary GPU. Review the four waterfall files against that prerequisite.
The first Linux CI run failed only the scalar-table arity mutation count (37 of 40). I reproduced the same result on unmodified main at
e76f8acd. The three templates with dedicated refusals ares_bfm_b32,s_mul_hi_i32ands_mul_hi_u32. Windows and LLVM CI passed on that head. The upstream fix landed in #2659 atad1ad194. I merged main through8ad488af: the resulting head27de79c9passes both the scalar-table mutation suite and the host readfirstlane tests, including LLVM reassembly.Refs #2644 and #2274. AI-assisted contribution using Codex (GPT-6.2 Astra, xhigh).