Recompiler: a per-lane form for the direct DXIL backend (XCL_PER_LANE) #1745

Manually merged
github merged 51 commits from gh-pr/1745/head into gh-pr/1745/base 2026-11-26 05:03:31 +00:00
Owner

@⁠gefydev on GitHub · 2026-11-24 20:09 UTC · original
gefydev:direct-on-1426 → main · +7596 −136 · 14 files · 51 commits · merged 2026-11-24 21:10 UTC

A per-lane form for the direct DXIL backend (#1426): where a lane-mask analysis proves EXEC, console code is lowered without EXEC guards. Each lane carries its own bit of every mask, mask branches become per-lane branches, and guards stay only where EXEC is not proven. Instructions it has no lowering of go through #1426's Lw::inst_guarded with the analysis's guard. It is opt-in: with XCL_DIRECT_DXIL=1 XCL_PER_LANE=1, a compute program tries the per-lane form, then #1426's per-instruction form, then the HLSL path. Without XCL_PER_LANE nothing changes. Part of #1269.

It is one PR at the maintainer's request: the size rule is waived for this feature (asked of the maintainer by @⁠gefydev; the plan is on #1269, the waiver itself was not posted on GitHub). About 2 600 of the 7 460 added lines are tests.

Result so far, for the maintainer to judge. Whole-pack sweep of a retail title (xcl shaders --direct --lanes --sample 0 --max-bytes 0 --split 0 --windows 4 --timeout 120): the per-lane form translates 316 of 2 689 compute programs (with the stricter rules from the reviews below; 321 before). On those, its DXIL is 4 020 436 B against 3 988 440 B for #1426's per-instruction form (+0.8 %): no size gain. After bmjask's cleanups, #1426 emits few guards on these programs. Measurements on #1269 point the same way: removing every EXEC select takes about 9 % off driver time on one RTX 3080 program, against 85 % for the window switch, which #1693 now addresses. The large programs, where a gain would matter, are still refused. The main refusals are structural: a branch on whether any lane of a mask is set, with lanes in EXEC that lack the bit (the first refusal of 1 771 programs; the console decides those for the whole wave), and stale values (154). Driver time, measured by Raghav314 on an RTX 4090 (#1269), on the 310 programs that build in all four forms: per-lane 10.0 s, #1426 per-instruction 10.5 s, HLSL 14.1 s driver + 21.9 s DXC, and HLSL with heap windows 10.8 s + 17.2 s. Per-lane against #1426 is a median ratio of 0.98, so again no real gain on what it covers. So this PR is the infrastructure plus measurements. It does not deliver a speedup today.

What is in it (51 commits; authors kept)

  • gpu/recomp/lane_masks.rs: the lane-mask analysis (BDD over lane / SCC / opaque atoms, worklist dataflow, loop heads, irreducible flow refused). The launch EXEC can be an atom for VS / PS (teidenzero).
  • gpu/recomp/ssa.rs: on-the-fly SSA (Braun et al.), with a number view and a lane-bit view per SGPR.
  • gpu/recomp/lower.rs, lower/wave.rs: the lowering behind an Ir trait, with a CPU interpreter for tests. It covers SALU / VALU / memory, mask ops, s_cselect / s_wqm / v_cmpx, far jumps, and cross-lane ops (Sr-0w). It refuses stale values written where some lanes are elsewhere. Also guard coalescing (MiguelMachado-dev) and VS / PS stages (teidenzero). The bridge to #1426 refuses an instruction when #1426 would read a register it was not passed.
  • gpu/recomp/lower_dxil.rs: the Ir on #1426's Lw. It handles head / tail blocks, so #1426 can make blocks inside an instruction, plus several and heap memory windows, the split wave64 form (upipibi) and batched trivial-phi replacement (Itsmetibo).
  • gpu/dxil/kernel.rs: Lw::new / Lw::finish out of the kernel translator, with no change to #1426's output (Sr-0w).
  • gpu/recomp/pso.rs: the runtime hookup behind XCL_PER_LANE=1, with its own translated-cache identity.
  • gpu/recomp/dxil/assemble.rs: IR text to a signed container, as a test oracle (Sr-0w).
  • shaders.rs: xcl shaders --direct --lanes (coverage and size against #1426), plus the per-lane refusal survey (Kalmarv).
  • Tests: f32 / f64 / integer / f16 programs on the HLSL path and per lane (vladbondarenko97), GPU comparisons of the per-lane DXIL against the CPU lowering and the HLSL path, and split-form and four-window runs.
  • Bugs found on the way, fixed here with tests:
    • the f32 reference's signed zeros on AMD (Diskuss);
    • an overflow for s0 in the mask-pair check (nobodyttk);
    • split compute through the runtime asked for WaveSize(64) (MiguelMachado-dev);
    • the kernel entry never set up Lw's lanes (vladbondarenko97);
    • a copied value in a partial block escaped the stale check (MiguelMachado-dev).
    • from reviews of this PR: whole-wave branches and selects on a mask some lanes in EXEC lack, and rounding modes the per-lane form dropped (Kalmarv); such an SCC carried around a loop (thehollowedone); per-lane cache entries outliving source changes (Pipodi).
  • #1426 semantics that differ from the console (v_cvt_f16_f32, v_mul_f16, v_pk_mul_f16 round toward zero) stay on the fallback (DIFFERS_ON_1426); itsSio is fixing them on main.

Tested

  • NVIDIA GTX 1650 (wave32 only, so the split wave64 tests run for real), driver 621.24, Windows 11 Pro 26300, Rust 1.100.0, debug.
  • cargo test --workspace -- --test-threads=4 on the head (bfb8133, on main 4178e88): 955 passed, 0 failed, 42 ignored. With XCL_ADAPTER=warp (the CI adapter, no sized waves) the lib gives 876 passed, 0 failed, 22 ignored: the per-lane GPU tests skip there.
  • SKIPPED (22): 18 "no wave64" (this GPU), 1 "no heap windows", and 3 per-lane halves refused on purpose (V_CVT_F16_F32, V_MUL_F16, V_PK_MUL_F16, see above).
  • Whole-pack sweep (release, on d5fd85d, before the rebase onto main and the last four commits): numbers as in the result paragraph; 577 s.

Regression run
main:

xcl-smoke v1
commit: 6c89285b8b529bde59cd17a26b911c39912fb677
gpu: NVIDIA GeForce GTX 1650
title: xcl-title
seconds: 60
exit: 0x0
frames shown: 889 (PresentX 890)
presents per 2 s (last 3): 2 0 12
device removals: 0
crashes: 0
peak commit: 15518 MB

This PR's head:

xcl-smoke v1
commit: bfb8133d36df38c3de381f9d99203568b32aa765
gpu: NVIDIA GeForce GTX 1650
title: xcl-title
seconds: 60
exit: 0x0
frames shown: 915 (PresentX 916)
presents per 2 s (last 3): 0 0 9
device removals: 0
crashes: 0
peak commit: 11638 MB

Both with XCL_PER_LANE off (the default), so they check that nothing changes. The machine was short of memory: runs of earlier head builds gave 508 to 931 frames, so the frame counts vary a lot run to run here.

Not tested

  • Native wave64 GPUs (AMD) on my side; helpers ran parts of the branch on RX 7800 XT / RX 9070 XT and RTX 3060 Ti–5080 (#1269).
  • DXC and driver times of the per-lane form against #1426's (only DXIL sizes measured).
  • A title run with XCL_PER_LANE=1; the regression runs below are with it off, the default.
  • Mesh shaders in the per-lane form; VS / PS has only its lowering half (no adapter yet).

AI use

  • Claude Code (Claude Opus 5.5): wrote my commits, the tests in them and this description, ran the checks. Helpers' commits carry their own AI-use notes on #1269. Two of MiguelMachado-dev's commits (guard coalescing and its split-form test) carry Assisted-by: Antigravity (Gemini 4 Neon); the other helpers name their tools on #1269.
**@⁠gefydev** on GitHub · 2026-11-24 20:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745) `gefydev:direct-on-1426` → `main` · +7596 −136 · 14 files · 51 commits · merged 2026-11-24 21:10 UTC A per-lane form for the direct DXIL backend (#1426): where a lane-mask analysis proves EXEC, console code is lowered without EXEC guards. Each lane carries its own bit of every mask, mask branches become per-lane branches, and guards stay only where EXEC is not proven. Instructions it has no lowering of go through #1426's `Lw::inst_guarded` with the analysis's guard. It is opt-in: with `XCL_DIRECT_DXIL=1 XCL_PER_LANE=1`, a compute program tries the per-lane form, then #1426's per-instruction form, then the HLSL path. Without `XCL_PER_LANE` nothing changes. Part of #1269. It is one PR at the maintainer's request: the size rule is waived for this feature (asked of the maintainer by @⁠gefydev; the plan is on #1269, the waiver itself was not posted on GitHub). About 2 600 of the 7 460 added lines are tests. **Result so far, for the maintainer to judge.** Whole-pack sweep of a retail title (`xcl shaders --direct --lanes --sample 0 --max-bytes 0 --split 0 --windows 4 --timeout 120`): the per-lane form translates **316 of 2 689** compute programs (with the stricter rules from the reviews below; 321 before). On those, its DXIL is **4 020 436 B against 3 988 440 B** for #1426's per-instruction form (+0.8 %): **no size gain**. After bmjask's cleanups, #1426 emits few guards on these programs. Measurements on #1269 point the same way: removing every EXEC select takes about 9 % off driver time on one RTX 3080 program, against 85 % for the window switch, which #1693 now addresses. The large programs, where a gain would matter, are still refused. The main refusals are structural: a branch on whether any lane of a mask is set, with lanes in EXEC that lack the bit (the first refusal of 1 771 programs; the console decides those for the whole wave), and stale values (154). Driver time, measured by Raghav314 on an RTX 4090 (#1269), on the 310 programs that build in all four forms: per-lane 10.0 s, #1426 per-instruction 10.5 s, HLSL 14.1 s driver + 21.9 s DXC, and HLSL with heap windows 10.8 s + 17.2 s. Per-lane against #1426 is a median ratio of 0.98, so again no real gain on what it covers. So this PR is the infrastructure plus measurements. It does not deliver a speedup today. **What is in it** (51 commits; authors kept) - `gpu/recomp/lane_masks.rs`: the lane-mask analysis (BDD over lane / SCC / opaque atoms, worklist dataflow, loop heads, irreducible flow refused). The launch EXEC can be an atom for VS / PS (teidenzero). - `gpu/recomp/ssa.rs`: on-the-fly SSA (Braun et al.), with a number view and a lane-bit view per SGPR. - `gpu/recomp/lower.rs`, `lower/wave.rs`: the lowering behind an `Ir` trait, with a CPU interpreter for tests. It covers SALU / VALU / memory, mask ops, `s_cselect` / `s_wqm` / `v_cmpx`, far jumps, and cross-lane ops (Sr-0w). It refuses stale values written where some lanes are elsewhere. Also guard coalescing (MiguelMachado-dev) and VS / PS stages (teidenzero). The bridge to #1426 refuses an instruction when #1426 would read a register it was not passed. - `gpu/recomp/lower_dxil.rs`: the `Ir` on #1426's `Lw`. It handles head / tail blocks, so #1426 can make blocks inside an instruction, plus several and heap memory windows, the split wave64 form (upipibi) and batched trivial-phi replacement (Itsmetibo). - `gpu/dxil/kernel.rs`: `Lw::new` / `Lw::finish` out of the kernel translator, with no change to #1426's output (Sr-0w). - `gpu/recomp/pso.rs`: the runtime hookup behind `XCL_PER_LANE=1`, with its own translated-cache identity. - `gpu/recomp/dxil/assemble.rs`: IR text to a signed container, as a test oracle (Sr-0w). - `shaders.rs`: `xcl shaders --direct --lanes` (coverage and size against #1426), plus the per-lane refusal survey (Kalmarv). - Tests: f32 / f64 / integer / f16 programs on the HLSL path and per lane (vladbondarenko97), GPU comparisons of the per-lane DXIL against the CPU lowering and the HLSL path, and split-form and four-window runs. - Bugs found on the way, fixed here with tests: - the f32 reference's signed zeros on AMD (Diskuss); - an overflow for `s0` in the mask-pair check (nobodyttk); - split compute through the runtime asked for `WaveSize(64)` (MiguelMachado-dev); - the kernel entry never set up `Lw`'s lanes (vladbondarenko97); - a copied value in a partial block escaped the stale check (MiguelMachado-dev). - from reviews of this PR: whole-wave branches and selects on a mask some lanes in EXEC lack, and rounding modes the per-lane form dropped (Kalmarv); such an SCC carried around a loop (thehollowedone); per-lane cache entries outliving source changes (Pipodi). - #1426 semantics that differ from the console (`v_cvt_f16_f32`, `v_mul_f16`, `v_pk_mul_f16` round toward zero) stay on the fallback (`DIFFERS_ON_1426`); itsSio is fixing them on `main`. **Tested** - NVIDIA GTX 1650 (wave32 only, so the split wave64 tests run for real), driver 621.24, Windows 11 Pro 26300, Rust 1.100.0, debug. - `cargo test --workspace -- --test-threads=4` on the head (`bfb8133`, on `main` `4178e88`): **955 passed, 0 failed, 42 ignored**. With `XCL_ADAPTER=warp` (the CI adapter, no sized waves) the lib gives 876 passed, 0 failed, 22 ignored: the per-lane GPU tests skip there. - SKIPPED (22): 18 "no wave64" (this GPU), 1 "no heap windows", and 3 per-lane halves refused on purpose (`V_CVT_F16_F32`, `V_MUL_F16`, `V_PK_MUL_F16`, see above). - Whole-pack sweep (release, on `d5fd85d`, before the rebase onto `main` and the last four commits): numbers as in the result paragraph; 577 s. **Regression run** `main`: ``` xcl-smoke v1 commit: 6c89285b8b529bde59cd17a26b911c39912fb677 gpu: NVIDIA GeForce GTX 1650 title: xcl-title seconds: 60 exit: 0x0 frames shown: 889 (PresentX 890) presents per 2 s (last 3): 2 0 12 device removals: 0 crashes: 0 peak commit: 15518 MB ``` This PR's head: ``` xcl-smoke v1 commit: bfb8133d36df38c3de381f9d99203568b32aa765 gpu: NVIDIA GeForce GTX 1650 title: xcl-title seconds: 60 exit: 0x0 frames shown: 915 (PresentX 916) presents per 2 s (last 3): 0 0 9 device removals: 0 crashes: 0 peak commit: 11638 MB ``` Both with `XCL_PER_LANE` off (the default), so they check that nothing changes. The machine was short of memory: runs of earlier head builds gave 508 to 931 frames, so the frame counts vary a lot run to run here. **Not tested** - Native wave64 GPUs (AMD) on my side; helpers ran parts of the branch on RX 7800 XT / RX 9070 XT and RTX 3060 Ti–5080 (#1269). - DXC and driver times of the per-lane form against #1426's (only DXIL sizes measured). - A title run with `XCL_PER_LANE=1`; the regression runs below are with it off, the default. - Mesh shaders in the per-lane form; VS / PS has only its lowering half (no adapter yet). **AI use** - Claude Code (Claude Opus 5.5): wrote my commits, the tests in them and this description, ran the checks. Helpers' commits carry their own AI-use notes on #1269. Two of MiguelMachado-dev's commits (guard coalescing and its split-form test) carry `Assisted-by: Antigravity (Gemini 4 Neon)`; the other helpers name their tools on #1269.
A backend that writes DXIL itself keeps the console CFG, so each lane can
branch on its own EXEC bit instead of every vector write being guarded and
branchy programs going through the `pc` dispatcher. This is the analysis it
needs: every lane mask is followed as a per-lane boolean function (a BDD
over the lanes' compare / carry results, uniform SCCs and unresolved
joins), mask branches are taken lane by lane, and a forward dataflow gives
what holds in each lane reaching a block. A vector instruction keeps its
guard only where reaching it does not imply the lane's EXEC bit.

Loop heads are guessed from their forward edges and checked against the
back edges; a wrong guess becomes an atom and only that head recomputes.
Results too large for a per-step node budget are weakened to atoms, which
only costs precision. Indirect jumps and irreducible loops are refused.

Nothing translates with it yet: `xcl shaders --recomp` prints its counts.
On the retail pack: 25 695 of 26 698 programs analysed (983 indirect
jumps, 20 irreducible), 10.65 M of 28.71 M vector instructions still
guarded (37.1 %), 9 015 programs with no guard at all, 700 CPU-s for the
whole pack (slowest program 1.5 s).
`dxil::assemble::assemble` turns a module written as LLVM IR text (or
bitcode) into a signed container: dxcompiler.dll's assembler builds the
container from the module's `dx.*` metadata, dxil.dll's validator checks and
signs it. No HLSL front end and no optimiser: a retail compute program's
module (8.6 MB of IR, 1 MB of DXIL) takes 0.75 s, its HLSL 25 s through DXC.

This is the text path under the module builder (`to_text()`), so the
lowering can run real programs on the GPU before the binary writer is done.

The test assembles a hand-written CS of the ABI root signature, runs it on
the GPU and checks its output, and checks that a use before its definition
is refused by the validator. A module needs an `!llvm.ident`: without one
it validates but the AMD driver faults in CreateComputePipelineState.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP5ub3Zjdi8PYaDNwsV
The direct backend's lowering, for kernel mode first. The console CFG is
kept and every register dword is an SSA value, built on the fly while the
blocks are lowered (`ssa.rs`). EXEC is each lane's own bit: mask branches
are per-lane branches and a vector write keeps `select(bit, new, old)` only
where the lane-mask analysis could not prove the bit set. An SGPR has a
number view and, when it holds a mask, a lane-bit view; a number read where
a mask was written (or the reverse across a join) is refused once every phi
is complete, and the program stays on the HLSL path. At the end, where every
lane is back, a mask stored as a number is the wave's ballot.

A mask written in a block some lanes skip (a loop lanes leave one by one,
an arm some lanes jump over) and read after they meet again differs from
the console, whose whole-wave write left the absent lanes' bits 0. Those
blocks are found from the post-dominators of the lane branches; such reads
are refused, and kernel mode's final store reports those registers.

The IR goes through an `Ir` trait, the part of the DXIL module builder the
lowering needs. The tests run it lane by lane on a CPU interpreter, and run
the same programs through the HLSL path on the GPU: every register agrees
(GTX 1650, wave32). The analysis now exports its CFG for the lowering.
`s_load_dword{,x2,x4,x8,x16}` and `global_` / `flat_` `load` / `store_dword
{,x2,x3,x4}` on the flat memory, with the addressing of the HLSL path's
single-window form. A guarded load runs in every lane and keeps the old
register where the lane's EXEC bit is clear (a raw buffer read out of range
is 0, so an inactive lane's address can't fault). A guarded store gets a
block of its own that only the lanes with their bit enter, and the rest of
the console block continues after it; the blocks are reserved before the
SSA form is built, so the predecessor lists stay exact.

The CPU interpreter in the tests gets the memory too, and the comparison
with the HLSL path on the GPU now also checks the memory after the run: a
program with an SMEM load, a per-lane load, a guarded store and an
unguarded one agrees word for word (GTX 1650, wave32).
The lowering takes a stage: kernel (the runner's ABI, as before) or a
compute program. In compute mode the user SGPRs come from `io`, then the
group ids and TG_SIZE the program enables, the thread ids go into v0–v2,
EXEC starts as every lane that runs, and the program ends without storing
registers (so kernel mode's report of stale masks does not apply).

One-dimensional groups only for now: in a 2-D / 3-D group the PC driver
need not give a wave consecutive threads, which the console does; the HLSL
path reorders them and those programs stay on it here.

A compute program with user SGPRs and the group id, over three groups of
64 threads, writes the same memory through the HLSL path on the GPU and
through the lowering on the CPU (GTX 1650, wave32).
`lower_dxil` implements the lowering's `Ir` trait on #1426's `Shader` /
`Module`: blocks, phis, integer ops, compares, `select`, the lane / thread
/ group ids, `waveActiveBallot`, and raw buffer access on the ABI's root
UAVs. A phi the SSA construction finds trivial keeps its identical incoming
values (the builder has no use replacement; the driver folds them).

Kernel and compute programs in their per-lane form now become signed DXIL
containers with no HLSL and no DXC, and run on the GPU: the lowering's test
programs agree with the CPU interpreter and with the HLSL path, registers
and memory (GTX 1650, wave32). The lowering's test programs are visible to
the crate's tests for this.
An SGPR number or SCC written in a block that lanes leave one by one (a
waterfall loop's key, a counter of the passes) and read after they meet
again is each lane's own value in the per-lane form, where the console has
the last pass's. Such reads are refused like the stale masks, so those
programs fall back; kernel mode's final store reports the registers.
Taking the last-leaving lane's value is left for later. Reported by Sr-0w
on #1269 while putting wave operations on top of the lowering.

Two fixes on the way: a VOP3 instruction's op_sel was never refused (the
field is `OP_SEL`, not `OPSEL`), and an SOP1 mask-width op counted s0 as a
second source because `SSRC1`, which SOP1 lacks, defaulted to 0. The
assemble test declares validator 1.6, the oldest that knows SM 6.6.
At the kernel exit, lower_kernel pushes only r to `stale` for a mask some
lanes kept their own older bits of. In wave64, r + 1 is stored from the
upper half of the same ballot, so it carries the stale bits too, but it
was not reported: VCC after a loop that lanes leave one by one gave
[106] instead of [106, 107].

Found by a wave64 version of the GPU comparison with the HLSL path (the
existing one runs only wave32 programs): on an RX 7800 XT (native
wave64), `leaving loop` differed in s107, 0xFFFFFFFF in the lowering
against 0x80000000 on the GPU, where only lane 63 was active in the
last v_cmp.

Tests: the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu (the
five programs with _B64 mask operations and lane thresholds past 32,
native wave64 form, skipped without wave64) and
a_wave64_mask_left_behind_is_reported_in_both_halves (CPU only). Both
fail without the fix.

Assisted-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lowering now takes v_readfirstlane, v_readlane, v_writelane, DPP16 and
DPP8 sources, v_permlane16 / v_permlanex16, ds_swizzle_b32, v_mbcnt and
s_bcnt0 / s_bcnt1 / s_ff1 of a mask, in wave32 and wave64 (lower/wave.rs).
`Ir` gains `read_lane` (WaveReadLaneAt) and `count_bits`.

A lane reads another through `read_lane`, which needs that lane to be at
the same instruction. Lanes are where the console has them, except those
that went the other way at a lane branch. So a read of a lane in EXEC is
always defined (readfirstlane, and DPP / permlane / swizzle without
fetch-inactive, whose source outside EXEC gives 0 or keeps the
destination). A read of any lane (readlane, writelane, fetch-inactive) is
refused in a block not every lane reaches, and the program stays on HLSL.
A mask read as a number is the ballot of its bits: exact for EXEC (a lane
elsewhere is outside it), and for any mask where every lane is here.

The CPU interpreter runs a wave operation over the lanes waiting at it
(the first such point in block order), instead of requiring every lane
there; a waterfall loop's readfirstlane needs this.

Tests: the operations on the CPU in wave32 and wave64 with expected
values; a waterfall loop; a readlane in that loop is refused; and both
programs agree with the HLSL path on the GPU, register by register, in
wave32 and wave64 (RX 7800 XT). Registers the waterfall loop writes and
the program reads after it (an SGPR, the saved EXEC) are left out of the
comparison: each lane keeps its own last pass's value there, which the
lowering does not refuse yet. A stale wave64 mask's second register is
treated as stale too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP5ub3Zjdi8PYaDNwsV
Sr-0w's cross-lane operations add Ir::read_lane and Ir::count_bits; on #1426's builder they are waveReadLaneAt and countbits.
`xcl shaders --recomp` now builds every compute program of the pack both
ways: in its per-lane form (`lower_dxil::compute_code`) and in #1426's
per-instruction form (`gpu::dxil::kernel::translate_compute`), and prints
how many each covers, the DXIL size where both do, and why the per-lane
form refused the rest.

The first pass: per-instruction 2 689 of 2 689, per-lane 4. The commonest
refusals were `v_nop` (now nothing), `s_setreg*` of MODE (now nothing: only
float instructions read it, and the lowering refuses every float
instruction so far), 2-D / 3-D groups, and the three-source integer ops,
now lowered (`v_lshl_add_u32`, `v_add_lshl_u32`, `v_lshl_or_b32`,
`v_and_or_b32`, `v_or3_b32`, `v_xor3_b32`, `v_add3_u32`).
`Ir` gains `ballot_half` and `read_lane_half`: a ballot of which only the
word of the lane's own 32-lane half is used, and a read of a lane in the
same half. A wave64 split into two 32-lane hardware waves can do these
without an exchange between the halves; `ballot` and `read_lane` keep
their names and stay whole-wave, so existing callers are right by default.

`lower/wave.rs` uses the half-local forms for DPP16 / DPP8, permlane(x)16
and ds_swizzle (their source lane and its EXEC bit are in the reader's
half), and for a mask operand of `v_mbcnt_hi` (lanes below 32 add 0). The
rest stays whole-wave: readfirstlane, readlane, writelane, `v_mbcnt_lo`,
a mask as a number, and the kernel exit's ballot of masks.

The DXIL adapter maps both forms to the same operations (one hardware
wave per console wave). The CPU interpreter gives lanes of the other half
a garbage word from `ballot_half` and asserts that `read_lane_half` stays
in the half, so a call that needs the whole wave but uses a half-local
form fails the tests: switching readfirstlane to the half-local ballot
fails two of them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP5ub3Zjdi8PYaDNwsV
The 1 134 compute programs refused for s_setreg_imm32_b32 write hwreg 20 (FLAT_SCR_LO, the scratch base), not MODE.
`Ir::thread_id(k)` becomes `Ir::compute_ids(threads) -> (flat, [x, y, z])`:
the thread's flat index in its group and that thread's id, numbered as the
console does (a wave takes consecutive threads, lane l the l-th). The
compute prologue takes the thread-id VGPRs and TG_SIZE's wave index from
it, and `lower_compute` no longer refuses 2-D / 3-D groups.

The CPU interpreter derives the ids from its wave's first thread plus the
lane. The DXIL adapter keeps 1-D groups only (SV_GroupThreadID.x) and
`lower_dxil::compute` refuses the others until `Lw::setup_lanes_compute`
(#1426) is reachable from `DxilIr`, which will number 2-D / 3-D threads by
arrival.

Tests: an 8x8x1 and a 4x4x4 group storing each thread's ids and lane, on
the CPU in wave32 and wave64, and against the HLSL path (which numbers by
arrival) on the GPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP5ub3Zjdi8PYaDNwsV
#1426 now has replace_all_uses (and writes blocks in reverse post-order). A phi the SSA construction finds trivial has its uses replaced instead of keeping identical incoming values.
A Windows SDK's bin\<ver>\x64 has dxcompiler.dll without dxil.dll, so ir_text_assembles_signs_and_runs failed with 'no dxil.dll to sign with' instead of skipping (reported by justrhoto on #1269). The coverage survey prints the both-forms DXIL size in KB while coverage is small.
The coverage survey (`xcl shaders --recomp`) gave only the first reason
the per-lane form refuses a program, and built compute programs only.
It now also lowers each CS and MS program in a survey mode that notes
every refusal and goes on past a refused instruction, and prints per
stage: the programs each form covers, the wave64 ones, those refused
only for instructions (no structural reason), every per-lane reason,
the only structural reason of a program, and why #1426's per-instruction
form refused (`translate_mesh` for the mesh pass).

A refused instruction leaves the SGPRs (and, for a scalar instruction,
SCC) it writes as 0 in both views, so that a later read does not report
a refusal that only follows from it: without that, a skipped
`s_cselect_b64 s[0:1], exec, 0` made every mesh program report a value
written while some lanes were elsewhere.

The mesh pass is surveyed as a compute program of its threads in a 1-D
group (the per-lane form has no mesh stage yet), so its exports and
`s_sendmsg` show as refused instructions. A 2-D / 3-D group is noted as
`compute` refuses it and the rest surveyed as a 1-D group.

`XCL_RECOMP_STAGES=CS,MS` keeps the survey to those stages and
`XCL_RECOMP_NO_HLSL=1` skips the HLSL translation: the direct DXIL
survey of a retail pack's 2 689 CS and 9 282 MS programs takes 57 s.
There, #1426's per-instruction form takes all of them; the per-lane
form takes 4 CS and no MS; every MS program is wave64 and the lane-mask
analysis takes all of them (no indirect jump, no irreducible loop).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An unsupported VOP1 (e.g. v_bfrev_b32) has no SRC1; reading its sources first took the absent field as s0 and reported 'sN: a mask read as a number' instead of the instruction (found by Kalmarv's every-reason survey on #1269).
Ir::whole_needs_exchange (default false): an Ir whose whole-wave ballot /
read_lane meets another hardware wave (the split form of a wave64
program, two wave32s) needs both halves to reach it. The lowering then
refuses a mask read as a number, EXEC included, in a block lanes leave
one by one (`partial`), as it already does for any read of a lane there.
The half-local reads (ballot_half) are unchanged. No Ir sets it yet, so
nothing changes for the lowerings on this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Six f32 programs (arithmetic with VOP3 modifiers, the 16 compares,
conversions, rounding, transcendentals, literal-operand and three-source
ops; NaN, ties, signed zeros, f16 denormals and out-of-range values among
their inputs) and `f32_programs_on_the_gpu`, which for each:
- runs it on the HLSL path on the GPU and checks every register against
  values computed in Rust (`check_f32_*`; wave32), the transcendentals
  within the tolerance of gpu::dxil's
  `approximate_float_unary_ops_are_within_tolerance`;
- where the per-lane form lowers the program, compares its DXIL on the GPU
  with the HLSL path, register for register (rcp within that tolerance:
  HLSL's `rcp` is a fast fdiv), wave32 and, where the GPU has 64-lane
  waves, wave64.

The per-lane form refuses f32 so far, so the second half prints
`SKIPPED … per-lane form: refused (…)` for every program; it runs once
f32 instructions are lowered. Test lines can now carry a literal dword.

Tested on an RTX 3080 Ti (wave32): the HLSL path passes every check; the
per-lane halves are SKIPPED (refused), the wave64 ones too (no 64-lane
waves). On top of `vladbondarenko97/xcl` `recomp/lowering-f32`, which
lowers these ops by hand, the per-lane halves run and agree with the HLSL
path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`translate_on_this_thread` built its `Lw` and finished the container inline.
Both move into `pub fn Lw::new(insts, leaders, o, &Entry)` (the shader and
its UAVs, the SSA's entry block, the LDS / exchange-slot scan, the constant
samplers, the split form's storage and partner) and `pub fn Lw::finish(self,
numthreads, hw)` (the exchange error, `try_finish` / `try_finish_graphics`,
validation), so the recompiler's per-lane lowering can build the same state
around its own block walk. `Entry`, `compute_init` and `mesh_init` become
public for the per-entry setup.

50th compute program of a retail pack, native wave64 and split (106
translations), hashes the same before and after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP5ub3Zjdi8PYaDNwsV
`DxilIr` builds its state with `Lw::new` (Entry::Kernel or Entry::Compute,
one memory window, no split) and finishes it with `Lw::finish` (which also
validates in tests and debug builds), so the per-entry setup and the
instruction lowering of #1426 are reachable from the per-lane lowering.

`compute_ids` is #1426's compute entry, `Lw::setup_lanes_compute`: 2-D /
3-D groups are numbered as their waves arrive (the counter in the
program's top LDS word when it has LDS), and `lane()` returns the lane it
set. `lower_dxil::compute` no longer refuses 2-D / 3-D groups.

Test: the 8x8x1 and 4x4x4 programs through the per-lane form on the GPU,
wave32 and native wave64, equal to the lowering run on the CPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XTYmP5ub3Zjdi8PYaDNwsV
An instruction the per-lane lowering has no semantics of goes through
`Ir::foreign`, which the DXIL adapter implements with #1426's
`Lw::inst_guarded`: its input registers are written into `Lw`'s SSA in the
current block first, the guard is the lane-mask analysis's (`true` where
EXEC is proven, or inside a guarded store's own block, else the lane's EXEC
bit), and the registers it wrote come back. SGPR operands are read as
numbers (a mask read whole is refused as everywhere), a mask read lane by
lane (v_cndmask_b32's selector, a carry-in) is passed as a number holding
only this lane's bit, and a mask a VALU writes comes back as this lane's
bit of its ballot. Instructions writing EXEC are not taken yet, nor a
barrier in a block some lanes skip, nor one that makes blocks of its own.

VOP3 modifiers and SDWA no longer refuse a program outright: those
instructions go through #1426's semantics too. V_CVT_F16_F32 is kept out:
#1426 gives 0 for a value below the smallest f16 denormal where the HLSL
path and the console round to it (found by vladbondarenko97's f32 tests;
reported on #1426).

vladbondarenko97's f32 programs in per-lane form now agree with the HLSL
path on the GPU register for register: arithmetic with abs/neg/clamp/omod,
rounding, transcendentals and the three-source ops (GTX 1650, wave32); the
compares (v_cmpx) and conversions stay refused.
With XCL_DIRECT_DXIL and XCL_PER_LANE=1, `pso::direct_compute` tries
the per-lane form first, #1426's per-instruction form where it refuses,
then the HLSL path. Per-lane entries of the translated-shader cache get
their own identity. Refusals are counted as "CS per-lane" fallbacks.

The adapter takes the runtime's KernelOptions (`compute_with`): with
several 4 GiB memory windows, the per-lane form's own memory lowering
(window 0 only) gives way and memory instructions go through #1426's
lowering, whose window switch makes blocks. `Ir` blocks therefore keep a
start (their phis) and a current end (their branch, incoming edges),
and an instruction lowered by #1426 may now make blocks of its own.

The bridge also refuses an instruction when #1426's lowering touches a
register that was neither passed in nor read back: `Lw` would silently
read that register's value at the program's start. The split wave64
form and heap memory windows are refused for now. Like #1426's
translator, the lowering runs on a thread with a 256 MiB stack, and a
panic there is a refusal.

Test: the compute program with four memory windows runs on the GPU and
matches the CPU lowering (GTX 1650).
The largest retail compute program (14.7 MB of per-instruction DXIL) was
refused for `s_setpc_b64`: its seven are all far jumps (`s_getpc_b64`,
a constant added, `s_setpc_b64`) that `resolve_far_jumps` resolves and
the lane-mask analysis already turns into an edge. A resolved
`s_setpc_b64` now ends its block like `s_branch`.

`s_getpc_b64` gives the address after it as the program's offset, as
#1426 does; `s_addc_u32` / `s_subb_u32` are lowered with SCC as the
carry / borrow, in and out. The test decoder resolves far jumps as the
real one does.
With `--lanes`, the direct sweep also lowers every compute program in
the per-lane form (`lower_dxil::compute_with`, the sweep's options), and
prints how many it translates, their DXIL size against the
per-instruction form's for the same programs, and its refusals ranked.
`--trace` lists each per-lane program's size.
The first whole-pack sweep of the per-lane form (250 of 2 689 compute
programs) was refused mostly for `s_wqm_b32` (754), `s_cselect_b32` /
`_b64` (605) and float `v_cmpx_*` (about 400), and 44 programs hit a
builder error.

- `s_cselect` picks numbers by SCC, or, where a source holds a mask
  (`s_cselect_b64 s, exec, 0`), the lane's bit by its SCC.
- `s_wqm` of a mask: a lane's bit is set when any lane of its quad has
  its bit (the quad is in the lane's own half of the ballot).
- `v_cmpx_*` without a lowering of its own goes through #1426's: EXEC
  goes in as a number with only this lane's bit and comes back as the
  lane's bit of the result.
- `Lw` writes to its entry block (`Block(0)`) until the end (static
  samplers, the scratch array): the adapter's first block is a new one,
  and `Block(0)` jumps to it at `finish`, as #1426's translator ends it.
  Before, an instruction #1426 lowered could append after Block(0)'s
  branch ("instruction after a terminator").

Tests: `s_wqm` and `s_cselect` on the CPU lowering; scratch through
#1426's lowering gives a container and runs on the GPU (fails before
the entry fix); vladbondarenko97's f32 compares (with v_cmpx) now run
per lane and match the HLSL path on the GPU.
A wave64 program on 32-lane hardware as two wave32 halves, with #1426's
lane machinery instead of a copy: KernelOptions::split, so Lw::new lays
out the halves' exchange storage and picks the meet (a group barrier
for one console wave per group, the spin meet with arrival counters for
more); lanes numbered as the hardware waves arrive (setup_lanes for a
kernel, setup_lanes_compute for a compute program, both in the entry
block: the lowering takes lane() before compute_ids, and in the split
form the console lane is not the hardware lane). The whole-wave ballot
and lane read meet the other half (Lw::ballot, Lw::read_lane_uniform);
the half-local ones stay in the half; Ir::whole_needs_exchange keeps
them out of blocks lanes leave one by one.

Branches go through Lw::br / Lw::cond_br so Lw's own variables (the
exchange count, the dead flag) get their edges, and the lowering's
blocks are sealed for them before Lw::finish.

lower_dxil::kernel_split / compute_split. The GPU test runs the
lowering's wave64 programs in this form against the CPU interpreter's
wave64 run, and a 128-thread group (two console waves, the spin meet).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The analysis takes EXEC at the entry as every lane. That holds in kernel
mode (lanes outside EXEC leave at once) and in compute, but not in a PS,
whose helper lanes start outside EXEC and run the program too: a vector
write before EXEC is written would lose the guard that keeps a helper lane
from writing.

`analyze_launch` takes the launch EXEC as `LaunchExec::All` (what `analyze`
still does) or `LaunchExec::Unknown`, an atom: then a vector instruction
keeps its guard until EXEC is written, and a lane branch still proves
EXEC where it does. Agreed for VS / PS in #1269.

Tested on an RTX 4090 (Windows 10 22H2, DXC 1.8.2502):
cargo test -p xcl --lib -- recomp::lower recomp::lane_masks gpu::dxil
--test-threads=4: 115 passed, 0 failed, 1 ignored (the base: 113
passed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Nearly every PS starts with `s_wqm exec, exec`. The analysis did not follow
s_wqm, so with the launch EXEC unknown, EXEC after it was an unknown mask
too and every vector instruction of the program kept its guard.

Every lane that runs a PS is either in the launch EXEC or a helper lane of
a quad with a lane in it, so whole-quad mode of the launch EXEC is every
lane. s_wqm of none or every lane is followed as well; of any other mask
it is still an unknown mask.

Tested on an RTX 4090 (Windows 10 22H2, DXC 1.8.2502):
cargo test -p xcl --lib -- recomp::lower recomp::lane_masks gpu::dxil
--test-threads=4: 116 passed, 0 failed, 1 ignored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`lower_graphics` lowers a vertex or pixel shader in the per-lane form, as
agreed in #1269:

- `Ir::graphics_start` / `Ir::graphics_end`: one opaque method each for a
  stage's start and end, which the DXIL adapter will map onto #1426's
  `setup_vertex` / `setup_pixel` and `finish_gfx`. An IR without them
  refuses the program. The CPU interpreter takes the stage's VGPRs and
  launch EXEC from `io`, as in kernel mode.
- Every lane runs the program: a PS's helper lanes start with their EXEC
  bit clear instead of taking the kernel's way out, and the lane-mask
  analysis takes the launch EXEC as unknown, so their vector writes and
  stores keep their guards.
- `s_wqm` is followed where the analysis finds it gives every lane
  (`Summary::wqm_all`), and refused otherwise.
- In a PS, instructions that need whole quads (implicit-LOD samples and
  gathers, `image_get_lod`, `s_wqm`) are refused in a block not every lane
  reaches.
- A wave64 VS / PS in 32-lane waves is refused where `upper_lanes` finds a
  read of lanes 32-63 that holds anything.

Exports and `v_interp_*` come through `inst_guarded`; until then the
stages lower integer programs only, and the tests observe memory stores.

Tested on an RTX 4090 (Windows 10 22H2, DXC 1.8.2502):
- cargo test -p xcl --lib -- recomp::lower recomp::lane_masks gpu::dxil
  --test-threads=4: 119 passed, 0 failed, 1 ignored;
- cargo test --workspace --no-fail-fast -- --test-threads=4: lib 855
  passed, 0 failed, 22 ignored; every other test binary passed;
- with the launch EXEC taken as every lane,
  a_ps_helper_lane_runs_the_program_but_does_not_store fails (the
  helper lanes store).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`6ca6b90` lowers `s_wqm` of any mask through the ballot of its bits, and
teidenzero's VS / PS commits allow it only of the launch EXEC (whose
quads' helper lanes the analysis knows). Both now hold: in a VS / PS and
where the analysis found `s_wqm` of the launch EXEC, `salu`'s rule;
elsewhere (compute) the ballot.
On an RX 9070 XT, `f32_programs_on_the_gpu` failed at lane 16 v10:
`floor(-(+0)) * 2` is -0 on the console and in the per-lane DXIL, but
the HLSL reference gave +0: DXC's `fast` flags include no-signed-zeros
and the AMD driver folds by them. The reference is now compiled with
`-Gis`, and `check_f32_rounding` compares v10 bit for bit, so the -0 is
asserted rather than hidden by `-0.0 == 0.0`.

Diagnosis and fix by Diskuss (#1269); the HLSL path itself still gives
+0 there on that driver.
One program in the shape of the f32 ones (`f64_programs_on_the_gpu`) on
x = 1 + lane / 32 + lane * 2^-52: x + 2^-53 (ties to even), x * 2^-1040
(a denormal in and out), x * f64::MAX (infinity from lane 1),
fma(x, x, -x * x) (the product's rounding error: nonzero only when
fused), NaN into min / max, VOP3 abs / neg / omod / clamp, floor / ceil /
trunc / rndne / fract / frexp_mant / frexp_exp of (lane - 16) / 4 (ties,
-0 at lane 15), f64 <-> f32 / i32 / u32 (a tie, overflow, saturation,
NaN) and rcp / rsq / sqrt (within 1e-12). The HLSL path's registers are
checked against values computed in Rust (`check_f64`), and the per-lane
DXIL is compared with the HLSL path register for register, as for f32.
The GPU loop of `f32_programs_on_the_gpu` is now `programs_on_the_gpu`.

Not in it: v_trig_preop_f64 and v_div_*_f64, which the HLSL path does not
translate, and a non-default MODE.FP_ROUND for f64, which it refuses.

On 3511bb9 (RTX 3080 Ti, wave32) the HLSL path passes every check, and
the per-lane form takes the program and agrees with it register for
register. The wave64 half is SKIPPED (no 64-lane waves).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two programs in the shape of the f32 ones (`integer_programs_on_the_gpu`)
on a = lane * 0x9E3779B9, b = lane - (a >> 13) and c = 0x7FFFFFF0 + lane:
- VOP3-only and VOP2 integer ops: mul_hi u32 / i32, the 24-bit multiplies
  and mads, bfe u32 / i32 with offset + width past 32 and width 0, bfi,
  bfm, alignbit / alignbyte, xad, sad_u8 / sad_hi_u8 / sad_u16 / sad_u32 /
  msad_u8, min3 / max3 / med3 u32 / i32, clamped (saturating) add3 / add /
  sub u32 and add / sub i32, bcnt, ffbh / ffbl / ffbh_i32 of 0 and -1,
  bfrev, not, xnor, cvt_pk_u16_u32 / cvt_pk_i16_i32 (saturating), and
  mad_u32_u16 / mad_i32_i16 with OP_SEL halves;
- carries: VOP3 carry-outs into s20..s30 and carry-ins from them, a VOP2
  chain through VCC, a VOP3 cndmask on s22, v_mad_u64_u32 /
  v_mad_i64_i32 with their carry-outs, and the 64-bit shifts (by 65 at
  lane 31).
The HLSL path's registers and carry masks are checked against values
computed in Rust (`check_int_*`; v_mad_i64_i32's carry-out is left to
the per-lane comparison), and the per-lane DXIL is compared with the
HLSL path register for register, as for f32. The GPU loop of
`f32_programs_on_the_gpu` is now `programs_on_the_gpu`.

On 3511bb9 (RTX 3080 Ti, wave32) the HLSL path passes every check; the
per-lane form takes the arithmetic and agrees with the HLSL path, and
refuses the carries (`V_ADD_CO_CI_U32`: "it reads register 21 the
per-lane form did not pass": #1426 reads a carry-in as the SGPR pair,
the bridge passes only its low SGPR in wave32), so that half is
SKIPPED. On 56102c5, before that check, the carries ran and every
carry-in read 0 per lane (v11, v13, v17, v18 one less, lanes 1-31): the
kernel form never sets up #1426's lanes (`DxilIr::new` with
`Entry::Kernel` calls no `Lw::setup_lanes*`), so `Lw::lane31` stays 0
and `Lw::lane_of` takes every lane's carry-in from bit 0. That is still
so on 3511bb9, so this half fails again once the pair is passed unless
the kernel form sets up the lanes. The wave64 halves are SKIPPED (no
64-lane waves).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vladbondarenko97's integer programs found that in the kernel form every
carry-in read 0: `DxilIr` never called `Lw::setup_lanes` for a kernel
outside the split form, so `Lw::lane31` stayed the constant 0 and #1426's
lowering read bit 0 of the mask for every lane. The kernel entry now sets
up its lanes. #1426 also reads the mask as an SGPR pair in wave32, so the
bridge passes the upper SGPR (0) with this lane's bit in the lower; the
"register not passed" check had refused those instructions until now.

The integer carry program now runs per lane and agrees with the HLSL
path on the GPU (GTX 1650, wave32).
vladbondarenko97's f16 programs show #1426's v_mul_f16 / v_pk_mul_f16
rounding toward zero (LegacyF32ToF16): x * 65504 gives 0x7BFF where the
console and the HLSL path give 0x7C00, and denormal ties round down. They
join V_CVT_F16_F32 on DIFFERS_ON_1426 until itsSio's fix on main lands.
Two programs in the shape of the f32 ones (`f16_programs_on_the_gpu`):
- f16 VOP1 / VOP2 / VOP3: ties to even, denormal results and their
  ties, overflow to infinity, a fused fma just below a tie (lane 1:
  double rounding through f32 lands on the tie), NaN into min / max /
  med3, OP_SEL source and destination halves, omod and clamp, ldexp into
  denormals, rndne (-0 at lane 15), f16 <-> i16 / u16;
- VOP3P packed math: OP_SEL / OP_SEL_HI swapped and broadcast halves,
  NEG / NEG_HI, f16 clamp, saturating u16 / i16 (clamp), wrapping
  sub / mul_lo / mad, and v_cvt_pkrtz_f16_f32 (65504 for the out-of-range
  values).
The HLSL path's registers are checked against values computed in Rust
(`check_f16_*`, `f16_bits` rounding to nearest even), and the per-lane
DXIL is compared with the HLSL path register for register, as for f32.
The GPU loop of `f32_programs_on_the_gpu` is now `programs_on_the_gpu`.

Left out of the Rust checks: the f16 results the HLSL path rounds with
`f32tof16` (v_add/sub/fma/fmac/ldexp/cvt_f16_u16, v_pk_add/fma). Their
rounding is the driver's: on NVIDIA it rounds toward zero, where the
console rounds to nearest even (MODE.FP_ROUND = 0), e.g. 0x3C01 + 2^-11
gives 0x3C01 for 0x3C02. The per-lane comparison still covers them.

On 3511bb9 (RTX 3080 Ti, wave32) the HLSL path passes every check and
the per-lane form takes both programs, but it gives v_mul_f16 and
v_pk_mul_f16 rounded toward zero (#1426 writes them through
LegacyF32ToF16, the HLSL path through `f32_to_f16_rm`): x * 65504 is
0x7BFF for infinity (lanes 1-31) and the denormal ties of x * 2^-15 go
down (lanes 3, 7, ..., 31), so the per-lane half fails there. The wave64
halves are SKIPPED (no 64-lane waves).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Coalesce maximal straight-line runs of guarded vector instructions under
an unchanged EXEC mask (absorbing pure no-ops like s_waitcnt) into a
single per-lane EXEC branch lowered unguarded, merging updated registers
with SSA phis at the continuation block. Runs are emitted when they
contain a side-effecting instruction (stores, atomics, non-read DS, EXP)
or at least two guarded instructions; standalone guarded VALU/loads keep
a select. Runs stop at scalar/mask/SCC writes (including V_CMPX and
VOP3_SDST_ENC), cross-lane ops, and implicit-derivative image ops.

Track block def/use ownership in stale() so splitting a partial console
block into multiple runs keeps earlier definitions in the same console
block non-stale while keeping definitions inside a run block partial.

Assisted-by: Antigravity (Gemini 4 Neon)
Reviewed-by: Claude Code (Claude Opus 5.5, xhigh)
`stale()` keys each scalar value by the block that made it. A write in
a block some lanes skip of a value made elsewhere (an older mask copied
with `s_mov s4, s0`, a constant the builder shares) kept the older
block, so a read after the lanes meet was not refused although the
console's write reached every lane and each lane here kept its own.
Such a write now gets a copy of its own (`or v, 0`) defined in the
partial block.

Found by MiguelMachado-dev while writing guard coalescing.
`mask_reg` built its upper-dword answer with `then_some((r - 1, true))`,
which evaluates `r - 1` even when the condition is false, so a
cross-lane scalar op on s0 overflowed in debug builds
(`xcl shaders --recomp` panicked). It is lazy now (`then`).

Found and fixed by nobodyttk (#1269).
A few large programs kept the sweep running for over an hour (the
adapter's trivial-phi replacement walks the whole module each time).
They now count as "timeout: over N s" refusals, as the direct form's do.
`compute_with` passed `WaveSize(64)` to `Lw::finish` for a wave64 program
in the split form, so on a GPU with 32-lane waves only (the runtime's
split path) `CreateComputePipelineState` refused it (0x80070057 on a
GTX 1650): no split program reached the GPU through the runtime. The
split form now asks for 32-lane waves, as `compute_split` does. Test:
the 2-D / 3-D id programs in the split form through `compute_with`,
against the CPU lowering's wave64 run.

Also: `can_coalesce` uses `whole_quad` instead of its own copy of it.

Both found by MiguelMachado-dev, reading the code.
Each D3D vertex invocation is one lane, so no lane of a VS is outside
EXEC at launch (gefydev's answer in #1269). The lane-mask analysis now
takes a VS's launch EXEC as every lane (`LaunchExec::All`, as for
compute), and the lowering sets each lane's EXEC bit at the program's
first block, so a VS that never writes EXEC keeps no guard. Only a PS
takes the launch EXEC as unknown.

Tested on an RTX 4090 (Windows 10 22H2, DXC 1.8.2502):
- cargo test -p xcl --lib -- recomp::lower recomp::lane_masks gpu::dxil
  --test-threads=4: 133 passed, 0 failed, 1 ignored;
- cargo test --workspace --no-fail-fast -- --test-threads=4: lib 869
  passed, 0 failed, 22 ignored; every other test binary passed;
- with the VS's launch EXEC taken as unknown again,
  a_ps_helper_lane_runs_the_program_but_does_not_store fails (the VS's
  store keeps its guard).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DxilIr's Sink::replace called Module::replace_all_uses for every trivial
phi the SSA construction drops, and each call walks every instruction and
metadata entry of the module, so the per-lane lowering took time
(trivial phis) x (module size), about quadratic in the program's size.
A CPU profile (WPR) of one 80 KB retail compute program put
replace_all_uses and the heap at the top: survey_compute_code took 18.5 s
of the program's 19.3 s, and the CS + MS per-lane survey
(XCL_RECOMP_STAGES=CS,MS XCL_RECOMP_NO_HLSL=1) did not finish in 10
minutes on a 12-thread i5-11600. The runtime's per-lane form
(XCL_PER_LANE=1) goes through the same adapter.

replace now records old -> new, and DxilIr::finish makes all of them in
one pass (Module::replace_uses, which follows a chain a -> b -> c as the
calls one at a time in order did) before #1426's Lw seals its blocks.
Nothing reads an instruction's operands back before then: the SSA
construction resolves a replaced phi through its own forward map, and
Lw's SSA only compares the values it holds. replace_all_uses stays and
goes through replace_uses.

Test: a batched map with a chain gives the same container as
replace_all_uses one at a time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1693 put memory windows through the descriptor heap in #1426's lowering
(XCL_HEAP_WINDOWS), so compute_with no longer refuses them: with several
windows the per-lane form's memory instructions go through Lw, which
now reads the window from the heap.
Extend coalesced_foreign_runs_agree_on_the_gpu to also run coalesced_run(true)
through compute_with with wave64=true, split=true and 4 memory windows
(cut = 40, spanning both wave32 halves) so wave64 coalesced runs are checked
on 32-lane hardware too.

Assisted-by: Antigravity (Gemini 4 Neon)
On CI the adapter is WARP, which has neither 32- nor 64-lane waves, and
every per-lane GPU test failed there in CreateComputePipelineState
(0x80070057) instead of skipping. They now require a GPU that runs
`[WaveSize(32)]` programs, as `recomp::tests::gpu_ready` does, and skip
with "no GPU with 32-lane waves" otherwise. With XCL_ADAPTER=warp the
lib runs 876 passed, 0 failed, 22 ignored.
Two correctness gaps on programs the per-lane form took, found by
Kalmarv's review of #1745 with GPU programs against the HLSL path:

- A branch on whether any lane of a mask is set (`s_cbranch_vccz` /
  `vccnz`, `s_cbranch_scc*` after a mask op or `s_cmp_lg` of a mask) and
  a scalar read of such an SCC (`s_cselect`, `s_cmov`, `s_addc`,
  `s_subb`) decide for the whole wave on the console. The analysis took
  each lane's own bit, which differs in the lanes in EXEC that lack the
  bit (VCC = lanes 0-15, EXEC = all 32: 7 where the console gives 0). They
  are now taken only where the condition is the same in every lane that
  reaches with its EXEC bit (`s_and_saveexec` then `s_cbranch_execz`, or
  VCC equal to EXEC), and refused otherwise. The analysis test that
  stated the old assumption (a vccz branch is a lane branch) now states
  the rule.
- `s_setreg` of MODE was a no-op, so a non-default rounding mode was
  dropped where #1426 and the HLSL path refuse the program. MODE writes
  now go to #1426's lowering, and the adapter sets `dyn_rm` /
  `has_f64_round_op` as #1426's translator does, so `s_round_mode` and
  `s_setreg` refuse what they cannot honour. Denormal-only writes are
  still taken.

Tests: Kalmarv's five branch / select programs are refused, and a
uniform one is taken; f32 by `s_setreg` and f64 by `s_round_mode` /
`s_setreg` are refused (the f32 one was taken before the fix), and a
denormal-only write is taken.
thehollowedone's program on #1745: `s_and_b32 s0, vcc, exec` sets SCC
in a loop's body and the next iteration's `s_cselect_b32` reads it. The
loop head's join counted only the edges whose masks it uses, and back
edges do not count there, so the SCC came out a uniform value and the
per-lane form selected by each lane's bit: 7 where the console gives 5
in lanes 16-31. The mask-op flag now comes from every incoming edge,
back edges included, and an unknown SCC that is a lane's on some edge is
an unknown lane condition, so the whole-wave rule refuses it.

Test: his program is refused (it was taken before the fix).
Pipodi's review of #1745: the translated-cache identity of `XCL_PER_LANE`
entries did not include the per-lane form's sources, so a cached
container outlived a change to the lowering. build.rs hashes them into
XCL_PER_LANE_SOURCE_ID, which only the per-lane entries' identity
includes (the HLSL path's entries keep theirs).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:03:29 +00:00
github manually merged commit bfb8133d36 into gh-pr/1745/base 2026-11-26 05:03:31 +00:00
Author
Owner

@⁠Raghav314 on GitHub · 2026-11-24 20:26 UTC · original

DXC and cold driver times for the per-lane form against #1426 and the HLSL path, NVIDIA Windows (as asked on #1269, comment). Counts and timings only.

Setup: RTX 4090 24 GB, driver 617.14, Windows 11, DXC 1.8.2502.11, release. direct-on-1426 3ca3633 + @⁠Itsmetibo's 4c3fe1e (now 1c9477a here), retail 1.0.2.1 pack, split wave64, 4 windows, as the runtime does on a 32-lane GPU. Each pipeline made one at a time, no concurrency, no XCL cache, the driver's shader cache off for the process (ID3D12Device9::ShaderCacheControl(IMPLICIT_DRIVER_MANAGED, DISABLE)). Two full runs agree within 1 %.

Programs: the per-lane form takes 311 of 2 689 compute programs in the split form. 310 built in all four forms, 0 failures (first row dropped as driver warm-up). Median 212 B of console code, largest 2.6 KB.

form DXIL DXC driver total
per-lane 3 168 KB – 10.0 s 10.5 s
#1426 per-instruction 3 187 KB – 10.5 s 10.9 s
HLSL, 4 windows 3 881 KB 21.9 s 14.1 s 36.1 s
HLSL, heap windows 3 455 KB 17.2 s 10.8 s 28.0 s
  • Per-lane vs #1426: driver time per program, median ratio 0.98 (p10 0.85, p90 1.10); −5 % in total. No real gain on the programs it covers.
  • Both direct forms vs the HLSL path: 3.4× less total time, mostly DXC (61 % of the HLSL path's time here); the driver is also ~27 % faster on the direct DXIL.
  • Not covered: the large programs, which the per-lane form refuses.

Harness: Raghav314/xcl shaders/time-forms, one commit c17ed53 on this PR's head cf29f8a (shaders.rs +155, pso.rs +6): xcl shaders <pack> --time-forms [--split 1] [--windows 4] [--timeout 120] [--limit N] [--warm] [--out file.csv]. One CSV row per program, record index only. Needs Windows developer mode for the cache switch; --warm skips it. Re-checked on c17ed53: builds, and --limit 3 gives cold times (9–41 ms) against 0.5–2 ms with --warm.

AI use: Claude Code (Claude Opus 5.5) wrote the harness, ran the measurements and drafted this.

**@⁠Raghav314** on GitHub · 2026-11-24 20:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143552555) **DXC and cold driver times for the per-lane form against #1426 and the HLSL path, NVIDIA Windows** (as asked on #1269, [comment](https://git.gtahub.st/github/xcl-dev--xcl/issues/1269)). Counts and timings only. **Setup:** RTX 4090 24 GB, driver 617.14, Windows 11, DXC 1.8.2502.11, release. `direct-on-1426` `3ca3633` + @⁠Itsmetibo's `4c3fe1e` (now `1c9477a` here), retail 1.0.2.1 pack, split wave64, 4 windows, as the runtime does on a 32-lane GPU. Each pipeline made one at a time, no concurrency, no XCL cache, the driver's shader cache off for the process (`ID3D12Device9::ShaderCacheControl(IMPLICIT_DRIVER_MANAGED, DISABLE)`). Two full runs agree within 1 %. **Programs:** the per-lane form takes 311 of 2 689 compute programs in the split form. 310 built in all four forms, 0 failures (first row dropped as driver warm-up). Median 212 B of console code, largest 2.6 KB. | form | DXIL | DXC | driver | total | |---|---|---|---|---| | per-lane | 3 168 KB | – | 10.0 s | 10.5 s | | #1426 per-instruction | 3 187 KB | – | 10.5 s | 10.9 s | | HLSL, 4 windows | 3 881 KB | 21.9 s | 14.1 s | 36.1 s | | HLSL, heap windows | 3 455 KB | 17.2 s | 10.8 s | 28.0 s | - **Per-lane vs #1426:** driver time per program, median ratio 0.98 (p10 0.85, p90 1.10); −5 % in total. No real gain on the programs it covers. - **Both direct forms vs the HLSL path:** 3.4× less total time, mostly DXC (61 % of the HLSL path's time here); the driver is also ~27 % faster on the direct DXIL. - **Not covered:** the large programs, which the per-lane form refuses. **Harness:** [`Raghav314/xcl` `shaders/time-forms`](https://github.com/Raghav314/xcl/tree/shaders/time-forms), one commit `c17ed53` on this PR's head `cf29f8a` (`shaders.rs` +155, `pso.rs` +6): `xcl shaders <pack> --time-forms [--split 1] [--windows 4] [--timeout 120] [--limit N] [--warm] [--out file.csv]`. One CSV row per program, record index only. Needs Windows developer mode for the cache switch; `--warm` skips it. Re-checked on `c17ed53`: builds, and `--limit 3` gives cold times (9–41 ms) against 0.5–2 ms with `--warm`. AI use: Claude Code (Claude Opus 5.5) wrote the harness, ran the measurements and drafted this.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 20:28 UTC · original

@⁠gefydev: the stale-value work is ready as a follow-up on this PR's head, not for #1745 itself. It is four commits on 43cb32c in Kalmarv/xcl per-lane-stale (head f5bfab2e):

  • 01715c81 the per-lane survey drops VCC after a refused compare: note_inst missed VOPC / VOP2 writes of VCC, which have no field, so a refused v_cmp_*_f32 left an older VCC that later showed up as a stale value.
  • 909d33b5 a write every reading lane passed is not a stale value: your rule from #1269. W dominates R, and every loop that contains W also contains R. Summary exports the dominators and the loop bodies. Same-block reads stay with def_owner / use_owner.
  • 595dd348 a join takes the scalar value an arm some lanes skipped wrote (case A, numbers and SCC). At a join every lane reaches, with a single stale write: a ballot of a per-region "ran it" flag, then a read from the first lane that ran it. Each lane keeps its own value when no lane ran it. A write in a loop that lanes leave one by one is still refused. Only registers a later read can see are repaired, because Module::optimize keeps wave ops. A value written in two such blocks is refused by its own name.
  • f5bfab2e a join takes a compare an arm some lanes skipped made (case A, VOPC masks): ran && bit. A mask a scalar instruction wrote is refused by its own name.

Recount: xcl shaders <pack> --direct --lanes --sample 0 --max-bytes 0 --split 0 --windows 4, the first refusal of each of 2689 compute programs, no timeouts in any run:

tree per-lane ok first refusal: stale value
43cb32c 321 265
+ 01715c81, 909d33b5 435 151
+ 595dd348, f5bfab2e 435 140 generic, 11 "written in more than one block"

The stale rule takes 114 more programs (321 to 435). Case A takes none in this sweep; it only renames 11 of the 151. Whatever the remaining stale values hit, it is not the single-write join that case A repairs. I'm classifying the 140 next (loops that lanes leave one by one, reads inside a region, or joins it skips) to decide what comes next. In a 60 s game run on 43cb32c, the stale value was the top fallback reason too: 17 of 73.

Tested on an RTX 5070 Ti (wave32 only) under Windows 11, release builds:

  • the recomp CPU tests (lower, lane_masks, lower_dxil), run by exact name: 43 passed at f5bfab2e, 42 at 595dd348. The new tests fail with the join repair switched off.
  • the 14 GPU tests of the same modules, run through the GPU queue at f5bfab2e: 14 passed, 0 failed. They compare against the HLSL path, as DXIL, and in the split form. Five report SKIPPED ... no wave64 (one of them only in part), and six skip only the validation step (DXC 1.7 < 1.8), so the split-form runs still happen.

The quadratic replace_all_uses is Itsmetibo's 4c3fe1e (1c9477a here); we dropped our own fix for it.

Not tested: the whole workspace suite, AMD, native wave64, a game run with these commits.

AI use: Claude Code (Claude Opus 5.5) wrote the commits, ran the tests and the recount, and wrote this note.

**@⁠Kalmarv** on GitHub · 2026-11-24 20:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143611170) @⁠gefydev: the stale-value work is ready as a follow-up on this PR's head, not for #1745 itself. It is four commits on 43cb32c in [Kalmarv/xcl `per-lane-stale`](https://github.com/Kalmarv/xcl/tree/per-lane-stale) (head f5bfab2e): - 01715c81 **the per-lane survey drops VCC after a refused compare**: `note_inst` missed VOPC / VOP2 writes of VCC, which have no field, so a refused `v_cmp_*_f32` left an older VCC that later showed up as a stale value. - 909d33b5 **a write every reading lane passed is not a stale value**: your rule from #1269. W dominates R, and every loop that contains W also contains R. `Summary` exports the dominators and the loop bodies. Same-block reads stay with `def_owner` / `use_owner`. - 595dd348 **a join takes the scalar value an arm some lanes skipped wrote** (case A, numbers and SCC). At a join every lane reaches, with a single stale write: a ballot of a per-region "ran it" flag, then a read from the first lane that ran it. Each lane keeps its own value when no lane ran it. A write in a loop that lanes leave one by one is still refused. Only registers a later read can see are repaired, because `Module::optimize` keeps wave ops. A value written in two such blocks is refused by its own name. - f5bfab2e **a join takes a compare an arm some lanes skipped made** (case A, VOPC masks): `ran && bit`. A mask a scalar instruction wrote is refused by its own name. **Recount**: `xcl shaders <pack> --direct --lanes --sample 0 --max-bytes 0 --split 0 --windows 4`, the first refusal of each of 2689 compute programs, no timeouts in any run: | tree | per-lane ok | first refusal: stale value | |---|---|---| | 43cb32c | 321 | 265 | | + 01715c81, 909d33b5 | 435 | 151 | | + 595dd348, f5bfab2e | 435 | 140 generic, 11 "written in more than one block" | The stale rule takes 114 more programs (321 to 435). Case A takes none in this sweep; it only renames 11 of the 151. Whatever the remaining stale values hit, it is not the single-write join that case A repairs. I'm classifying the 140 next (loops that lanes leave one by one, reads inside a region, or joins it skips) to decide what comes next. In a 60 s game run on 43cb32c, the stale value was the top fallback reason too: 17 of 73. **Tested** on an RTX 5070 Ti (wave32 only) under Windows 11, release builds: - the recomp CPU tests (`lower`, `lane_masks`, `lower_dxil`), run by exact name: 43 passed at f5bfab2e, 42 at 595dd348. The new tests fail with the join repair switched off. - the 14 GPU tests of the same modules, run through the GPU queue at f5bfab2e: 14 passed, 0 failed. They compare against the HLSL path, as DXIL, and in the split form. Five report `SKIPPED ... no wave64` (one of them only in part), and six skip only the validation step (DXC 1.7 < 1.8), so the split-form runs still happen. The quadratic `replace_all_uses` is Itsmetibo's 4c3fe1e (1c9477a here); we dropped our own fix for it. Not tested: the whole workspace suite, AMD, native wave64, a game run with these commits. **AI use:** Claude Code (Claude Opus 5.5) wrote the commits, ran the tests and the recount, and wrote this note.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 20:30 UTC · original

A fact about the follow-up, not a change to this PR. @⁠Kalmarv has the stale-value work ready as a follow-up on top of this PR's head: four commits on 43cb32c, branch Kalmarv/xcl per-lane-stale (head f5bfab2e). In his recount (xcl shaders <pack> --direct --lanes --sample 0 --max-bytes 0 --split 0 --windows 4, the first refusal of each of the 2 689 compute programs), the dominance rule for stale values (a write that dominates its read, with every loop containing the write also containing the read) takes the per-lane form from 321 to 435 programs; the repair of a value written in a region some lanes skip (case A) takes none more in that sweep. It is not part of #1745 and would go on top of it, or as a stacked PR, as the maintainer prefers. Thank you, Kalmarv.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 20:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143640007) A fact about the follow-up, not a change to this PR. @⁠Kalmarv has the stale-value work ready as a follow-up on top of this PR's head: four commits on `43cb32c`, branch `Kalmarv/xcl` `per-lane-stale` (head `f5bfab2e`). In his recount (`xcl shaders <pack> --direct --lanes --sample 0 --max-bytes 0 --split 0 --windows 4`, the first refusal of each of the 2 689 compute programs), the dominance rule for stale values (a write that dominates its read, with every loop containing the write also containing the read) takes the per-lane form from **321 to 435** programs; the repair of a value written in a region some lanes skip (case A) takes none more in that sweep. It is not part of #1745 and would go on top of it, or as a stacked PR, as the maintainer prefers. Thank you, Kalmarv. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠FIJI1299 on GitHub · 2026-11-24 20:31 UTC · original

Test report on NVIDIA GeForce RTX 5070 (12 GB)

  • PR / Commit: #1745 (43cb32c)
  • Hardware: AMD Ryzen 5 9600X, NVIDIA GeForce RTX 5070 (12 GB VRAM, driver 621.35), 32 GB DDR5 6000MT/s
  • Environment: Windows 11 (build 26300), rustc 1.100.0 (0ef1bc386 2026-11-09), Windows SDK 10.0.26100.0 (debug build)
  • Command: .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4)
  • Results:
    • xcl --lib: 876 passed; 0 failed; 22 ignored (14.29s)
    • Integration tests: 8 passed; 0 failed; 12 ignored (1 + 1 + 6)
    • Total workspace: 884 passed; 0 failed; 34 ignored
  • GPU tests skipped on this adapter:
    • 7 (no wave64)
    • 1 (no heap windows)
    • 1 (f32 rounding, wave64: no wave64)
    • 1 (integer arithmetic, wave64: no wave64)
    • 1 (f64, wave64: no wave64)
    • 1 (integer carries, wave64: no wave64)
    • 1 (f32 three-source, wave64: no wave64)
    • 1 (f32 transcendentals, wave64: no wave64)
    • 1 (f32 conversions, wave64: no wave64)
    • 1 (f16 arithmetic, wave64: no wave64)
    • 1 (f16 packed, wave64: no wave64)
    • 1 (f32 compares, wave64: no wave64)
    • 1 (f32 arithmetic, wave64: no wave64)
    • 1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)))
    • 1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)))
    • 1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)))
  • Not tested: Retail title (smoke.ps1), release build, AMD / native wave64 GPUs.
  • AI use: Google Gemini assisted with running the commands and drafting this report from my real local test run.
**@⁠FIJI1299** on GitHub · 2026-11-24 20:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143673334) **Test report on NVIDIA GeForce RTX 5070 (12 GB)** * **PR / Commit:** #1745 (`43cb32c`) * **Hardware:** AMD Ryzen 5 9600X, NVIDIA GeForce RTX 5070 (12 GB VRAM, driver `621.35`), 32 GB DDR5 6000MT/s * **Environment:** Windows 11 (build `26300`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, Windows SDK `10.0.26100.0` (debug build) * **Command:** `.\scripts\test.ps1` (`cargo test --workspace -- --test-threads=4`) * **Results:** * `xcl --lib`: `876 passed; 0 failed; 22 ignored` (14.29s) * Integration tests: `8 passed; 0 failed; 12 ignored` (1 + 1 + 6) * Total workspace: `884 passed; 0 failed; 34 ignored` * **GPU tests skipped on this adapter:** * `7 (no wave64)` * `1 (no heap windows)` * `1 (f32 rounding, wave64: no wave64)` * `1 (integer arithmetic, wave64: no wave64)` * `1 (f64, wave64: no wave64)` * `1 (integer carries, wave64: no wave64)` * `1 (f32 three-source, wave64: no wave64)` * `1 (f32 transcendentals, wave64: no wave64)` * `1 (f32 conversions, wave64: no wave64)` * `1 (f16 arithmetic, wave64: no wave64)` * `1 (f16 packed, wave64: no wave64)` * `1 (f32 compares, wave64: no wave64)` * `1 (f32 arithmetic, wave64: no wave64)` * `1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)))` * `1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)))` * `1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)))` * **Not tested:** Retail title (`smoke.ps1`), release build, AMD / native wave64 GPUs. * **AI use:** Google Gemini assisted with running the commands and drafting this report from my real local test run.
Author
Owner

@⁠HKEY-Funk-Machine on GitHub · 2026-11-24 20:31 UTC · original

@⁠gefydev native wave64 and title results on AMD RDNA4 for 43cb32c: the suite passes, including every wave64 half. In the title, the per-lane form took 90 of 300 compute programs with no failures, but they are all small, and there is no size or driver-time gain on them. That's the same as your pack numbers, now measured in the AMD driver.

Tested

  • AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32015.7029, Ryzen 9 7945HX3D, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0, DXC 1.9.2602.17, release.
  • Clean 43cb32c: cargo test --release --workspace --no-fail-fast -- --test-threads=4: 925 passed, 0 failed, 42 ignored. gpu::dxil + recomp::lower: 125 passed, 0 failed, 1 ignored. No no wave64 skips: f32_programs_on_the_gpu (wave32 and wave64), the_split_form_agrees_with_the_wave64_lowering_on_the_gpu and the_runtime_path_takes_the_split_form ran and passed. SKIPPED: f16_programs_on_the_gpu ×4 (V_MUL_F16 / V_PK_MUL_F16 refused), f32_programs_on_the_gpu ×2 (V_CVT_F16_F32 refused), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Current head cf29f8a (test-only on top): gpu::dxil + recomp::lower again 125 passed, 0 failed, 1 ignored, the same 6 SKIPPED. The new 32-lane skip doesn't trigger on this card. The title runs below are on 43cb32c; cf29f8a changes only tests.

Title A/B (retail title; 43cb32c + #751, plus two local-only changes: skip InitializeApiImplEx2 in xgameruntime/api.rs, which hangs here, and a log line before and after each compute CreateComputePipelineState):

  • A: XCL_DIRECT_DXIL=1. B: XCL_DIRECT_DXIL=1 XCL_PER_LANE=1. Both with XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0 XCL_NETWORK=0, and each run's xcl.exe copied under a new name, so the AMD driver's cache was cold for both. A pressed on the title screen.
  • I stopped both runs about 5 minutes in, once cs 56c0cd3b82a00c6e (ActivateProbes, 15 042 740 B of per-instruction DXIL, refused by the per-lane form) had been in the driver for over a minute with process memory past 90 GB. In earlier runs on this card it ran out of memory at ~105 GB (#1426).
  • Programs were matched by console hash: a program whose DXIL differs between A and B went per-lane in B.
compute builds, A / B / built in both 300 / 302 / 300, 0 failed
per-lane in B 90 of 300 (the other 210: same DXIL as A)
DXIL of those 90 1.294 MB → 1.299 MB (+0.4 %)
driver time of those 90 6.4 s → 6.7 s (+4.7 %). Of the 38 that took ≥ 50 ms in A, 19 were faster in B
control: the 210 with the same DXIL, cold in both 598.8 s → 529.3 s (−11.6 %). So run-to-run driver noise is about ±10 %, and the +4.7 % is within it
largest per-lane program 130 544 B, 1.14 s in A → 129 532 B, 1.32 s in B
device removal, 0x8007000E, crash none in either run (both stopped by me)

Top per-lane refusals in B (count of programs): "a value written while some lanes were elsewhere, read after they met again" 55, IMAGE_LOAD (reads a register the per-lane form did not pass) 31, IMAGE_SAMPLE_LZ 19, "a mask read as a number where some lanes are elsewhere" 12, IMAGE_STORE 11, DS_ADD_U32 10, BUFFER_ATOMIC_ADD 8, IMAGE_LOAD_MIP 6.

So on this card the per-lane form is correct on what it takes, and neutral on cost. The programs the world load waits on (ActivateProbes and the other ~1 MB+ programs) all stay on the per-instruction form, mostly for the stale-value refusal and the image / LDS register plumbing.

Not tested

  • The title past ActivateProbes (it runs out of memory on the direct path here), more than one run per form, heap windows (XCL_HEAP_WINDOWS=1), split wave64 in the title, and output correctness beyond "no failure" (no frame comparison).

AI use: Claude Code (Claude Opus 5.5) ran the tests and the two runs, matched the programs with a script and wrote this comment.

**@⁠HKEY-Funk-Machine** on GitHub · 2026-11-24 20:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143685782) @⁠gefydev native wave64 and title results on AMD RDNA4 for `43cb32c`: **the suite passes, including every wave64 half. In the title, the per-lane form took 90 of 300 compute programs with no failures, but they are all small, and there is no size or driver-time gain on them.** That's the same as your pack numbers, now measured in the AMD driver. **Tested** - AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32015.7029, Ryzen 9 7945HX3D, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0, DXC 1.9.2602.17, release. - Clean `43cb32c`: `cargo test --release --workspace --no-fail-fast -- --test-threads=4`: **925 passed, 0 failed, 42 ignored**. `gpu::dxil` + `recomp::lower`: 125 passed, 0 failed, 1 ignored. No `no wave64` skips: `f32_programs_on_the_gpu` (wave32 and wave64), `the_split_form_agrees_with_the_wave64_lowering_on_the_gpu` and `the_runtime_path_takes_the_split_form` ran and passed. SKIPPED: `f16_programs_on_the_gpu` ×4 (`V_MUL_F16` / `V_PK_MUL_F16` refused), `f32_programs_on_the_gpu` ×2 (`V_CVT_F16_F32` refused), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - Current head `cf29f8a` (test-only on top): `gpu::dxil` + `recomp::lower` again 125 passed, 0 failed, 1 ignored, the same 6 SKIPPED. The new 32-lane skip doesn't trigger on this card. The title runs below are on `43cb32c`; `cf29f8a` changes only tests. **Title A/B** (retail title; `43cb32c` + #751, plus two local-only changes: skip `InitializeApiImplEx2` in `xgameruntime/api.rs`, which hangs here, and a log line before and after each compute `CreateComputePipelineState`): - A: `XCL_DIRECT_DXIL=1`. B: `XCL_DIRECT_DXIL=1 XCL_PER_LANE=1`. Both with `XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0 XCL_NETWORK=0`, and each run's `xcl.exe` copied under a new name, so the AMD driver's cache was cold for both. A pressed on the title screen. - I stopped both runs about 5 minutes in, once `cs 56c0cd3b82a00c6e` (`ActivateProbes`, 15 042 740 B of per-instruction DXIL, refused by the per-lane form) had been in the driver for over a minute with process memory past 90 GB. In earlier runs on this card it ran out of memory at ~105 GB (https://git.gtahub.st/github/xcl-dev--xcl/pulls/1426). - Programs were matched by console hash: a program whose DXIL differs between A and B went per-lane in B. | | | |---|---| | compute builds, A / B / built in both | 300 / 302 / 300, **0 failed** | | per-lane in B | **90** of 300 (the other 210: same DXIL as A) | | DXIL of those 90 | 1.294 MB → 1.299 MB (**+0.4 %**) | | driver time of those 90 | 6.4 s → 6.7 s (**+4.7 %**). Of the 38 that took ≥ 50 ms in A, 19 were faster in B | | control: the 210 with the same DXIL, cold in both | 598.8 s → 529.3 s (−11.6 %). So run-to-run driver noise is about ±10 %, and the +4.7 % is within it | | largest per-lane program | 130 544 B, 1.14 s in A → 129 532 B, 1.32 s in B | | device removal, `0x8007000E`, crash | none in either run (both stopped by me) | Top per-lane refusals in B (count of programs): "a value written while some lanes were elsewhere, read after they met again" 55, `IMAGE_LOAD` (reads a register the per-lane form did not pass) 31, `IMAGE_SAMPLE_LZ` 19, "a mask read as a number where some lanes are elsewhere" 12, `IMAGE_STORE` 11, `DS_ADD_U32` 10, `BUFFER_ATOMIC_ADD` 8, `IMAGE_LOAD_MIP` 6. So on this card the per-lane form is correct on what it takes, and neutral on cost. The programs the world load waits on (`ActivateProbes` and the other ~1 MB+ programs) all stay on the per-instruction form, mostly for the stale-value refusal and the image / LDS register plumbing. **Not tested** - The title past `ActivateProbes` (it runs out of memory on the direct path here), more than one run per form, heap windows (`XCL_HEAP_WINDOWS=1`), split wave64 in the title, and output correctness beyond "no failure" (no frame comparison). AI use: Claude Code (Claude Opus 5.5) ran the tests and the two runs, matched the programs with a script and wrote this comment.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 20:32 UTC · original

Thank you both for the test reports on this PR.

  • @⁠alexmircea1299: 43cb32c on an RTX 5070 gives 876 passed, 0 failed in the lib, with the wave64 halves and the three per-lane refusals reported as SKIPPED. That is a clean second NVIDIA card.
  • @⁠HKEY-Funk-Machine: the native wave64 run on the RX 9070 (925 passed, 0 failed, no no wave64 skips) and the title A/B are the first AMD driver-side measurement of the per-lane form. On the 90 of 300 programs the per-lane form takes, it is correct and neutral on cost (DXIL +0.4 %, driver time +4.7 %, within the noise you measured), and the programs the world load waits on stay on #1426's form. That agrees with the numbers in the description.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 20:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143708576) Thank you both for the test reports on this PR. - @⁠alexmircea1299: `43cb32c` on an RTX 5070 gives 876 passed, 0 failed in the lib, with the wave64 halves and the three per-lane refusals reported as SKIPPED. That is a clean second NVIDIA card. - @⁠HKEY-Funk-Machine: the native wave64 run on the RX 9070 (925 passed, 0 failed, no `no wave64` skips) and the title A/B are the first AMD driver-side measurement of the per-lane form. On the 90 of 300 programs the per-lane form takes, it is correct and neutral on cost (DXIL +0.4 %, driver time +4.7 %, within the noise you measured), and the programs the world load waits on stay on #1426's form. That agrees with the numbers in the description. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠teidenzero on GitHub · 2026-11-24 20:34 UTC · original

Test report for cf29f8a on Windows 10 (where SM 6.6 comes from the Agility SDK), NVIDIA RTX 4090.

Tested

  • NVIDIA GeForce RTX 4090 24 GB (Ada, 32-lane waves, so the split wave64 tests run for real), driver 621.24 (32.0.16.2124); AMD Ryzen 7 3700X; Windows 10 Pro 22H2 build 19045.6466 with the D3D12 Agility SDK 1.620.2 (the inbox runtime stops at SM 6.5); Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug; DXC 1.8.2502.11 from the Windows SDK 10.0.26100.0, without dxil.dll.
  • .\scripts\test.ps1 at cf29f8a: 925 passed, 0 failed, 42 ignored over the workspace (lib: 876 passed, 0 failed, 22 ignored), the same totals as the GTX 1650 run in the description.
  • SKIPPED (23): 18 "no wave64" (this GPU), 1 "no heap windows", 1 "no dxil.dll" (the IR-assembly test; the SDK's DXC ships without it), and the 3 per-lane halves refused on purpose (V_CVT_F16_F32, V_MUL_F16, V_PK_MUL_F16).

Not tested

  • Native wave64 (no AMD GPU here), a release build, a title (none here, so no smoke run, with XCL_PER_LANE off or on).

The VS / PS adapter half, which the description lists as missing: 43d5851 from #1269 applies onto cf29f8a (one trivial conflict: the new replaced field next to its graphics field) as teidenzero/xcl vsps-dxil-on-1745 13dd18b. There the workspace gives 926 passed, 0 failed, 42 ignored on this machine, the one more being its draw test, which passes. It waits for the maintainer's call on this PR, as you said.

AI use: Claude Code (Claude Opus 5.5) ran the tests, rebased the commit and drafted this report.

**@⁠teidenzero** on GitHub · 2026-11-24 20:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143743022) Test report for `cf29f8a` on Windows 10 (where SM 6.6 comes from the Agility SDK), NVIDIA RTX 4090. **Tested** - NVIDIA GeForce RTX 4090 24 GB (Ada, 32-lane waves, so the split wave64 tests run for real), driver 621.24 (32.0.16.2124); AMD Ryzen 7 3700X; Windows 10 Pro 22H2 build 19045.6466 with the D3D12 Agility SDK 1.620.2 (the inbox runtime stops at SM 6.5); Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug; DXC 1.8.2502.11 from the Windows SDK 10.0.26100.0, without `dxil.dll`. - `.\scripts\test.ps1` at `cf29f8a`: **925 passed, 0 failed, 42 ignored** over the workspace (lib: 876 passed, 0 failed, 22 ignored), the same totals as the GTX 1650 run in the description. - SKIPPED (23): 18 "no wave64" (this GPU), 1 "no heap windows", 1 "no dxil.dll" (the IR-assembly test; the SDK's DXC ships without it), and the 3 per-lane halves refused on purpose (`V_CVT_F16_F32`, `V_MUL_F16`, `V_PK_MUL_F16`). **Not tested** - Native wave64 (no AMD GPU here), a release build, a title (none here, so no smoke run, with `XCL_PER_LANE` off or on). **The VS / PS adapter half**, which the description lists as missing: `43d5851` from #1269 applies onto `cf29f8a` (one trivial conflict: the new `replaced` field next to its `graphics` field) as [`teidenzero/xcl` `vsps-dxil-on-1745`](https://github.com/teidenzero/xcl/tree/vsps-dxil-on-1745) `13dd18b`. There the workspace gives 926 passed, 0 failed, 42 ignored on this machine, the one more being its draw test, which passes. It waits for the maintainer's call on this PR, as you said. AI use: Claude Code (Claude Opus 5.5) ran the tests, rebased the commit and drafted this report.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 20:34 UTC · original

@⁠teidenzero thank you: the report on cf29f8a (925 passed, 0 failed, 42 ignored on an RTX 4090 under Windows 10 with the Agility SDK, with the split wave64 tests running for real) is the same total as the description's. Your VS / PS adapter half rebased on the head (teidenzero/xcl vsps-dxil-on-1745, 13dd18b, 926 passed) is noted: it waits for the maintainer's call on this PR, as you say.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 20:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143760315) @⁠teidenzero thank you: the report on `cf29f8a` (925 passed, 0 failed, 42 ignored on an RTX 4090 under Windows 10 with the Agility SDK, with the split wave64 tests running for real) is the same total as the description's. Your VS / PS adapter half rebased on the head (`teidenzero/xcl` `vsps-dxil-on-1745`, `13dd18b`, 926 passed) is noted: it waits for the maintainer's call on this PR, as you say. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-24 20:38 UTC · original

Test report for #1745 on native wave64 (AMD RDNA3). The second part is with #1742 merged in, to check that the DIFFERS_ON_1426 f16 entries can go.

Tested

  • AMD Radeon RX 7800 XT, driver 32.0.31035.1003 (wave32 and native wave64); Ryzen 7 5700X3D; Windows 11 Pro 26200; Rust 1.100.0 MSVC; debug; each tree in its own target dir.
  • #1745 head 43cb32c, as is: cargo test --workspace -- --test-threads=4 --nocapture gives 925 passed, 0 failed, 42 ignored. 7 tests SKIPPED: the 6 per-lane refusals V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (f16_programs_on_the_gpu f16 arithmetic and f16 packed, f32_programs_on_the_gpu f32 conversions, each in wave32 and wave64), plus heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows). Everything else in recomp::lower / lower_dxil / lane_masks passes in native wave64.
  • 43cb32c merged with #1742 35355a2 (no conflicts), and DIFFERS_ON_1426 emptied (local edit in recomp/lower.rs, not pushed):
    • cargo test -p xcl --lib recomp::lower -- --test-threads=1: 44 passed, 0 failed, 0 ignored, no SKIPPED. f16_programs_on_the_gpu (f16 arithmetic, f16 packed) and f32_programs_on_the_gpu (f32 conversions) now run per lane in wave32 and native wave64, and agree with the HLSL path.
    • cargo test --workspace -- --test-threads=4 --nocapture: 938 passed, 0 failed, 42 ignored. The extra tests come from main 85e3826, which #1742 is based on. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows) and pso_measurement_compiles_an_exact_synthetic_record (Developer Mode off).

Not tested

  • No title run of #1745 (XCL_PER_LANE) here. No release build. Nothing on NVIDIA or Intel.

AI use: Claude Code (Claude Opus 5.5) ran these tests on @⁠oni-swr's machine and wrote this report.

**@⁠oni-swr** on GitHub · 2026-11-24 20:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143857989) Test report for #1745 on native wave64 (AMD RDNA3). The second part is with #1742 merged in, to check that the `DIFFERS_ON_1426` f16 entries can go. **Tested** - AMD Radeon RX 7800 XT, driver 32.0.31035.1003 (wave32 and native wave64); Ryzen 7 5700X3D; Windows 11 Pro 26200; Rust 1.100.0 MSVC; debug; each tree in its own target dir. - **#1745 head `43cb32c`, as is:** `cargo test --workspace -- --test-threads=4 --nocapture` gives 925 passed, 0 failed, 42 ignored. 7 tests SKIPPED: the 6 per-lane refusals `V_MUL_F16` / `V_PK_MUL_F16` / `V_CVT_F16_F32` (`f16_programs_on_the_gpu` f16 arithmetic and f16 packed, `f32_programs_on_the_gpu` f32 conversions, each in wave32 and wave64), plus `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). Everything else in `recomp::lower` / `lower_dxil` / `lane_masks` passes in native wave64. - **`43cb32c` merged with #1742 `35355a2` (no conflicts), and `DIFFERS_ON_1426` emptied** (local edit in `recomp/lower.rs`, not pushed): - `cargo test -p xcl --lib recomp::lower -- --test-threads=1`: 44 passed, 0 failed, 0 ignored, no SKIPPED. `f16_programs_on_the_gpu` (f16 arithmetic, f16 packed) and `f32_programs_on_the_gpu` (f32 conversions) now run per lane in wave32 and native wave64, and agree with the HLSL path. - `cargo test --workspace -- --test-threads=4 --nocapture`: 938 passed, 0 failed, 42 ignored. The extra tests come from `main` `85e3826`, which #1742 is based on. SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) and `pso_measurement_compiles_an_exact_synthetic_record` (Developer Mode off). **Not tested** - No title run of #1745 (`XCL_PER_LANE`) here. No release build. Nothing on NVIDIA or Intel. AI use: Claude Code (Claude Opus 5.5) ran these tests on @⁠oni-swr's machine and wrote this report.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 20:40 UTC · original

  • @⁠Kalmarv thank you for the review and the small programs behind it: points 1 (a branch or select on "any lane" of a mask taken lane by lane), 2 (a non-default rounding mode dropped where #1426 and the HLSL path refuse the program) and 3 (the summary label "HLSL fallback" for the per-lane refusals) are received and being looked at, and I will answer each of them on this PR. Please keep your three local tests (the split-form programs, the branch programs, the rounding programs) ready; I will say whether they go in as a patch or a follow-up.
  • @⁠oni-swr thank you: 43cb32c merged with #1742 and DIFFERS_ON_1426 emptied, with recomp::lower at 44 passed and no SKIPPED, and the workspace at 938 passed, 0 failed, is the evidence that the three f16 entries can go. The removal waits for #1742 to land in main.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 20:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143902243) - @⁠Kalmarv thank you for the review and the small programs behind it: points 1 (a branch or select on "any lane" of a mask taken lane by lane), 2 (a non-default rounding mode dropped where #1426 and the HLSL path refuse the program) and 3 (the summary label "HLSL fallback" for the per-lane refusals) are received and being looked at, and I will answer each of them on this PR. Please keep your three local tests (the split-form programs, the branch programs, the rounding programs) ready; I will say whether they go in as a patch or a follow-up. - @⁠oni-swr thank you: `43cb32c` merged with #1742 and `DIFFERS_ON_1426` emptied, with `recomp::lower` at 44 passed and no SKIPPED, and the workspace at 938 passed, 0 failed, is the evidence that the three f16 entries can go. The removal waits for #1742 to land in `main`. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠Pipodi on GitHub · 2026-11-24 20:53 UTC · original

Review of #1745 at 0570037: static, nothing built or run. I read the diff against main 6c89285 in three parts: the lane-mask analysis and SSA, the lowering, and the DXIL adapter and runtime wiring. Nothing below was run: each correctness point comes with the program that would show it, compared with the HLSL path (EXEC emulated). They all need XCL_DIRECT_DXIL=1 XCL_PER_LANE=1, except where I say otherwise. 0570037 answers @⁠Kalmarv's points 1 and 2, and I leave out his point 3. Line numbers are at 0570037.

Correctness of the per-lane form

  1. Whole-wave mask decisions: fixed in 0570037. I read the commit:
    • uniform_over refuses a lane branch, or an s_cselect / s_cmov / s_addc / s_subb of a mask op's SCC, unless the condition is the same in every lane in EXEC. That is the rule I would have suggested.
    • The old test now asserts it.
    • The check runs only where the analysis marks the branch or the SCC as a lane mask's (lane), so point 2's case still gets through it.
  2. The analysis and the lowering disagree on which branches are per-lane.
    • The analysis follows a mask op only when both sources are known masks (lane_masks.rs:528-549); otherwise SCC is an Atom::Scc with lane = false (lane_masks.rs:574-578).
    • The lowering treats an op as a mask op when any source holds a mask (reads_mask, lower.rs:545 and lower.rs:566), and writes SCC per lane; cond then branches on it lane by lane (lower.rs:963).
    • Example: v_cmp … vcc; s_and_b64 s[4:5], vcc, s[8:9] (s8:9 is user data), then s_cbranch_scc0 J; s_mov_b32 s6, 1; J: v_mov_b32 v3, s6.
      • The lowering branches per lane, but the analysis has lane = false, so neither 0570037's uniform_over check nor partial_blocks (lower.rs:1063) sees the branch.
      • So the stale-value, cross-lane and s_barrier refusals don't run, and the lanes that skipped read their old s6.
  3. A bridged v_cmpx_* can turn on lanes that had EXEC off.
    • lower.rs:1647 passes guard = true for every cmpx. #1426's write_mask builds act() & cond, and act() returns that guard (dxil/lower.rs:773, dxil/lower.rs:849-851).
    • So at a guarded pc, the new EXEC is cond, not cond & EXEC. The native integer path is right (lower.rs:791-794).
    • Example: v_cmp_gt_u32 vcc, 16, v0; s_and_saveexec_b32 s0, vcc (no execz), then v_cmpx_le_f32 0, v1; v_mov_b32 v2, 7; s_or_b32 exec, exec, s0. Lanes 16 and up get v2 = 7.
  4. The stale-value rule misses three cases. @⁠Kalmarv's per-lane-stale follow-up reworks this rule; from its description, same-block reads "stay with def_owner / use_owner", so the loop case below would still be taken there. I haven't read that branch.
    • Loops. The rule compares static blocks (def_owner[b] != use_owner[c], lower.rs:1004), so a scalar written and read in the same partial block on different loop iterations is accepted.
      • Example: s1 = 0; s3 = 0; L: v_cmp_eq_u32 vcc, s3, v0; s_and_saveexec s2, vcc; s_cbranch_execz J; s_add_u32 s1, s1, 1; v_mov v1, s1; J: s_or exec, exec, s2; s_add s3, s3, 1; s_cmp_lt_u32 s3, 4; s_cbranch_scc1 L.
      • On the console, lane k gets v1 = k + 1. In the per-lane form every lane gets 1.
    • A phi copied in a partial block. own (lower.rs:370-380) copies only values already in def_block, and a phi never is one. stale follows the phi's operands, not the phi.
      • Example: a uniform if/else sets s5 to 1 or 2, then s_and_saveexec; s_cbranch_execz J; s_mov_b32 s6, s5; J: s_or exec; v_mov v1, s6.
      • The copy case in a_mask_left_behind_by_lanes_that_skipped_its_write copies an older mask from before the split, so it doesn't cover this.
    • s_bcnt0/1 of a mask. It writes SCC through ssa.write (wave.rs:464), not write_scc/own, so stale never sees it. Example: s_bcnt1_i32_b64 s2, exec in an execz arm, then s_cbranch_scc0 after the join.
  5. A bridged mask write in the split wave64 form can sit behind a barrier that only one half reaches.
    • The bridge (lower.rs:1648) has no all_lanes-style check for instructions that #1426 lowers with an exchange between the halves.
    • Every f32/f16/f64 v_cmp* and v_add_co_* whose mask is read as a whole goes through write_mask → ballot → exchange_n → meet(), a group barrier (dxil/lanes.rs:221-256).
    • In a branch only one half takes (33–64 threads, Partner::Present), the other hardware wave never reaches that barrier: a hang, or barriers paired with the wrong partner.
    • The per-lane form's own ballots refuse this (wave.rs:53, wave.rs:122).
    • I followed the path, but the hang itself needs a run on a wave32 GPU.
  6. Lanes outside the launch EXEC (kernel ABI).
    • lower.rs:1259-1270 and lower.rs:1502-1512 send those lanes straight to the exit, and lane 0 stores every SGPR.
    • With a launch EXEC of 0xFFFFFFFE, s_mov_b32 s0, 5 leaves res[0] at its input value.
    • The skip block also sets every mask bit to 0 (lower.rs:1268), where s_not or s_orn2 of a v_cmp mask leaves those lanes at 1 on the console.
    • lanes_outside_exec_at_launch_keep_their_registers keeps lane 0 active.
  7. Not traced to the end: s_or_saveexec_b64 s, -1 and s_mov_b64 exec, -1 (whole-wave mode) inside a block some lanes don't reach give EXEC = TRUE (lane_masks.rs:464-467, lane_masks.rs:519-526). On the console that turns on the lanes that branched away, and here they are elsewhere. What's left after the cross-lane refusals is a write in that region read by those lanes after the join. I haven't checked whether real code does that.

Runtime and caching

  1. xcl shaders --recomp changes with no flag.
    • RecompAgg::add (shaders.rs:445-503) now runs lower_dxil::compute_code, survey_compute_code, a second translate_compute/translate_mesh and lane_masks::analyze_code on every program, without --lanes.
    • So the existing sweep is slower and prints new lines.
    • These calls run on the sweep's worker threads, without compute_with's 256 MB stack and panic catch. A panic in the new code would hit h.join().unwrap() (shaders.rs:767) and end the sweep.
  2. The per-lane cache identity has no version.
    • lower.rs, lower/wave.rs, lower_dxil.rs, lane_masks.rs and ssa.rs are not in TRANSLATOR_SOURCES (build.rs).
    • TRANSLATOR_VERSION covers gpu/dxil only, and the per-lane identity is identity_for(id, "xcl-per-lane") (pso.rs:245).
    • So a later fix to the lowering keeps serving the old cached containers to XCL_PER_LANE=1 users, unless someone bumps a version by hand.

Tests

  1. Refusals become skips. programs_on_the_gpu (lower_dxil.rs:600-606) turns any Err from the per-lane form into skip_test, not only the programs in DIFFERS_ON_1426. A change that makes the form refuse the f32/f64/int/f16 programs still passes. An allow-list of the expected refusals would keep the assertion.
  2. Not covered:
  • Every lane_masks test is wave64. Nothing tests:
    • the wave32 _B32 paths;
    • *_WREXEC, v_cmpx, VOP3 sdst = EXEC, or separate exec_lo/exec_hi writes;
    • nested loops or the step_bounded/cond_bounded fallbacks.
  • d94736a, 5f78f44 and 1b257c2 add no test.
  • The CPU Interp has no foreign, so bridged instructions are only covered by GPU runs.

CONTRIBUTING

  1. The size waiver. The description says the size rule is waived "at the maintainer's request (#1269)". The only maintainer text I found is the issue body ("We are open for big PRs aiming to optimize shaders … compiling shaders directly into DXIL"); please link or quote that, so a reviewer can see what the 7,467 lines rest on.
  2. Commits.
    • cf29f8a says every per-lane GPU test failed on WARP (the CI adapter) before it, so the commits before it don't each pass CI.
    • Several commits fix earlier ones in the PR: bcb502f fixes 8cb697d, 1c9477a reworks d1f0661, 51f3b82 drops 8cb697d's heap refusal, and c7caa1d fixes this PR's DxilIr.
    • The description says 45 commits; the branch has 49.
  3. AI use. 43cb32c and 8e0c4a7 carry Assisted-by: Antigravity (Gemini 4 Neon), which the AI use section doesn't name.
  4. Not tested. Both smoke runs are with XCL_PER_LANE off and, from the description, without XCL_DIRECT_DXIL, so they don't exercise the kernel.rs refactor (Lw::new/Lw::finish) under XCL_DIRECT_DXIL=1. Reading it, I think it emits the same DXIL. A byte diff of xcl shaders --direct --dump on 6c89285 and on cf29f8a would show it, and Not tested could say it wasn't run.
  5. XCL_PER_LANE, XCL_RECOMP_STAGES and XCL_RECOMP_NO_HLSL aren't documented anywhere, as with XCL_DIRECT_DXIL today.

Nits

  • pso.rs:238: let id = identity_with(.
  • ssa.rs:150-158 doesn't move users[phi] to users[same], so a trivial phi can be left behind. The results are unaffected: a leftover phi over the marker is still refused.
  • wave.rs:298-300: v_readfirstlane where no lane has EXEC reads lane 0.
  • recomp/dxil/assemble.rs is called only from its own test. It finds dxil.dll through GetModuleHandleW, so it works only once DXC has loaded it.

Checked and fine

  • The lane-mask analysis:
    • the BDD (variable order, memoisation, partial results);
    • the saveexec/wrexec semantics, including the ANDN1/ANDN2 operand order;
    • VOPC/VOP3 sdst writes, and separate exec_lo/exec_hi writes turning EXEC opaque;
    • irreducible-flow detection, which is complete;
    • loop atoms not leaking between iterations;
    • the fallbacks weakening soundly.
  • SSA: the sealing order, and the one-pass trivial-phi replacement in 1c9477a, which can't form a cycle.
  • The lowering:
    • DPP16/DPP8, v_permlane(x)16, ds_swizzle quad-perm and bitmask modes (rotate mode not checked);
    • mbcnt, readlane, writelane and their split checks;
    • the v_cndmask/carry-in lane bit (c7caa1d);
    • coalesced runs, which can't span an EXEC or guard change; stores and atomics under partial EXEC run only in the lanes that have it;
    • far jumps.
  • The bridge's register check refuses every unpassed read of VCC, M0, EXEC and SCC.
  • The kernel.rs refactor: by reading, the module calls run in the same order, so the DXIL should be the same.
  • The fallback: a per-lane error, including a caught panic, goes to #1426's form.
  • GPU tests skip with runner::skip_test; no #[ignore], no game data, no new dependency, no ported code.

AI use: Claude Code. Three Claude Opus 5.5 subagents reviewed the three parts. Claude Opus 5.5 (the main session) then read the code path of every numbered point itself, at cf29f8a and again at 0570037, and wrote this review; the Checked and fine list is from the subagents' reading. Points 5 and 7 are not traced to the end, as they say.

**@⁠Pipodi** on GitHub · 2026-11-24 20:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144195923) **Review of #1745 at `0570037`: static, nothing built or run.** I read the diff against `main` `6c89285` in three parts: the lane-mask analysis and SSA, the lowering, and the DXIL adapter and runtime wiring. Nothing below was run: each correctness point comes with the program that would show it, compared with the HLSL path (EXEC emulated). They all need `XCL_DIRECT_DXIL=1 XCL_PER_LANE=1`, except where I say otherwise. `0570037` answers @⁠Kalmarv's points 1 and 2, and I leave out his point 3. Line numbers are at `0570037`. **Correctness of the per-lane form** 1. **Whole-wave mask decisions: fixed in `0570037`.** I read the commit: - `uniform_over` refuses a lane branch, or an `s_cselect` / `s_cmov` / `s_addc` / `s_subb` of a mask op's SCC, unless the condition is the same in every lane in EXEC. That is the rule I would have suggested. - The old test now asserts it. - The check runs only where the analysis marks the branch or the SCC as a lane mask's (`lane`), so point 2's case still gets through it. 2. **The analysis and the lowering disagree on which branches are per-lane.** - The analysis follows a mask op only when *both* sources are known masks (`lane_masks.rs:528-549`); otherwise SCC is an `Atom::Scc` with `lane = false` (`lane_masks.rs:574-578`). - The lowering treats an op as a mask op when *any* source holds a mask (`reads_mask`, `lower.rs:545` and `lower.rs:566`), and writes SCC per lane; `cond` then branches on it lane by lane (`lower.rs:963`). - Example: `v_cmp … vcc; s_and_b64 s[4:5], vcc, s[8:9]` (s8:9 is user data), then `s_cbranch_scc0 J; s_mov_b32 s6, 1; J: v_mov_b32 v3, s6`. - The lowering branches per lane, but the analysis has `lane = false`, so neither `0570037`'s `uniform_over` check nor `partial_blocks` (`lower.rs:1063`) sees the branch. - So the stale-value, cross-lane and `s_barrier` refusals don't run, and the lanes that skipped read their old s6. 3. **A bridged `v_cmpx_*` can turn on lanes that had EXEC off.** - `lower.rs:1647` passes `guard = true` for every cmpx. #1426's `write_mask` builds `act() & cond`, and `act()` returns that guard (`dxil/lower.rs:773`, `dxil/lower.rs:849-851`). - So at a guarded pc, the new EXEC is `cond`, not `cond & EXEC`. The native integer path is right (`lower.rs:791-794`). - Example: `v_cmp_gt_u32 vcc, 16, v0; s_and_saveexec_b32 s0, vcc` (no execz), then `v_cmpx_le_f32 0, v1; v_mov_b32 v2, 7; s_or_b32 exec, exec, s0`. Lanes 16 and up get v2 = 7. 4. **The stale-value rule misses three cases.** @⁠Kalmarv's `per-lane-stale` follow-up reworks this rule; from its description, same-block reads "stay with `def_owner` / `use_owner`", so the loop case below would still be taken there. I haven't read that branch. - **Loops.** The rule compares static blocks (`def_owner[b] != use_owner[c]`, `lower.rs:1004`), so a scalar written and read in the same partial block on different loop iterations is accepted. - Example: `s1 = 0; s3 = 0; L: v_cmp_eq_u32 vcc, s3, v0; s_and_saveexec s2, vcc; s_cbranch_execz J; s_add_u32 s1, s1, 1; v_mov v1, s1; J: s_or exec, exec, s2; s_add s3, s3, 1; s_cmp_lt_u32 s3, 4; s_cbranch_scc1 L`. - On the console, lane k gets v1 = k + 1. In the per-lane form every lane gets 1. - **A phi copied in a partial block.** `own` (`lower.rs:370-380`) copies only values already in `def_block`, and a phi never is one. `stale` follows the phi's operands, not the phi. - Example: a uniform if/else sets s5 to 1 or 2, then `s_and_saveexec; s_cbranch_execz J; s_mov_b32 s6, s5; J: s_or exec; v_mov v1, s6`. - The copy case in `a_mask_left_behind_by_lanes_that_skipped_its_write` copies an older mask from before the split, so it doesn't cover this. - **`s_bcnt0/1` of a mask.** It writes SCC through `ssa.write` (`wave.rs:464`), not `write_scc`/`own`, so `stale` never sees it. Example: `s_bcnt1_i32_b64 s2, exec` in an execz arm, then `s_cbranch_scc0` after the join. 5. **A bridged mask write in the split wave64 form can sit behind a barrier that only one half reaches.** - The bridge (`lower.rs:1648`) has no `all_lanes`-style check for instructions that #1426 lowers with an exchange between the halves. - Every f32/f16/f64 `v_cmp*` and `v_add_co_*` whose mask is read as a whole goes through `write_mask` → `ballot` → `exchange_n` → `meet()`, a group barrier (`dxil/lanes.rs:221-256`). - In a branch only one half takes (33–64 threads, `Partner::Present`), the other hardware wave never reaches that barrier: a hang, or barriers paired with the wrong partner. - The per-lane form's own ballots refuse this (`wave.rs:53`, `wave.rs:122`). - I followed the path, but the hang itself needs a run on a wave32 GPU. 6. **Lanes outside the launch EXEC (kernel ABI).** - `lower.rs:1259-1270` and `lower.rs:1502-1512` send those lanes straight to the exit, and lane 0 stores every SGPR. - With a launch EXEC of `0xFFFFFFFE`, `s_mov_b32 s0, 5` leaves `res[0]` at its input value. - The skip block also sets every mask bit to 0 (`lower.rs:1268`), where `s_not` or `s_orn2` of a v_cmp mask leaves those lanes at 1 on the console. - `lanes_outside_exec_at_launch_keep_their_registers` keeps lane 0 active. 7. **Not traced to the end:** `s_or_saveexec_b64 s, -1` and `s_mov_b64 exec, -1` (whole-wave mode) inside a block some lanes don't reach give EXEC = TRUE (`lane_masks.rs:464-467`, `lane_masks.rs:519-526`). On the console that turns on the lanes that branched away, and here they are elsewhere. What's left after the cross-lane refusals is a write in that region read by those lanes after the join. I haven't checked whether real code does that. **Runtime and caching** 8. **`xcl shaders --recomp` changes with no flag.** - `RecompAgg::add` (`shaders.rs:445-503`) now runs `lower_dxil::compute_code`, `survey_compute_code`, a second `translate_compute`/`translate_mesh` and `lane_masks::analyze_code` on every program, without `--lanes`. - So the existing sweep is slower and prints new lines. - These calls run on the sweep's worker threads, without `compute_with`'s 256 MB stack and panic catch. A panic in the new code would hit `h.join().unwrap()` (`shaders.rs:767`) and end the sweep. 9. **The per-lane cache identity has no version.** - `lower.rs`, `lower/wave.rs`, `lower_dxil.rs`, `lane_masks.rs` and `ssa.rs` are not in `TRANSLATOR_SOURCES` (`build.rs`). - `TRANSLATOR_VERSION` covers `gpu/dxil` only, and the per-lane identity is `identity_for(id, "xcl-per-lane")` (`pso.rs:245`). - So a later fix to the lowering keeps serving the old cached containers to `XCL_PER_LANE=1` users, unless someone bumps a version by hand. **Tests** 10. **Refusals become skips.** `programs_on_the_gpu` (`lower_dxil.rs:600-606`) turns any `Err` from the per-lane form into `skip_test`, not only the programs in `DIFFERS_ON_1426`. A change that makes the form refuse the f32/f64/int/f16 programs still passes. An allow-list of the expected refusals would keep the assertion. 11. Not covered: - Every lane_masks test is wave64. Nothing tests: - the wave32 `_B32` paths; - `*_WREXEC`, `v_cmpx`, VOP3 sdst = EXEC, or separate `exec_lo`/`exec_hi` writes; - nested loops or the `step_bounded`/`cond_bounded` fallbacks. - d94736a, 5f78f44 and 1b257c2 add no test. - The CPU `Interp` has no `foreign`, so bridged instructions are only covered by GPU runs. **CONTRIBUTING** 12. **The size waiver.** The description says the size rule is waived "at the maintainer's request (#1269)". The only maintainer text I found is the issue body ("We are open for big PRs aiming to optimize shaders … compiling shaders directly into DXIL"); please link or quote that, so a reviewer can see what the 7,467 lines rest on. 13. **Commits.** - `cf29f8a` says every per-lane GPU test failed on WARP (the CI adapter) before it, so the commits before it don't each pass CI. - Several commits fix earlier ones in the PR: bcb502f fixes 8cb697d, 1c9477a reworks d1f0661, 51f3b82 drops 8cb697d's heap refusal, and c7caa1d fixes this PR's `DxilIr`. - The description says 45 commits; the branch has 49. 14. **AI use.** 43cb32c and 8e0c4a7 carry `Assisted-by: Antigravity (Gemini 4 Neon)`, which the **AI use** section doesn't name. 15. **Not tested.** Both smoke runs are with `XCL_PER_LANE` off and, from the description, without `XCL_DIRECT_DXIL`, so they don't exercise the `kernel.rs` refactor (`Lw::new`/`Lw::finish`) under `XCL_DIRECT_DXIL=1`. Reading it, I think it emits the same DXIL. A byte diff of `xcl shaders --direct --dump` on `6c89285` and on `cf29f8a` would show it, and **Not tested** could say it wasn't run. 16. `XCL_PER_LANE`, `XCL_RECOMP_STAGES` and `XCL_RECOMP_NO_HLSL` aren't documented anywhere, as with `XCL_DIRECT_DXIL` today. **Nits** - `pso.rs:238`: `let id = identity_with(`. - `ssa.rs:150-158` doesn't move `users[phi]` to `users[same]`, so a trivial phi can be left behind. The results are unaffected: a leftover phi over the marker is still refused. - `wave.rs:298-300`: `v_readfirstlane` where no lane has EXEC reads lane 0. - `recomp/dxil/assemble.rs` is called only from its own test. It finds dxil.dll through `GetModuleHandleW`, so it works only once DXC has loaded it. **Checked and fine** - The lane-mask analysis: - the BDD (variable order, memoisation, partial results); - the saveexec/wrexec semantics, including the ANDN1/ANDN2 operand order; - VOPC/VOP3 sdst writes, and separate `exec_lo`/`exec_hi` writes turning EXEC opaque; - irreducible-flow detection, which is complete; - loop atoms not leaking between iterations; - the fallbacks weakening soundly. - SSA: the sealing order, and the one-pass trivial-phi replacement in 1c9477a, which can't form a cycle. - The lowering: - DPP16/DPP8, `v_permlane(x)16`, `ds_swizzle` quad-perm and bitmask modes (rotate mode not checked); - mbcnt, readlane, writelane and their split checks; - the `v_cndmask`/carry-in lane bit (c7caa1d); - coalesced runs, which can't span an EXEC or guard change; stores and atomics under partial EXEC run only in the lanes that have it; - far jumps. - The bridge's register check refuses every unpassed read of VCC, M0, EXEC and SCC. - The `kernel.rs` refactor: by reading, the module calls run in the same order, so the DXIL should be the same. - The fallback: a per-lane error, including a caught panic, goes to #1426's form. - GPU tests skip with `runner::skip_test`; no `#[ignore]`, no game data, no new dependency, no ported code. **AI use:** Claude Code. Three Claude Opus 5.5 subagents reviewed the three parts. Claude Opus 5.5 (the main session) then read the code path of every numbered point itself, at `cf29f8a` and again at `0570037`, and wrote this review; the **Checked and fine** list is from the subagents' reading. Points 5 and 7 are not traced to the end, as they say.
Author
Owner

@⁠FIJI1299 on GitHub · 2026-11-24 20:53 UTC · original

Test report on NVIDIA GeForce RTX 5070 (12 GB)

  • PR / Commit: #1745 (**cf29f8a**)
  • Hardware: AMD Ryzen 5 9600X, NVIDIA GeForce RTX 5070 (12 GB VRAM, driver 621.35), 32 GB DDR5 6000MT/s
  • Environment: Windows 11 (build 26300), rustc 1.100.0 (0ef1bc386 2026-11-09), Windows SDK 10.0.26100.0 (debug build)
  • Command: .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4)
  • Results:
    • xcl --lib: 876 passed; 0 failed; 22 ignored (14.76s)
    • Integration tests: 8 passed; 0 failed; 12 ignored (1 + 1 + 6)
    • Total workspace: 884 passed; 0 failed; 34 ignored
  • GPU tests skipped on this adapter:
    • 7 (no wave64)
    • 1 (no heap windows)
    • 1 (f32 rounding, wave64: no wave64)
    • 1 (integer arithmetic, wave64: no wave64)
    • 1 (f64, wave64: no wave64)
    • 1 (integer carries, wave64: no wave64)
    • 1 (f32 three-source, wave64: no wave64)
    • 1 (f32 transcendentals, wave64: no wave64)
    • 1 (f32 conversions, wave64: no wave64)
    • 1 (f16 arithmetic, wave64: no wave64)
    • 1 (f16 packed, wave64: no wave64)
    • 1 (f32 compares, wave64: no wave64)
    • 1 (f32 arithmetic, wave64: no wave64)
    • 1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)))
    • 1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)))
    • 1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)))
  • Not tested: Retail title (smoke.ps1), release build, AMD / native wave64 GPUs.
  • AI use: Google Gemini assisted with running the commands and drafting this report from my real local test run.
**@⁠FIJI1299** on GitHub · 2026-11-24 20:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144196009) **Test report on NVIDIA GeForce RTX 5070 (12 GB)** * **PR / Commit:** #1745 (`**cf29f8a**`) * **Hardware:** AMD Ryzen 5 9600X, NVIDIA GeForce RTX 5070 (12 GB VRAM, driver `621.35`), 32 GB DDR5 6000MT/s * **Environment:** Windows 11 (build `26300`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, Windows SDK `10.0.26100.0` (debug build) * **Command:** `.\scripts\test.ps1` (`cargo test --workspace -- --test-threads=4`) * **Results:** * `xcl --lib`: `876 passed; 0 failed; 22 ignored` (14.76s) * Integration tests: `8 passed; 0 failed; 12 ignored` (1 + 1 + 6) * Total workspace: `884 passed; 0 failed; 34 ignored` * **GPU tests skipped on this adapter:** * `7 (no wave64)` * `1 (no heap windows)` * `1 (f32 rounding, wave64: no wave64)` * `1 (integer arithmetic, wave64: no wave64)` * `1 (f64, wave64: no wave64)` * `1 (integer carries, wave64: no wave64)` * `1 (f32 three-source, wave64: no wave64)` * `1 (f32 transcendentals, wave64: no wave64)` * `1 (f32 conversions, wave64: no wave64)` * `1 (f16 arithmetic, wave64: no wave64)` * `1 (f16 packed, wave64: no wave64)` * `1 (f32 compares, wave64: no wave64)` * `1 (f32 arithmetic, wave64: no wave64)` * `1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)))` * `1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)))` * `1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)))` * **Not tested:** Retail title (`smoke.ps1`), release build, AMD / native wave64 GPUs. * **AI use:** Google Gemini assisted with running the commands and drafting this report from my real local test run.
Author
Owner

@⁠mgrein on GitHub · 2026-11-24 20:54 UTC · original

Test report for the head 0570037 (not yet reported on), NVIDIA RTX 4070.

Tested

  • NVIDIA GeForce RTX 4070 12 GB (Ada, 32-lane waves, so the split wave64 tests run for real), driver 617.14; AMD Ryzen 5 5600X; 32 GB RAM; Windows 11 Pro 25H2 (build 26200); Rust 1.94.1 stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2609.5. A clean worktree of 0570037, its own target dir.
  • .\scripts\test.ps1 at 0570037: 927 passed, 0 failed, 42 ignored over the workspace (lib: 878 passed, 0 failed, 22 ignored), two more than the description's 925 / 876 on cf29f8a.
  • SKIPPED (22): 18 "no wave64" (this GPU), 1 "no heap windows", and the 3 per-lane refusals the description names (V_CVT_F16_F32 in f32 conversions, V_MUL_F16 in f16 arithmetic, V_PK_MUL_F16 in f16 packed, wave32 per-lane form).
  • The XCL_SAMPLE_* variables were not set, so the game-data tests did nothing.

Not tested: native wave64; a title run with XCL_PER_LANE=1; --direct --lanes on the pack; release.

AI use: Claude Code (Claude Opus 5.5) ran the suite and wrote this report.

**@⁠mgrein** on GitHub · 2026-11-24 20:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144212462) Test report for the head `0570037` (not yet reported on), NVIDIA RTX 4070. **Tested** - NVIDIA GeForce RTX 4070 12 GB (Ada, 32-lane waves, so the split wave64 tests run for real), driver 617.14; AMD Ryzen 5 5600X; 32 GB RAM; Windows 11 Pro 25H2 (build 26200); Rust 1.94.1 `stable-x86_64-pc-windows-msvc`, debug; DXC 1.9.2609.5. A clean worktree of `0570037`, its own target dir. - `.\scripts\test.ps1` at `0570037`: **927 passed, 0 failed, 42 ignored** over the workspace (lib: 878 passed, 0 failed, 22 ignored), two more than the description's 925 / 876 on `cf29f8a`. - SKIPPED (22): 18 "no wave64" (this GPU), 1 "no heap windows", and the 3 per-lane refusals the description names (`V_CVT_F16_F32` in f32 conversions, `V_MUL_F16` in f16 arithmetic, `V_PK_MUL_F16` in f16 packed, wave32 per-lane form). - The `XCL_SAMPLE_*` variables were not set, so the game-data tests did nothing. **Not tested:** native wave64; a title run with `XCL_PER_LANE=1`; `--direct --lanes` on the pack; release. **AI use:** Claude Code (Claude Opus 5.5) ran the suite and wrote this report.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 20:38 UTC · original · edited 2026-11-24 20:55 UTC

Test report and review, on an RTX 5070 Ti (32-lane waves only). The suite passes on 43cb32c and on the current head cf29f8a, and a 60 s title pair with XCL_PER_LANE=1 is clean. Reading the per-lane parts gave two cases where the per-lane form takes a program and gives other results than the HLSL path (review points 1 and 2, each with small programs run here), and one wrong label in the summary line.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, 32-lane waves only), AMD Ryzen 9 9950X, Windows 11 Pro 26200; Rust 1.99.0 MSVC, debug; DXC 1.9.2609 (XCL_DXC_DIR); a private XCL_DXIL_CACHE, new for the first run and kept for the second.
  • cargo test --workspace -- --test-threads=4, clean trees, once per commit:
commit passed failed ignored SKIPPED lines
43cb32c 925 0 42 22
cf29f8a 925 0 42 22 (the same lines)
  • SKIPPED, 22 lines: 18 no wave64, 3 per-lane halves refused on purpose (V_CVT_F16_F32, V_MUL_F16, V_PK_MUL_F16), 1 no heap windows. The description counts 25 with 21 no wave64; the RTX 5070 report above has the same 22 as here.
the 22 lines
SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • Which tests ran per-lane DXIL on this GPU (all passed):
    • wave32: a_bridged_instruction_may_write_to_the_entry_block, per_lane_kernels_run_on_the_gpu (9 programs), a_per_lane_compute_program_runs_on_the_gpu, a_per_lane_program_with_four_memory_windows_runs_on_the_gpu, the wave32 shapes of a_per_lane_2d_or_3d_group_runs_on_the_gpu, the wave32 part of coalesced_foreign_runs_agree_on_the_gpu, and the wave32 halves of integer_programs_on_the_gpu (2 of 2), f32_programs_on_the_gpu (5 of 6) and f64_programs_on_the_gpu (1 of 1).
    • split wave64 (two 32-lane hardware waves, for real here): lower::tests::the_split_form_agrees_with_the_wave64_lowering_on_the_gpu, the_runtime_path_takes_the_split_form, and the (wave64, split) part of coalesced_foreign_runs_agree_on_the_gpu.
    • f16_programs_on_the_gpu passes without running any per-lane DXIL here: both wave32 halves are refused and both wave64 halves skip.
    • No native wave64 half ran. programs_on_the_gpu does not try the split form, so in the suite the f32 / f64 / integer programs never run as wave64 on a 32-lane GPU.
  • To cover that gap, one local test (not in the PR): the same programs through lower_dxil::kernel_split against the HLSL path's split form (Options { wave64: true, split_wave64: true }), every SGPR and VGPR the program names in all 64 lanes, f32_close where the suite uses it. All 8 programs the per-lane form takes agree: f32 arithmetic, compares, rounding, transcendentals, three-source; f64; integer arithmetic, carries. The other 3 are the same refusals as in wave32.
  • Title pair, 60 s each, XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 on both sides (XCL_DIRECT_DXIL_STATS=1 for the summary line), 43cb32c against its merge-base with main:

main:

xcl-smoke v1
commit: 6c89285b8b529bde59cd17a26b911c39912fb677
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1193 (PresentX 1193)
presents per 2 s (last 3): 0 4 2
device removals: 0
crashes: 0
peak commit: 24075 MB

This PR (43cb32c):

xcl-smoke v1
commit: 43cb32c04fe9d69caad38893467c2f6eff8bfc98
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1228 (PresentX 1228)
presents per 2 s (last 3): 1 7 5
device removals: 0
crashes: 0
peak commit: 25176 MB
  • The per-lane path was taken. Summary at 60 s on the PR side: CS direct 102 / HLSL fallback 0; CS per-lane direct 29 / HLSL fallback 73;. So 29 of 102 compute programs ran in the per-lane form and 73 were refused and went to #1426's per-instruction form (73 [SHADER] per-lane fallback ... – per-instruction form lines). None went to the HLSL path; see point 3 for the label. main side: CS direct 99 / HLSL fallback 0;.
  • Top refusal reasons of the 73:
count reason
17 a value written while some lanes were elsewhere, read after they met again
9 EXEC as a number in the split form where some lanes are elsewhere
8 unsupported IMAGE_LOAD (it reads register N the per-lane form did not pass)
5 unsupported IMAGE_SAMPLE_L (it reads register N the per-lane form did not pass)
3 mask source code N

Review (the per-lane parts; line numbers at cf29f8a)

  1. A branch or select on "any lane" of a mask is taken lane by lane, also where the lanes without the bit are still in EXEC. lane_masks::cond (lane_masks.rs:604) treats s_cbranch_vccz / vccnz and a branch on the SCC of a mask op as each lane's own bit, and Lower::cond (lower.rs:971) branches on it; S_CSELECT_B32 (lower.rs:624) selects on the same per-lane SCC. On the console these test the whole wave, and every lane goes the same way. The module doc says so as an assumption (lane_masks.rs:17, "it jumps over work that inactive lanes would not change anyway, or it tests a uniform value"), but nothing checks it, so a program outside it is taken and not refused. Shown with wave32 kernel programs that start with v_cmp_gt_u32 vcc, 16, v0 (VCC = lanes 0–15, EXEC = all 32) and write v1 on the fall-through, per-lane DXIL (lower_dxil::kernel) against the HLSL path on the GPU:
program after the compare HLSL path, v1 in lane 16 per-lane form, v1 in lane 16
s_and_b32 s0, vcc, exec; s_cbranch_scc1 L; v_mov_b32 v1, 7; L: 0 7
s_cbranch_vccnz L; v_mov_b32 v1, 7; L: 0 7
s_cbranch_vccz L; v_mov_b32 v1, 7; L: 7 0
s_cmp_lg_u32 vcc, 0; s_cbranch_scc1 L; v_mov_b32 v1, 7; L: 0 7
s_and_b32 s0, vcc, exec; s_cselect_b32 s1, 5, 7; v_mov_b32 v1, s1 5 7
control: SKIPPED_IF (s_and_saveexec, s_cbranch_execz) agrees agrees

In each of the first five rows the two paths differ in all of lanes 16–31 and agree in lanes 0–15 (the HLSL path has the same v1 in lanes 0 and 31). A branch on "any lane" is what if (WaveActiveAnyTrue(x)) or an early-out on "no lane needs this" asks for. Checked on the pack sweep since: of the 321 compute programs the per-lane form takes, 166 have a lane branch, and a local analysis pass (is there a lane here, in EXEC, without the bit?) marks 7 branches in 5 of them, all s_and_b64 vcc, exec, <mask>; s_cbranch_vccnz; no branch on the SCC of another mask op and no s_cselect on one. Read by hand, all 7 test a value that is the same in every active lane (the compiler's uniform branch), so none of the 321 gives other results through this. The point stands as an unchecked assumption, not as a wrong result in this pack. Not checked: the 29 programs of the title run on their own.

  1. A non-default rounding mode is dropped where #1426 and the HLSL path refuse the program. This may be what @⁠erickbobd's MODE guard (asked for on #1269) already covers; we haven't checked their branch. If it covers only s_setreg, the second way in below needs its own check. Two ways in:

    • lower.rs:720 takes every s_setreg* of MODE as a no-op. Its comment (lower.rs:718) says the lowering refuses every float instruction, which was true before the bridge; float instructions now go through Ir::foreign.
    • s_round_mode goes through the bridge to #1426's Lw::sopp (gpu/dxil/lower.rs:955), which refuses a non-default f32 mode but decides f64 and f16 from has_f64_round_op and dyn_rm. Lw::new leaves both false (gpu/dxil/kernel.rs:314), and only translate_on_this_thread sets them (kernel.rs:183), which the per-lane form does not go through.

    Shown with wave32 kernel programs, a sum of 1 + lane ulp and 0.75 ulp, on the GPU (lane 0):

program HLSL path #1426 form per-lane form
s_setreg_imm32_b32 hwreg(MODE, 0, 2), 3; v_add_f32 refused: non-default f32 round mode refused: the same taken: 0x3F800001 (to nearest; toward zero is 0x3F800000)
s_round_mode 0xC; v_add_f64 refused: non-default f64 round mode refused: the same taken: low dword 1 (to nearest; toward zero is 0)
s_setreg_imm32_b32 hwreg(MODE, 2, 2), 3; v_add_f64 refused: non-default f64 round mode refused: the same taken: low dword 1
s_round_mode 0x3; v_add_f32 refused refused refused (through the bridge)
the two sums without a mode write 0x3F800001; 1 the same the same

The f16 side (dyn_rm, s_round_mode 0xC with an f16 instruction, which recomp/tests.rs:6627 calls the retail pattern) is from reading only: a run here cannot show it, because an f16 sum comes out rounded toward zero on this driver on all three paths, with or without the mode write.

  1. The summary calls the per-lane refusals "HLSL fallback". pso.rs:617 records a refusal under the stage CS per-lane and goes on to translate_compute (pso.rs:622), and coverage::fallback_summary prints every stage as direct N / HLSL fallback M (gpu/dxil/coverage.rs:317). In the title run above, CS per-lane direct 29 / HLSL fallback 73 are 73 programs in the per-instruction form; CS direct 102 / HLSL fallback 0 is the line that counts the HLSL path. Label only.

The three local tests behind this (split-form programs, the branch programs, the rounding programs; they print, they don't assert) are about 230 lines on cf29f8a; say if you want them as a follow-up PR or a patch here.

Not tested

  • Native wave64 (every wave64 half skips here), AMD and Intel GPUs, a release build of the suite.
  • The title beyond 60 s, and the pictures: the pair counts frames, crashes and device removals only. cf29f8a in the title (it changes test code only).
  • xcl shaders --direct --lanes (the pack sweep), DXC and driver times.
  • VS / PS and mesh in the per-lane form.
  • The refactor of gpu/dxil/kernel.rs (Lw::new / Lw::finish): its output was not compared with main's, and of its diff only Lw::new was read.
  • Read for the review: lower_dxil.rs, ssa.rs, lower/wave.rs, the pso.rs and module.rs diffs, and of lower.rs the scalar, vector and memory instructions, the branches, the stale check, the bridge and the block driver. Not read: assemble.rs, shaders.rs, the VS / PS parts and the tests of lower.rs; lane_masks.rs only where point 1 needed it.

AI use: Claude Code (Claude Fable 5.2) ran the tests, read the diff and drafted this. Claude Code (Claude Opus 5.5) reviewed it before posting.

**@⁠Kalmarv** on GitHub · 2026-11-24 20:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7143855041) · edited 2026-11-24 20:55 UTC Test report and review, on an RTX 5070 Ti (32-lane waves only). The suite passes on `43cb32c` and on the current head `cf29f8a`, and a 60 s title pair with `XCL_PER_LANE=1` is clean. Reading the per-lane parts gave two cases where the per-lane form takes a program and gives other results than the HLSL path (review points 1 and 2, each with small programs run here), and one wrong label in the summary line. **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, 32-lane waves only), AMD Ryzen 9 9950X, Windows 11 Pro 26200; Rust 1.99.0 MSVC, debug; DXC 1.9.2609 (`XCL_DXC_DIR`); a private `XCL_DXIL_CACHE`, new for the first run and kept for the second. - `cargo test --workspace -- --test-threads=4`, clean trees, once per commit: | commit | passed | failed | ignored | SKIPPED lines | |---|---|---|---|---| | `43cb32c` | 925 | 0 | 42 | 22 | | `cf29f8a` | 925 | 0 | 42 | 22 (the same lines) | - SKIPPED, 22 lines: 18 `no wave64`, 3 per-lane halves refused on purpose (`V_CVT_F16_F32`, `V_MUL_F16`, `V_PK_MUL_F16`), 1 `no heap windows`. The description counts 25 with 21 `no wave64`; the RTX 5070 report above has the same 22 as here. <details><summary>the 22 lines</summary> ``` SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)) SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)) SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)) SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64 SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64 SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64 SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows ``` </details> - Which tests ran per-lane DXIL on this GPU (all passed): - wave32: `a_bridged_instruction_may_write_to_the_entry_block`, `per_lane_kernels_run_on_the_gpu` (9 programs), `a_per_lane_compute_program_runs_on_the_gpu`, `a_per_lane_program_with_four_memory_windows_runs_on_the_gpu`, the wave32 shapes of `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, the wave32 part of `coalesced_foreign_runs_agree_on_the_gpu`, and the wave32 halves of `integer_programs_on_the_gpu` (2 of 2), `f32_programs_on_the_gpu` (5 of 6) and `f64_programs_on_the_gpu` (1 of 1). - split wave64 (two 32-lane hardware waves, for real here): `lower::tests::the_split_form_agrees_with_the_wave64_lowering_on_the_gpu`, `the_runtime_path_takes_the_split_form`, and the `(wave64, split)` part of `coalesced_foreign_runs_agree_on_the_gpu`. - `f16_programs_on_the_gpu` passes without running any per-lane DXIL here: both wave32 halves are refused and both wave64 halves skip. - No native wave64 half ran. `programs_on_the_gpu` does not try the split form, so in the suite the f32 / f64 / integer programs never run as wave64 on a 32-lane GPU. - To cover that gap, one local test (not in the PR): the same programs through `lower_dxil::kernel_split` against the HLSL path's split form (`Options { wave64: true, split_wave64: true }`), every SGPR and VGPR the program names in all 64 lanes, `f32_close` where the suite uses it. All 8 programs the per-lane form takes agree: f32 arithmetic, compares, rounding, transcendentals, three-source; f64; integer arithmetic, carries. The other 3 are the same refusals as in wave32. - Title pair, 60 s each, `XCL_DIRECT_DXIL=1 XCL_PER_LANE=1` on both sides (`XCL_DIRECT_DXIL_STATS=1` for the summary line), `43cb32c` against its merge-base with `main`: `main`: ``` xcl-smoke v1 commit: 6c89285b8b529bde59cd17a26b911c39912fb677 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1193 (PresentX 1193) presents per 2 s (last 3): 0 4 2 device removals: 0 crashes: 0 peak commit: 24075 MB ``` This PR (`43cb32c`): ``` xcl-smoke v1 commit: 43cb32c04fe9d69caad38893467c2f6eff8bfc98 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1228 (PresentX 1228) presents per 2 s (last 3): 1 7 5 device removals: 0 crashes: 0 peak commit: 25176 MB ``` - The per-lane path was taken. Summary at 60 s on the PR side: `CS direct 102 / HLSL fallback 0; CS per-lane direct 29 / HLSL fallback 73;`. So 29 of 102 compute programs ran in the per-lane form and 73 were refused and went to #1426's per-instruction form (73 `[SHADER] per-lane fallback ... – per-instruction form` lines). None went to the HLSL path; see point 3 for the label. `main` side: `CS direct 99 / HLSL fallback 0;`. - Top refusal reasons of the 73: | count | reason | |---|---| | 17 | a value written while some lanes were elsewhere, read after they met again | | 9 | EXEC as a number in the split form where some lanes are elsewhere | | 8 | unsupported IMAGE_LOAD (it reads register N the per-lane form did not pass) | | 5 | unsupported IMAGE_SAMPLE_L (it reads register N the per-lane form did not pass) | | 3 | mask source code N | **Review** (the per-lane parts; line numbers at `cf29f8a`) 1. **A branch or select on "any lane" of a mask is taken lane by lane, also where the lanes without the bit are still in EXEC.** `lane_masks::cond` (`lane_masks.rs:604`) treats `s_cbranch_vccz` / `vccnz` and a branch on the SCC of a mask op as each lane's own bit, and `Lower::cond` (`lower.rs:971`) branches on it; `S_CSELECT_B32` (`lower.rs:624`) selects on the same per-lane SCC. On the console these test the whole wave, and every lane goes the same way. The module doc says so as an assumption (`lane_masks.rs:17`, "it jumps over work that inactive lanes would not change anyway, or it tests a uniform value"), but nothing checks it, so a program outside it is taken and not refused. Shown with wave32 kernel programs that start with `v_cmp_gt_u32 vcc, 16, v0` (VCC = lanes 0–15, EXEC = all 32) and write `v1` on the fall-through, per-lane DXIL (`lower_dxil::kernel`) against the HLSL path on the GPU: | program after the compare | HLSL path, `v1` in lane 16 | per-lane form, `v1` in lane 16 | |---|---|---| | `s_and_b32 s0, vcc, exec; s_cbranch_scc1 L; v_mov_b32 v1, 7; L:` | 0 | 7 | | `s_cbranch_vccnz L; v_mov_b32 v1, 7; L:` | 0 | 7 | | `s_cbranch_vccz L; v_mov_b32 v1, 7; L:` | 7 | 0 | | `s_cmp_lg_u32 vcc, 0; s_cbranch_scc1 L; v_mov_b32 v1, 7; L:` | 0 | 7 | | `s_and_b32 s0, vcc, exec; s_cselect_b32 s1, 5, 7; v_mov_b32 v1, s1` | 5 | 7 | | control: `SKIPPED_IF` (`s_and_saveexec`, `s_cbranch_execz`) | agrees | agrees | In each of the first five rows the two paths differ in all of lanes 16–31 and agree in lanes 0–15 (the HLSL path has the same `v1` in lanes 0 and 31). A branch on "any lane" is what `if (WaveActiveAnyTrue(x))` or an early-out on "no lane needs this" asks for. Checked on the pack sweep since: of the 321 compute programs the per-lane form takes, 166 have a lane branch, and a local analysis pass (is there a lane here, in EXEC, without the bit?) marks 7 branches in 5 of them, all `s_and_b64 vcc, exec, <mask>; s_cbranch_vccnz`; no branch on the SCC of another mask op and no `s_cselect` on one. Read by hand, all 7 test a value that is the same in every active lane (the compiler's uniform branch), so none of the 321 gives other results through this. The point stands as an unchecked assumption, not as a wrong result in this pack. Not checked: the 29 programs of the title run on their own. 2. **A non-default rounding mode is dropped where #1426 and the HLSL path refuse the program.** This may be what @⁠erickbobd's MODE guard (asked for on #1269) already covers; we haven't checked their branch. If it covers only `s_setreg`, the second way in below needs its own check. Two ways in: - `lower.rs:720` takes every `s_setreg*` of MODE as a no-op. Its comment (`lower.rs:718`) says the lowering refuses every float instruction, which was true before the bridge; float instructions now go through `Ir::foreign`. - `s_round_mode` goes through the bridge to #1426's `Lw::sopp` (`gpu/dxil/lower.rs:955`), which refuses a non-default f32 mode but decides f64 and f16 from `has_f64_round_op` and `dyn_rm`. `Lw::new` leaves both `false` (`gpu/dxil/kernel.rs:314`), and only `translate_on_this_thread` sets them (`kernel.rs:183`), which the per-lane form does not go through. Shown with wave32 kernel programs, a sum of `1 + lane ulp` and `0.75 ulp`, on the GPU (lane 0): | program | HLSL path | #1426 form | per-lane form | |---|---|---|---| | `s_setreg_imm32_b32 hwreg(MODE, 0, 2), 3; v_add_f32` | refused: non-default f32 round mode | refused: the same | taken: `0x3F800001` (to nearest; toward zero is `0x3F800000`) | | `s_round_mode 0xC; v_add_f64` | refused: non-default f64 round mode | refused: the same | taken: low dword 1 (to nearest; toward zero is 0) | | `s_setreg_imm32_b32 hwreg(MODE, 2, 2), 3; v_add_f64` | refused: non-default f64 round mode | refused: the same | taken: low dword 1 | | `s_round_mode 0x3; v_add_f32` | refused | refused | refused (through the bridge) | | the two sums without a mode write | `0x3F800001`; 1 | the same | the same | The f16 side (`dyn_rm`, `s_round_mode 0xC` with an f16 instruction, which `recomp/tests.rs:6627` calls the retail pattern) is from reading only: a run here cannot show it, because an f16 sum comes out rounded toward zero on this driver on all three paths, with or without the mode write. 3. **The summary calls the per-lane refusals "HLSL fallback".** `pso.rs:617` records a refusal under the stage `CS per-lane` and goes on to `translate_compute` (`pso.rs:622`), and `coverage::fallback_summary` prints every stage as `direct N / HLSL fallback M` (`gpu/dxil/coverage.rs:317`). In the title run above, `CS per-lane direct 29 / HLSL fallback 73` are 73 programs in the per-instruction form; `CS direct 102 / HLSL fallback 0` is the line that counts the HLSL path. Label only. The three local tests behind this (split-form programs, the branch programs, the rounding programs; they print, they don't assert) are about 230 lines on `cf29f8a`; say if you want them as a follow-up PR or a patch here. **Not tested** - Native wave64 (every wave64 half skips here), AMD and Intel GPUs, a release build of the suite. - The title beyond 60 s, and the pictures: the pair counts frames, crashes and device removals only. `cf29f8a` in the title (it changes test code only). - `xcl shaders --direct --lanes` (the pack sweep), DXC and driver times. - VS / PS and mesh in the per-lane form. - The refactor of `gpu/dxil/kernel.rs` (`Lw::new` / `Lw::finish`): its output was not compared with `main`'s, and of its diff only `Lw::new` was read. - Read for the review: `lower_dxil.rs`, `ssa.rs`, `lower/wave.rs`, the `pso.rs` and `module.rs` diffs, and of `lower.rs` the scalar, vector and memory instructions, the branches, the stale check, the bridge and the block driver. Not read: `assemble.rs`, `shaders.rs`, the VS / PS parts and the tests of `lower.rs`; `lane_masks.rs` only where point 1 needed it. **AI use:** Claude Code (Claude Fable 5.2) ran the tests, read the diff and drafted this. Claude Code (Claude Opus 5.5) reviewed it before posting.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 20:56 UTC · original

@⁠thehollowedone thank you for the fixture and the readbacks on 0570037 (HLSL all 5, per-lane 5 in lanes 0-15 and 7 in lanes 16-31). Received. It looks like the same area as the SCC-from-a-mask review point above (the form treats the SCC as per lane where the check does not see it); I have passed your program to the session that writes the code and will answer here once there is a decision. I am not promising a fix yet.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 20:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144269595) @⁠thehollowedone thank you for the fixture and the readbacks on `0570037` (HLSL all 5, per-lane 5 in lanes 0-15 and 7 in lanes 16-31). Received. It looks like the same area as the SCC-from-a-mask review point above (the form treats the SCC as per lane where the check does not see it); I have passed your program to the session that writes the code and will answer here once there is a decision. I am not promising a fix yet. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠moombathepilot on GitHub · 2026-11-24 20:57 UTC · original

RX 7800 XT review of #1745

I reviewed the shader sweep's validation and size reporting and ran the tests below on clean head 0570037d0247978205e786057cadbdc85dded0ca. Both test commands exited successfully.

Review findings

  1. Separate successful translations from paired size totals. If per-lane translation succeeds but the per-instruction run returns an error or times out, the sweep adds the per-lane byte count and adds zero for the other side. The printed size totals then compare different sets of shaders. Keep counting all successful per-lane translations for coverage, but add to both size totals only when both paths succeed and print the paired count. This is a conditional accounting issue found in the code. I did not verify that it affected the posted whole-pack numbers.
  2. Apply --validate to the per-lane output in release sweeps. --validate reaches the per-instruction translator, but the per-lane call doesn't use it. The validator in Lw::finish runs only in debug or test builds. A release --direct --lanes --validate sweep can therefore count per-lane output without passing it through the DXIL validator. Could the sweep validate both paths when the flag is set, or label which path it validates?

Tested

RX 7800 XT (RDNA3), driver 32.0.32029.2010, Ryzen 7 5700X3D, Windows build 26300.9974, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.9.2602.17, debug. No source changes.

Run Passed Failed Ignored Explicit skips included in passing results
scripts/test.ps1 --test-threads=4, flags unset 927 0 42 7 skip messages
cargo test --locked -p xcl --lib -- gpu::recomp::lower --test-threads=1 --nocapture, with XCL_DIRECT_DXIL=1 and XCL_PER_LANE=1 46 0 0 6 skip messages

Both runs logged the six documented f16 cases (arithmetic, packed multiply and conversion on wave32 and wave64). The full suite also skipped heap_window_out_of_memory_falls_back_to_the_switch_form because heap windows were unavailable. The focused set includes the split-path and four-memory-window GPU tests, which passed.

Not tested

Retail startup on this PR, a release shader sweep, the whole-pack size result, compile speed, or opt-in game-data tests (XCL_SAMPLE_* unset). The two reporting findings were verified by reading the source and are separate from the passing debug tests.

AI use

Codex (GPT-6.2-sol) reviewed the relevant code, ran the tests on this PC, and drafted this report from the results.

**@⁠moombathepilot** on GitHub · 2026-11-24 20:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144278744) ### RX 7800 XT review of #1745 I reviewed the shader sweep's validation and size reporting and ran the tests below on clean head `0570037d0247978205e786057cadbdc85dded0ca`. Both test commands exited successfully. ### Review findings 1. [Separate successful translations from paired size totals](https://github.com/xcl-dev/xcl/blob/0570037d0247978205e786057cadbdc85dded0ca/crates/xcl/src/shaders.rs#L1580-L1586). If per-lane translation succeeds but the per-instruction run returns an error or times out, the sweep adds the per-lane byte count and adds zero for the other side. The printed size totals then compare different sets of shaders. Keep counting all successful per-lane translations for coverage, but add to both size totals only when both paths succeed and print the paired count. This is a conditional accounting issue found in the code. I did not verify that it affected the posted whole-pack numbers. 2. [Apply `--validate` to the per-lane output in release sweeps](https://github.com/xcl-dev/xcl/blob/0570037d0247978205e786057cadbdc85dded0ca/crates/xcl/src/shaders.rs#L1563-L1584). `--validate` reaches the per-instruction translator, but the per-lane call doesn't use it. [The validator in `Lw::finish`](https://github.com/xcl-dev/xcl/blob/0570037d0247978205e786057cadbdc85dded0ca/crates/xcl/src/gpu/dxil/kernel.rs#L399-L410) runs only in debug or test builds. A release `--direct --lanes --validate` sweep can therefore count per-lane output without passing it through the DXIL validator. Could the sweep validate both paths when the flag is set, or label which path it validates? ### Tested RX 7800 XT (RDNA3), driver `32.0.32029.2010`, Ryzen 7 5700X3D, Windows build `26300.9974`, Rust `1.100.0` MSVC, SDK DXC/DXIL `1.9.2602.17`, debug. No source changes. | Run | Passed | Failed | Ignored | Explicit skips included in passing results | | --- | ---: | ---: | ---: | --- | | `scripts/test.ps1 --test-threads=4`, flags unset | 927 | 0 | 42 | 7 skip messages | | `cargo test --locked -p xcl --lib -- gpu::recomp::lower --test-threads=1 --nocapture`, with `XCL_DIRECT_DXIL=1` and `XCL_PER_LANE=1` | 46 | 0 | 0 | 6 skip messages | Both runs logged the six documented f16 cases (arithmetic, packed multiply and conversion on wave32 and wave64). The full suite also skipped `heap_window_out_of_memory_falls_back_to_the_switch_form` because heap windows were unavailable. The focused set includes the split-path and four-memory-window GPU tests, which passed. ### Not tested Retail startup on this PR, a release shader sweep, the whole-pack size result, compile speed, or opt-in game-data tests (`XCL_SAMPLE_*` unset). The two reporting findings were verified by reading the source and are separate from the passing debug tests. ### AI use Codex (GPT-6.2-sol) reviewed the relevant code, ran the tests on this PC, and drafted this report from the results.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 20:58 UTC · original

@⁠moombathepilot thank you for the RX 7800 XT report on 0570037 (927 passed, 0 failed, 42 ignored; 46 passed with XCL_DIRECT_DXIL=1 XCL_PER_LANE=1, six documented f16 skips) and for the two review points on the sweep (paired size totals, --validate for the per-lane output). Received and passed to the session that writes the code; I will answer here once there is a decision. I am not promising a change yet.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 20:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144296497) @⁠moombathepilot thank you for the RX 7800 XT report on `0570037` (927 passed, 0 failed, 42 ignored; 46 passed with `XCL_DIRECT_DXIL=1 XCL_PER_LANE=1`, six documented f16 skips) and for the two review points on the sweep (paired size totals, `--validate` for the per-lane output). Received and passed to the session that writes the code; I will answer here once there is a decision. I am not promising a change yet. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠vitor127wt on GitHub · 2026-11-24 20:58 UTC · original

RTX 5070 Ti / Proton — per-lane retail run on 0570037

With XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PER_LANE=1, the 150 s run on 0570037d0247978205e786057cadbdc85dded0ca translated 10 of 24 compute shaders per lane. The other 14 used per-instruction direct DXIL. Eleven per-lane refusals logged the new whole-wave mask branch rule, two logged numeric EXEC in the split form, and one logged an IMAGE_LOAD register restriction. There were zero HLSL fallbacks.

The earlier 150 s run on cf29f8a6a7e4e64cfaf17dd929e5334a7d5cf193 also routed 10 shaders per lane and 14 per instruction. All 24 translated compute cache keys and their DXIL bytes matched across the two revisions. Earlier 60 s runs on 6c89285 and cf29f8a with per-lane off showed 1,236 and 1,235 frames, respectively. Enabling per-lane on cf29f8a in the 60 s run sent all three startup compute shaders through the per-instruction path. All three runs produced byte-identical compute DXIL.

Tested

  • RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS 7.3.5-2-cachyos, Proton Experimental 11.0 (experimental-11.0-20261112-x86_64). vkd3d-proton ec207194 with the #257 patch, dxil-spirv 7c048638, and DXC 1.9.2609.5. Clean x64 Windows release builds using Rust 1.100.0 and LLVM-MinGW 20261117 (x86_64-pc-windows-gnullvm).
  • Built with cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl. Ran scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 150 from #257 for the longer runs. Each run used the same retail title, a separate fresh Wine prefix and shader cache, networking off, and A presses scheduled every three seconds. XCL PSO cache blobs and vkd3d-proton/NVIDIA disk shader caches were disabled. Both used XCL_DXC_THREADS=2, XCL_PSO_TRACE=1, and XCL_DIRECT_DXIL_STATS=1. The smoke scope was capped at 16 GiB RAM with no swap.
  • Built the library tests with cargo test --locked --release --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run. Ran the Windows test binary in Proton Wine with the filters gpu::recomp::lower_dxil::tests:: and a_whole_wave_decision_on_a_mask_some_lanes_lack_is_refused, --test-threads=1 --nocapture. The updated head returned 13 passed, 0 failed, 0 ignored. This includes the whole-wave mask and rounding-mode regression tests. The run logged 15 skipped subcases (12 requiring native wave64 and three intentionally refused f16 cases). The split wave64 and four-memory-window GPU tests ran.

150 s smoke on 0570037

xcl-smoke v1
commit: 0570037d0247978205e786057cadbdc85dded0ca
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 150
exit: 0x0
frames shown: 1830 (PresentX 1830)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

The Wine smoke script generated the block. I abbreviated the local folder name in title. The last two-second bin with presents ended at 94.1 s. Wine reported 0 MB in the Windows peak-commit field. Linux cgroup peak was 15.07 GiB, with no OOM kill. Coverage is the retail loading interval on Proton and the focused suite.

AI use — OpenAI Codex (GPT-6, exact variant unavailable) built and ran the checks, verified the logs, and drafted this report.

**@⁠vitor127wt** on GitHub · 2026-11-24 20:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144314537) **RTX 5070 Ti / Proton — per-lane retail run on `0570037`** With `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PER_LANE=1`, the 150 s run on `0570037d0247978205e786057cadbdc85dded0ca` translated **10 of 24 compute shaders per lane**. The other 14 used per-instruction direct DXIL. Eleven per-lane refusals logged the new whole-wave mask branch rule, two logged numeric EXEC in the split form, and one logged an `IMAGE_LOAD` register restriction. There were zero HLSL fallbacks. The earlier 150 s run on `cf29f8a6a7e4e64cfaf17dd929e5334a7d5cf193` also routed 10 shaders per lane and 14 per instruction. All 24 translated compute cache keys and their DXIL bytes matched across the two revisions. Earlier 60 s runs on `6c89285` and `cf29f8a` with per-lane off showed 1,236 and 1,235 frames, respectively. Enabling per-lane on `cf29f8a` in the 60 s run sent all three startup compute shaders through the per-instruction path. All three runs produced byte-identical compute DXIL. **Tested** - RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS `7.3.5-2-cachyos`, Proton Experimental 11.0 (`experimental-11.0-20261112-x86_64`). vkd3d-proton `ec207194` with the #257 patch, dxil-spirv `7c048638`, and DXC 1.9.2609.5. Clean x64 Windows release builds using Rust 1.100.0 and LLVM-MinGW 20261117 (`x86_64-pc-windows-gnullvm`). - Built with `cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl`. Ran `scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 150` from #257 for the longer runs. Each run used the same retail title, a separate fresh Wine prefix and shader cache, networking off, and A presses scheduled every three seconds. XCL PSO cache blobs and vkd3d-proton/NVIDIA disk shader caches were disabled. Both used `XCL_DXC_THREADS=2`, `XCL_PSO_TRACE=1`, and `XCL_DIRECT_DXIL_STATS=1`. The smoke scope was capped at 16 GiB RAM with no swap. - Built the library tests with `cargo test --locked --release --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run`. Ran the Windows test binary in Proton Wine with the filters `gpu::recomp::lower_dxil::tests::` and `a_whole_wave_decision_on_a_mask_some_lanes_lack_is_refused`, `--test-threads=1 --nocapture`. The updated head returned **13 passed, 0 failed, 0 ignored**. This includes the whole-wave mask and rounding-mode regression tests. The run logged **15 skipped subcases** (12 requiring native wave64 and three intentionally refused f16 cases). The split wave64 and four-memory-window GPU tests ran. **150 s smoke on `0570037`** ``` xcl-smoke v1 commit: 0570037d0247978205e786057cadbdc85dded0ca gpu: NVIDIA GeForce RTX 5070 Ti title: GTA6.Xbox.v1.0.2.1 seconds: 150 exit: 0x0 frames shown: 1830 (PresentX 1830) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 0 MB ``` The Wine smoke script generated the block. I abbreviated the local folder name in `title`. The last two-second bin with presents ended at 94.1 s. Wine reported 0 MB in the Windows peak-commit field. Linux cgroup peak was 15.07 GiB, with no OOM kill. Coverage is the retail loading interval on Proton and the focused suite. **AI use** — OpenAI Codex (GPT-6, exact variant unavailable) built and ran the checks, verified the logs, and drafted this report.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 20:55 UTC · original · edited 2026-11-24 21:10 UTC

Retest on bfb8133d

Confirmed the loop SCC fix on the same RTX 3080 Ti setup. The per-lane compiler now refuses the original loop at the scalar select. I dispatched the same shader separately through per-instruction direct DXIL and HLSL. Each returned 5 in all 32 lanes. In a control that set the loop condition with a uniform scalar compare, per-lane DXIL still compiled and returned 5 in all 32 lanes.

Using cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1, the stock gpu::recomp::lower::tests:: suite reported 34 passed, 0 failed, 0 ignored, with four native-wave64 subcases skipped. The added scratch_wave32_loop_refusal_and_reference_readback fixture passed 1/1 with zero skips. This checks kernel compilation and readback. Retail and runtime routing were outside the test.

Tested

On 0570037d, a synthetic two-iteration wave32 loop gave different GPU readbacks. HLSL returned v1 = 5 in all 32 lanes. Per-lane DXIL returned 5 in lanes 0–15 and 7 in lanes 16–31. Both dispatched successfully. This exercises a mask-derived SCC reaching the next iteration's scalar select, with both mask operands known.

Initialize EXEC to all 32 lanes and v0 to the lane index.

s_mov_b32 s4, 2
v_cmp_gt_u32 vcc_lo, 16, v0
s_cmp_gt_u32 1, 0
loop:
s_cselect_b32 s1, 5, 7
v_mov_b32 v1, s1
s_sub_u32 s4, s4, 1
s_cmp_eq_u32 s4, 0
s_cbranch_scc1 done
s_and_b32 s0, vcc_lo, exec_lo
s_branch loop
done:
s_endpgm

RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11. cargo test --offline --locked -p xcl --lib scratch_loop_carried_scc -- --test-threads=1 --nocapture ran one added fixture with zero skips and failed at the direct DXIL vs. HLSL comparison. The HLSL readback passed the all-5 assertion. The fixture uses the existing kernel runners.

Not tested

This fixture covers wave32 kernel lowering. Retail behavior, native wave64 and runtime fallback were outside the run.

AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote and ran the fixture and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-24 20:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144234666) · edited 2026-11-24 21:10 UTC **Retest on [`bfb8133d`](https://github.com/xcl-dev/xcl/commit/bfb8133d36df38c3de381f9d99203568b32aa765)** Confirmed [the loop SCC fix](https://github.com/xcl-dev/xcl/commit/9dcf2f6916436aad162069127c8e68586862cc3b) on the same RTX 3080 Ti setup. The per-lane compiler now refuses the original loop at the scalar select. I dispatched the same shader separately through per-instruction direct DXIL and HLSL. Each returned `5` in all 32 lanes. In a control that set the loop condition with a uniform scalar compare, per-lane DXIL still compiled and returned `5` in all 32 lanes. Using `cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1`, the stock `gpu::recomp::lower::tests::` suite reported 34 passed, 0 failed, 0 ignored, with four native-wave64 subcases skipped. The added `scratch_wave32_loop_refusal_and_reference_readback` fixture passed 1/1 with zero skips. This checks kernel compilation and readback. Retail and runtime routing were outside the test. **Tested** On [`0570037d`](https://github.com/xcl-dev/xcl/commit/0570037d0247978205e786057cadbdc85dded0ca), a synthetic two-iteration wave32 loop gave different GPU readbacks. HLSL returned `v1 = 5` in all 32 lanes. Per-lane DXIL returned `5` in lanes 0–15 and `7` in lanes 16–31. Both dispatched successfully. This exercises a mask-derived SCC reaching the next iteration's scalar select, with both mask operands known. Initialize `EXEC` to all 32 lanes and `v0` to the lane index. ```asm s_mov_b32 s4, 2 v_cmp_gt_u32 vcc_lo, 16, v0 s_cmp_gt_u32 1, 0 loop: s_cselect_b32 s1, 5, 7 v_mov_b32 v1, s1 s_sub_u32 s4, s4, 1 s_cmp_eq_u32 s4, 0 s_cbranch_scc1 done s_and_b32 s0, vcc_lo, exec_lo s_branch loop done: s_endpgm ``` RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11. `cargo test --offline --locked -p xcl --lib scratch_loop_carried_scc -- --test-threads=1 --nocapture` ran one added fixture with zero skips and failed at the direct DXIL vs. HLSL comparison. The HLSL readback passed the all-5 assertion. The fixture uses the existing kernel runners. **Not tested** This fixture covers wave32 kernel lowering. Retail behavior, native wave64 and runtime fallback were outside the run. AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote and ran the fixture and drafted this report.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 21:10 UTC · original

#1745 is rebased onto main 4178e88 (one conflict in kernel.rs with #1748's new Lw fields, resolved). Head bfb8133, 51 commits, both checks green. Suite 955 passed, 0 failed, 42 ignored; smoke 915 frames against 889 for main. Replies, one per reviewer:

  • @⁠Kalmarv: points 1 and 2 are fixed in 66879ef. A branch or scalar select on whether any lane of a mask is set is taken per lane only where the condition is the same in every lane in EXEC, and is refused otherwise. MODE writes go through #1426, and the adapter sets dyn_rm / has_f64_round_op. Each has a test that failed before. Point 3 (the "HLSL fallback" label) is noted and not changed.
  • @⁠thehollowedone: your loop program (a mask-op SCC carried around the back edge) is now refused, in 9dcf2f6, with a test that failed before. Thank you for the fixture.
  • @⁠Pipodi: points 9 (per-lane cache identity from the per-lane sources, bfb8133), 12 (size waiver, in the description), 13 (commit count, now 51) and 14 (the Antigravity trailer on two of MiguelMachado-dev's commits, now named in AI use) are done. Points 2, 3, 4-8, 10, 11, 15 and 16 are noted as follow-ups for after the maintainer's call. For 15, @⁠vitor127wt's byte-identical DXIL run covers one title.
  • @⁠moombathepilot: the two sweep notes (paired size totals, --validate for the per-lane output) are noted for the --lanes follow-up.

The description now says 316 / 2 689 compute programs with the stricter rules, +0.8 % size against #1426's per-instruction form, so the earlier 321 figure no longer applies.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 21:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7144578560) #1745 is rebased onto `main` `4178e88` (one conflict in `kernel.rs` with #1748's new `Lw` fields, resolved). Head `bfb8133`, 51 commits, both checks green. Suite 955 passed, 0 failed, 42 ignored; smoke 915 frames against 889 for `main`. Replies, one per reviewer: - @⁠Kalmarv: points 1 and 2 are fixed in `66879ef`. A branch or scalar select on whether any lane of a mask is set is taken per lane only where the condition is the same in every lane in EXEC, and is refused otherwise. MODE writes go through #1426, and the adapter sets `dyn_rm` / `has_f64_round_op`. Each has a test that failed before. Point 3 (the "HLSL fallback" label) is noted and not changed. - @⁠thehollowedone: your loop program (a mask-op SCC carried around the back edge) is now refused, in `9dcf2f6`, with a test that failed before. Thank you for the fixture. - @⁠Pipodi: points 9 (per-lane cache identity from the per-lane sources, `bfb8133`), 12 (size waiver, in the description), 13 (commit count, now 51) and 14 (the Antigravity trailer on two of MiguelMachado-dev's commits, now named in **AI use**) are done. Points 2, 3, 4-8, 10, 11, 15 and 16 are noted as follow-ups for after the maintainer's call. For 15, @⁠vitor127wt's byte-identical DXIL run covers one title. - @⁠moombathepilot: the two sweep notes (paired size totals, `--validate` for the per-lane output) are noted for the `--lanes` follow-up. The description now says 316 / 2 689 compute programs with the stricter rules, +0.8 % size against #1426's per-instruction form, so the earlier 321 figure no longer applies. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 22:55 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 22:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7146805195) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠BetterJdue on GitHub · 2026-11-24 23:40 UTC · original

Test report after the merge, on native wave64 AMD RDNA2 (the reports above are RDNA3, RDNA4 and NVIDIA): main c4d37be, which has #1745 as 7f7e768.

Tested

  • AMD Radeon RX 6700 (RDNA2, native wave64), driver 32.0.21045.29003; Ryzen 5 3600; 32 GB RAM; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug; clean worktree, own target dir.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 956 passed, 3 failed, 43 ignored. SKIPPED (8): the six per-lane refusals (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32, wave32 and wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows) and pso_measurement_compiles_an_exact_synthetic_record (Developer Mode off). No no wave64 skips.
  • The 3 failures are not from #1745: placed_title_textures_share_vram_and_preserve_pixels ("3D 64x64x64 4 mips: subresource 2 mismatch") also fails alone on main b9b6ea6, before the merge, and the other two fail on the lock it poisons. It is the RDNA2 failure reported fixed by #1028.
  • cargo test -p xcl --lib -- gpu::dxil recomp::lower --test-threads=4: 130 passed, 0 failed, 1 ignored; the same six refusals SKIPPED.
  • Alone, 3 runs each, all passed, no device removal (21 of 21): wave_ops_match_cpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu, the_split_form_agrees_with_the_wave64_lowering_on_the_gpu, a_wave64_mask_left_behind_is_reported_in_both_halves, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, f32_programs_on_the_gpu, the_runtime_path_takes_the_split_form. On this card wave_ops_match_cpu removed the device (0x887A0005, also alone) on 164050e earlier today; it passes now.
  • XCL_ADAPTER=warp cargo test -p xcl --lib -- --test-threads=4: 907 passed, 3 failed, 23 ignored. The 3 failures are the same texture tests; with XCL_ADAPTER=warp that test fails on b9b6ea6 too, so it seems to run on the hardware adapter rather than WARP (inferred, not checked).
  • The same steps on 0570037, before the merge, gave the same picture: 924 passed, 3 failed (the same three), 42 ignored; gpu::dxil + recomp::lower 127 passed, 0 failed; the 21 runs passed.
  • A note on XCL_REQUIRE_GPU=wave64: it turns the six deliberate per-lane refusals into failures (runner.rs:469), so with it gpu::dxil + recomp::lower gives 128 passed, 2 failed. It cannot show here that the wave64 halves ran; that the plain run reports no no wave64 skip does.

Not tested

  • A title run, driver times or XCL_PER_LANE=1 at run time (no game data here).
  • Release build; mesh shaders.

AI use: Claude Code (Claude Opus 5.5) ran these tests on my machine and wrote this report.

AI-assisted verification using synthetic inputs.

**@⁠BetterJdue** on GitHub · 2026-11-24 23:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/1745#issuecomment-7147673200) Test report after the merge, on native wave64 AMD RDNA2 (the reports above are RDNA3, RDNA4 and NVIDIA): `main` `c4d37be`, which has #1745 as `7f7e768`. **Tested** - AMD Radeon RX 6700 (RDNA2, native wave64), driver 32.0.21045.29003; Ryzen 5 3600; 32 GB RAM; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug; clean worktree, own target dir. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 956 passed, 3 failed, 43 ignored. SKIPPED (8): the six per-lane refusals (`V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`, wave32 and wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) and `pso_measurement_compiles_an_exact_synthetic_record` (Developer Mode off). No `no wave64` skips. - The 3 failures are not from #1745: `placed_title_textures_share_vram_and_preserve_pixels` ("3D 64x64x64 4 mips: subresource 2 mismatch") also fails alone on `main` `b9b6ea6`, before the merge, and the other two fail on the lock it poisons. It is the RDNA2 failure reported fixed by #1028. - `cargo test -p xcl --lib -- gpu::dxil recomp::lower --test-threads=4`: 130 passed, 0 failed, 1 ignored; the same six refusals SKIPPED. - Alone, 3 runs each, all passed, no device removal (21 of 21): `wave_ops_match_cpu`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`, `the_split_form_agrees_with_the_wave64_lowering_on_the_gpu`, `a_wave64_mask_left_behind_is_reported_in_both_halves`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `f32_programs_on_the_gpu`, `the_runtime_path_takes_the_split_form`. On this card `wave_ops_match_cpu` removed the device (`0x887A0005`, also alone) on `164050e` earlier today; it passes now. - `XCL_ADAPTER=warp cargo test -p xcl --lib -- --test-threads=4`: 907 passed, 3 failed, 23 ignored. The 3 failures are the same texture tests; with `XCL_ADAPTER=warp` that test fails on `b9b6ea6` too, so it seems to run on the hardware adapter rather than WARP (inferred, not checked). - The same steps on `0570037`, before the merge, gave the same picture: 924 passed, 3 failed (the same three), 42 ignored; `gpu::dxil` + `recomp::lower` 127 passed, 0 failed; the 21 runs passed. - A note on `XCL_REQUIRE_GPU=wave64`: it turns the six deliberate per-lane refusals into failures (`runner.rs:469`), so with it `gpu::dxil` + `recomp::lower` gives 128 passed, 2 failed. It cannot show here that the wave64 halves ran; that the plain run reports no `no wave64` skip does. **Not tested** - A title run, driver times or `XCL_PER_LANE=1` at run time (no game data here). - Release build; mesh shaders. AI use: Claude Code (Claude Opus 5.5) ran these tests on my machine and wrote this report. AI-assisted verification using synthetic inputs.
This discussion has been locked. Commenting is limited to contributors.
No description provided.