Direct DXIL: include pixel shader helper lanes in ballots and VOPC masks #2083

Manually merged
github merged 1 commit from gh-pr/2083/head into gh-pr/2083/base 2026-11-26 05:18:10 +00:00
Owner

@⁠Decodere on GitHub · 2026-11-25 03:31 UTC · original
Decodere:fix-1269-dxil-ps-ballot-helpers → main · +324 −6 · 2 files · 1 commits · merged 2026-11-25 18:24 UTC

What is in it

Brings the direct DXIL translator's pixel-shader masks to parity with the HLSL path's ballot_px, quad_bits, and ballot_px_quad (PR #134 / #105 item 1):

  • Root cause: Lw::ballot (crates/xcl/src/gpu/dxil/lanes.rs) always called plain WaveActiveBallot(cond), even when lowering pixel shaders (self.gfx with ps: Some(_)). Under SM 6.6, WaveActiveBallot excludes helper lanes, whereas Lw::rla already handles pixel-shader helper lanes via quad reads. After s_wqm_b32 / s_wqm_b64, dropping helper-lane bits from compare masks corrupted v_cndmask / s_and_saveexec values read via DPP quad derivatives along triangle edges and prevented v_readfirstlane waterfall loops from removing helper lanes from EXEC (spinning until the loop budget and discarding pixels). Moreover, as established in #134, quad-reading a compare predicate (QuadReadAcross* on a value derived from WaveReadLaneAt) crashes AMD RDNA2/3/4 amdxc64 in CreateGraphicsPipelineState.
  • Fix:
    • crates/xcl/src/gpu/dxil/lanes.rs:
      • Add Lw::ballot_ps_quad(q) to spread a precomputed 4-bit quad mask q across the wave via four WaveActiveBallot passes into bits 4k + p, preserving the wave32-in-wave64 gfx_half select and constant-zero short-circuit.
      • Dispatch pixel-shader Lw::ballot calls (self.gfx.as_ref().is_some_and(|g| g.ps.is_some()), covering non-VOPC masks such as v_add_co_u32 carries) to Lw::ballot_ps, which collects each quad's four bits through QuadReadAcrossX / Y / Diagonal and delegates to ballot_ps_quad. Because setup_pixel runs gfx_common_init before assigning self.gfx, entry EXEC stays live-lanes-only (WaveActiveBallot(true)), matching HLSL PRELUDE_PIXEL.
    • crates/xcl/src/gpu/dxil/lower_valu.rs:
      • Extract vopc_cond and vopc_dst from Lw::vopc / Lw::vopc_write.
      • For plain pixel-shader VOPC instructions (when guard_override is unset and opn != "f"), evaluate each quad member p in 0..4 by quad-reading VGPR source operands with QuadReadLaneAt while leaving wave-uniform sources (SGPRs such as v_readfirstlane outputs, inline constants, literals) untouched, ANDing with lanebit_at(exec_lo, exec_hi, (lane & !3) | p), and passing the 4-bit quad mask to Lw::ballot_ps_quad (zero dx.op.quadOp on compare results).
  • Tests (ps_ballot_tests in crates/xcl/src/gpu/dxil/lanes.rs):
    • direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only: CPU + dxil.dll validation verifying for both wave64 = false and wave64 = true that:
      • the full helper-lane / waterfall-loop PS emits dx.op.quadReadLaneAt.i32 and zero dx.op.quadOp;
      • a standalone V_CMP_LT_F32(0, v2) PS (with no rla callers) emits exactly 4 dx.op.quadReadLaneAt.i32 calls and zero dx.op.quadOp;
      • a trivial entry-EXEC-only PS emits neither dx.op.quadOp nor dx.op.quadReadLaneAt.
    • direct_ps_constant_false_ballot_skips_quad_ops: CPU + dxil.dll validation verifying constant-false V_CMP_F_F32 short-circuits without quad reads.
    • direct_ps_non_vopc_carry_ballot_uses_quad_op: CPU + dxil.dll validation verifying non-VOPC V_ADD_CO_U32 carry masks use ballot_ps (dx.op.quadOp.i32).
    • gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges: CI-WARP-safe (runner::wave64_programs_supported()) GPU draw test on a 32x32 two-triangle diagonal target mirroring recomp::tests::gpu_ps_masks_hold_helper_lanes_on_triangle_edges (s_wqm, v_cndmask + DPP ddx, s_and_saveexec + DPP ddy, and a v_readfirstlane waterfall loop) for both wave64 = true and wave64 = false.

Part of #1269

Tested

  • Hardware / toolchain: Windows 11 (26200), Intel Core i5-11400F, 32 GB RAM, NVIDIA GeForce RTX 4060 8 GB (32-lane waves, driver 621.14), rustc 1.100.0, DXC 1.9.2609.5, release build.
  • Failing-first check (before the fix on cbc296ab):
    • cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1: failed on CPU disassembly check and failed on RTX 4060 GPU draw (wave64 true: 384 pixels wrong (ddx 384, ddy 384, loop 0)).
  • After the fix (targeted, RTX 4060 + WARP):
    • cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1 on RTX 4060: 4 passed, 0 failed, 0 ignored, 0 skipped (0 / 1024 wrong pixels for both wave64 = true and wave64 = false).
    • XCL_ADAPTER="Microsoft Basic Render Driver" cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1: 4 passed, 0 failed (3 CPU validation tests ran; GPU draw test skipped with no GPU).
    • XCL_ADAPTER=warp cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1: 4 passed, 0 failed (3 CPU validation tests ran; GPU draw test skipped with no wave64).
  • Release workspace build & full test suite:
    • cargo build --release --workspace: exit 0.
    • cargo test --release --workspace -- --test-threads=4: 1158 passed, 0 failed, 46 ignored across 21 test binaries, with 25 SKIPPED stderr lines:
      • 20 no wave64 (32-lane RTX 4060 hardware)
      • 3 per-lane form: refused (#1426 unsupported f16/f32 semantics in per-lane wave32 tests)
      • 1 cannot disable the driver cache (Windows Developer Mode is required) (pso_measurement_compiles_an_exact_synthetic_record)
      • 1 no heap windows (heap_window_out_of_memory_falls_back_to_the_switch_form)

Regression run

Paired 60s scripts/smoke.ps1 runs on the same retail title (title: 29640639) and GPU (NVIDIA GeForce RTX 4060):

Base (origin/main, cbc296ab):

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1605 (PresentX 1605)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 14485 MB

This PR (ad281429):

xcl-smoke v1
commit: ad28142970c6be4ec7634ea786b0c1f21d5c8c40
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1616)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14518 MB

No regressions (1615 vs 1605 frames, 14518 MB vs 14485 MB peak commit, 60 60 60 presents per 2 s, 0 device removals, 0 crashes).

Not tested

  • Native 64-lane hardware waves (AMD RDNA2/RDNA3/RDNA4 or Intel GPUs), including the gfx_half upper-half wave32-in-wave64 hardware path and live amdxc64 PSO compilation on AMD hardware (DXIL disassembly verifies zero dx.op.quadOp in VOPC pixel shaders, matching the #134 operand-quad-read shape).
  • Runtime XCL_DIRECT_DXIL=all gameplay smoke (the paired scripts/smoke.ps1 runs used the default translator configuration).

AI use

  • Google Antigravity (Gemini 4 Neon) investigated the direct DXIL pixel-shader ballot and VOPC helper-lane gap, authored the ballot_ps_quad/ballot_ps implementation in lanes.rs, the #134 operand-quad-read VOPC path in lower_valu.rs, and the regression tests, and ran all build, unit, GPU, WARP, and paired smoke checks.
**@⁠Decodere** on GitHub · 2026-11-25 03:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083) `Decodere:fix-1269-dxil-ps-ballot-helpers` → `main` · +324 −6 · 2 files · 1 commits · merged 2026-11-25 18:24 UTC **What is in it** Brings the direct DXIL translator's pixel-shader masks to parity with the HLSL path's `ballot_px`, `quad_bits`, and `ballot_px_quad` (PR #134 / #105 item 1): - **Root cause:** `Lw::ballot` (`crates/xcl/src/gpu/dxil/lanes.rs`) always called plain `WaveActiveBallot(cond)`, even when lowering pixel shaders (`self.gfx` with `ps: Some(_)`). Under SM 6.6, `WaveActiveBallot` excludes helper lanes, whereas `Lw::rla` already handles pixel-shader helper lanes via quad reads. After `s_wqm_b32` / `s_wqm_b64`, dropping helper-lane bits from compare masks corrupted `v_cndmask` / `s_and_saveexec` values read via DPP quad derivatives along triangle edges and prevented `v_readfirstlane` waterfall loops from removing helper lanes from `EXEC` (spinning until the loop budget and discarding pixels). Moreover, as established in #134, quad-reading a compare predicate (`QuadReadAcross*` on a value derived from `WaveReadLaneAt`) crashes AMD RDNA2/3/4 `amdxc64` in `CreateGraphicsPipelineState`. - **Fix:** - `crates/xcl/src/gpu/dxil/lanes.rs`: - Add `Lw::ballot_ps_quad(q)` to spread a precomputed 4-bit quad mask `q` across the wave via four `WaveActiveBallot` passes into bits `4k + p`, preserving the wave32-in-wave64 `gfx_half` select and constant-zero short-circuit. - Dispatch pixel-shader `Lw::ballot` calls (`self.gfx.as_ref().is_some_and(|g| g.ps.is_some())`, covering non-VOPC masks such as `v_add_co_u32` carries) to `Lw::ballot_ps`, which collects each quad's four bits through `QuadReadAcrossX` / `Y` / `Diagonal` and delegates to `ballot_ps_quad`. Because `setup_pixel` runs `gfx_common_init` before assigning `self.gfx`, entry `EXEC` stays live-lanes-only (`WaveActiveBallot(true)`), matching HLSL `PRELUDE_PIXEL`. - `crates/xcl/src/gpu/dxil/lower_valu.rs`: - Extract `vopc_cond` and `vopc_dst` from `Lw::vopc` / `Lw::vopc_write`. - For plain pixel-shader VOPC instructions (when `guard_override` is unset and `opn != "f"`), evaluate each quad member `p in 0..4` by quad-reading VGPR source operands with `QuadReadLaneAt` while leaving wave-uniform sources (SGPRs such as `v_readfirstlane` outputs, inline constants, literals) untouched, ANDing with `lanebit_at(exec_lo, exec_hi, (lane & !3) | p)`, and passing the 4-bit quad mask to `Lw::ballot_ps_quad` (zero `dx.op.quadOp` on compare results). - **Tests (`ps_ballot_tests` in `crates/xcl/src/gpu/dxil/lanes.rs`):** - `direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only`: CPU + `dxil.dll` validation verifying for both `wave64 = false` and `wave64 = true` that: - the full helper-lane / waterfall-loop PS emits `dx.op.quadReadLaneAt.i32` and zero `dx.op.quadOp`; - a standalone `V_CMP_LT_F32(0, v2)` PS (with no `rla` callers) emits exactly 4 `dx.op.quadReadLaneAt.i32` calls and zero `dx.op.quadOp`; - a trivial entry-`EXEC`-only PS emits neither `dx.op.quadOp` nor `dx.op.quadReadLaneAt`. - `direct_ps_constant_false_ballot_skips_quad_ops`: CPU + `dxil.dll` validation verifying constant-false `V_CMP_F_F32` short-circuits without quad reads. - `direct_ps_non_vopc_carry_ballot_uses_quad_op`: CPU + `dxil.dll` validation verifying non-VOPC `V_ADD_CO_U32` carry masks use `ballot_ps` (`dx.op.quadOp.i32`). - `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges`: CI-WARP-safe (`runner::wave64_programs_supported()`) GPU draw test on a 32x32 two-triangle diagonal target mirroring `recomp::tests::gpu_ps_masks_hold_helper_lanes_on_triangle_edges` (`s_wqm`, `v_cndmask` + DPP `ddx`, `s_and_saveexec` + DPP `ddy`, and a `v_readfirstlane` waterfall loop) for both `wave64 = true` and `wave64 = false`. Part of #1269 **Tested** - Hardware / toolchain: Windows 11 (26200), Intel Core i5-11400F, 32 GB RAM, NVIDIA GeForce RTX 4060 8 GB (32-lane waves, driver 621.14), `rustc 1.100.0`, DXC `1.9.2609.5`, release build. - Failing-first check (before the fix on `cbc296ab`): - `cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1`: failed on CPU disassembly check and failed on RTX 4060 GPU draw (`wave64 true: 384 pixels wrong (ddx 384, ddy 384, loop 0)`). - After the fix (targeted, RTX 4060 + WARP): - `cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1` on RTX 4060: **4 passed, 0 failed, 0 ignored, 0 skipped** (0 / 1024 wrong pixels for both `wave64 = true` and `wave64 = false`). - `XCL_ADAPTER="Microsoft Basic Render Driver" cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1`: **4 passed, 0 failed** (3 CPU validation tests ran; GPU draw test skipped with `no GPU`). - `XCL_ADAPTER=warp cargo test --release -p xcl --lib ps_ballot_tests -- --nocapture --test-threads=1`: **4 passed, 0 failed** (3 CPU validation tests ran; GPU draw test skipped with `no wave64`). - Release workspace build & full test suite: - `cargo build --release --workspace`: exit `0`. - `cargo test --release --workspace -- --test-threads=4`: **1158 passed, 0 failed, 46 ignored** across 21 test binaries, with **25 `SKIPPED` stderr lines**: - 20 `no wave64` (32-lane RTX 4060 hardware) - 3 `per-lane form: refused` (`#1426` unsupported f16/f32 semantics in per-lane wave32 tests) - 1 `cannot disable the driver cache (Windows Developer Mode is required)` (`pso_measurement_compiles_an_exact_synthetic_record`) - 1 `no heap windows` (`heap_window_out_of_memory_falls_back_to_the_switch_form`) **Regression run** Paired 60s `scripts/smoke.ps1` runs on the same retail title (`title: 29640639`) and GPU (`NVIDIA GeForce RTX 4060`): Base (`origin/main`, `cbc296ab`): ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1605 (PresentX 1605) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 14485 MB ``` This PR (`ad281429`): ``` xcl-smoke v1 commit: ad28142970c6be4ec7634ea786b0c1f21d5c8c40 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1615 (PresentX 1616) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14518 MB ``` No regressions (`1615` vs `1605` frames, `14518 MB` vs `14485 MB` peak commit, `60 60 60` presents per 2 s, `0` device removals, `0` crashes). **Not tested** - Native 64-lane hardware waves (AMD RDNA2/RDNA3/RDNA4 or Intel GPUs), including the `gfx_half` upper-half wave32-in-wave64 hardware path and live `amdxc64` PSO compilation on AMD hardware (DXIL disassembly verifies zero `dx.op.quadOp` in VOPC pixel shaders, matching the #134 operand-quad-read shape). - Runtime `XCL_DIRECT_DXIL=all` gameplay smoke (the paired `scripts/smoke.ps1` runs used the default translator configuration). **AI use** - Google Antigravity (Gemini 4 Neon) investigated the direct DXIL pixel-shader ballot and VOPC helper-lane gap, authored the `ballot_ps_quad`/`ballot_ps` implementation in `lanes.rs`, the #134 operand-quad-read VOPC path in `lower_valu.rs`, and the regression tests, and ran all build, unit, GPU, WARP, and paired smoke checks.
In `crates/xcl/src/gpu/dxil/lanes.rs`, `Lw::ballot` called plain
`WaveActiveBallot` even in pixel shaders (`self.gfx` with `ps: Some(_)`).
Under SM 6.6, `WaveActiveBallot` excludes helper lanes, whereas `Lw::rla`
already uses quad reads for pixel shader helper lanes and the HLSL path
uses `ballot_px` / `quad_bits` + `ballot_px_quad` (PR #134 / #105 item 1).
After `s_wqm_b32`/`s_wqm_b64`, dropping helper-lane bits from compare
masks corrupted `v_cndmask` / `s_and_saveexec` values read via DPP quad
derivatives and caused `v_readfirstlane` waterfall loops to spin until
the loop budget.

Port both parts of #105 item 1 and #134 to the direct DXIL translator:
- Split `Lw::ballot_ps_quad(q)` out of `Lw::ballot_ps(cond)` in
  `crates/xcl/src/gpu/dxil/lanes.rs`: four `WaveActiveBallot` passes
  spread each quad member's bit `p` from live lanes back to bit `4k + p`,
  preserving the wave32-in-wave64 `gfx_half` select, constant-false
  `(0, 0)` short-circuit, and live-lanes-only entry `EXEC` (`setup_pixel`
  calls `gfx_common_init` before setting `self.gfx`). Non-VOPC PS masks
  (such as `v_add_co_u32` carries) route through `ballot_ps` ->
  `ballot_ps_quad`.
- In `crates/xcl/src/gpu/dxil/lower_valu.rs`, evaluate plain pixel-shader
  VOPC compares per quad member (`p in 0..4`) by quad-reading VGPR source
  operands with `QuadReadLaneAt` (leaving SGPRs such as `v_readfirstlane`
  results and constants wave-uniform) and feeding the 4-bit quad mask to
  `Lw::ballot_ps_quad`, avoiding `QuadReadAcross*` on compare predicates
  that crash AMD RDNA2/3/4 `amdxc64` (#134).

Add CPU/DXIL-validator and CI-WARP-safe GPU draw regression tests in
`lanes.rs` (384/1024 wrong pixels pre-fix on RTX 4060 -> 0/1024 post-fix
for both wave64 and wave32 pixel shaders, with zero `dx.op.quadOp` in
VOPC pixel shaders).

Part of #1269

Assisted-by: Google Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:18:07 +00:00
github manually merged commit ad28142970 into gh-pr/2083/base 2026-11-26 05:18:10 +00:00
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 03:39 UTC · original

XCL PR #2083 fixture verification

Tested ad28142970c6be4ec7634ea786b0c1f21d5c8c40 in the assigned clean, detached checkout on STOR-WINLAB. The live PR was open at that SHA before and after the run. The merged PR discussion timeline had zero entries at intake, and none of the 172 issue #42 comments matched the SHA, PR, or fixture.

Tested

STOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on an AMD Ryzen 7 3800X and Intel Arc A770, driver 32.0.101.9175. Rust was 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), Cargo 1.100.0 (3acc79c0c), and the fixtures logged dxcompiler/dxil 1.9.2609.5 (compiler 01b62ad4) under %LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64.

cargo test --locked -p xcl --lib --no-run exited 0 in 48.17 s. The unoptimized test build used L:/XclTooling/pr1778-2e2ee55-20261125-020159/target, two Cargo jobs, CARGO_INCREMENTAL=0, and CARGO_PROFILE_DEV_DEBUG=CARGO_PROFILE_TEST_DEBUG=0. TEMP and TMP pointed at the run's temp directory.

Ran the resulting xcl-97fdf2b9ff8e1482.exe once per fixture with --exact <fully-qualified-name> --nocapture --test-threads=1. The prefix for every name below is gpu::dxil::lanes::ps_ballot_tests::.

Fixture Time Result
direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only 0.07 s Passed
direct_ps_constant_false_ballot_skips_quad_ops 0.05 s Passed
direct_ps_non_vopc_carry_ballot_uses_quad_op 0.02 s Passed
gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges 1.81 s Passed

Total 4 passed, 0 failed, 0 ignored, 0 skipped. Each invocation exited 0 and reported 1,127 filtered out.

The three CPU fixtures have no optional GPU path and ran with an unmatched XCL_ADAPTER. DXC validated and disassembled eight shader containers. The wave32 and wave64 forms each verified operand quadReadLaneAt and absence of predicate quadOp, exactly four reads in the isolated VOPC shader, and no quad ops in the entry-EXEC-only shader. The wave32 constant-false and carry cases verified absence of quad ops and presence of quadOp.i32, respectively.

The GPU test ran with XCL_ADAPTER=A770 inside & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { ... }, launched using powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -File gpu.ps1. The wrapper logged acquisition and release of the Arc mutex. Both unsplit program forms (wave64=true then wave64=false) submitted a two-triangle draw and read back a 32×32 target. All 1,024 pixels per form passed the fixture's comparisons: absolute ddx and ddy each equal to 1, waterfall count within 1–64 or 1–32 for the respective form, and alpha equal to 1. The forms exercise s_wqm, v_cndmask, s_and_saveexec, DPP derivatives, and v_readfirstlane.

Not tested

Full workspace suite, title or smoke runs, other GPUs and drivers, and the physical hardware wave width chosen for these pixel shaders.

AI use

T3 Code / Codex gpt-6.2-sol ran the checked-in fixtures and wrote this report from the local results and fixture source.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 03:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7152126057) # XCL PR #2083 fixture verification Tested `ad28142970c6be4ec7634ea786b0c1f21d5c8c40` in the assigned clean, detached checkout on STOR-WINLAB. The live PR was open at that SHA before and after the run. The merged PR discussion timeline had zero entries at intake, and none of the 172 issue #42 comments matched the SHA, PR, or fixture. ## Tested STOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on an AMD Ryzen 7 3800X and Intel Arc A770, driver 32.0.101.9175. Rust was 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), Cargo 1.100.0 (3acc79c0c), and the fixtures logged dxcompiler/dxil 1.9.2609.5 (compiler 01b62ad4) under `%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64`. `cargo test --locked -p xcl --lib --no-run` exited 0 in 48.17 s. The unoptimized test build used `L:/XclTooling/pr1778-2e2ee55-20261125-020159/target`, two Cargo jobs, `CARGO_INCREMENTAL=0`, and `CARGO_PROFILE_DEV_DEBUG=CARGO_PROFILE_TEST_DEBUG=0`. TEMP and TMP pointed at the run's `temp` directory. Ran the resulting `xcl-97fdf2b9ff8e1482.exe` once per fixture with `--exact <fully-qualified-name> --nocapture --test-threads=1`. The prefix for every name below is `gpu::dxil::lanes::ps_ballot_tests::`. | Fixture | Time | Result | | --- | ---: | --- | | `direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only` | 0.07 s | Passed | | `direct_ps_constant_false_ballot_skips_quad_ops` | 0.05 s | Passed | | `direct_ps_non_vopc_carry_ballot_uses_quad_op` | 0.02 s | Passed | | `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges` | 1.81 s | Passed | Total **4 passed, 0 failed, 0 ignored, 0 skipped**. Each invocation exited 0 and reported 1,127 filtered out. The three CPU fixtures have no optional GPU path and ran with an unmatched `XCL_ADAPTER`. DXC validated and disassembled eight shader containers. The wave32 and wave64 forms each verified operand `quadReadLaneAt` and absence of predicate `quadOp`, exactly four reads in the isolated VOPC shader, and no quad ops in the entry-EXEC-only shader. The wave32 constant-false and carry cases verified absence of quad ops and presence of `quadOp.i32`, respectively. The GPU test ran with `XCL_ADAPTER=A770` inside `& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { ... }`, launched using `powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -File gpu.ps1`. The wrapper logged acquisition and release of the Arc mutex. Both unsplit program forms (`wave64=true` then `wave64=false`) submitted a two-triangle draw and read back a 32×32 target. All 1,024 pixels per form passed the fixture's comparisons: absolute ddx and ddy each equal to 1, waterfall count within 1–64 or 1–32 for the respective form, and alpha equal to 1. The forms exercise `s_wqm`, `v_cndmask`, `s_and_saveexec`, DPP derivatives, and `v_readfirstlane`. ## Not tested Full workspace suite, title or smoke runs, other GPUs and drivers, and the physical hardware wave width chosen for these pixel shaders. ## AI use T3 Code / Codex gpt-6.2-sol ran the checked-in fixtures and wrote this report from the local results and fixture source.
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 03:52 UTC · original

Native 64-lane AMD run with live amdxc64 PSO compilation, which this PR lists as not tested (the other report here is Arc).

Tested: pass, head ad28142 applied on its base main cbc296a, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. cargo test -p xcl --lib -- gpu:: --test-threads=4:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: 588 passed, 2 failed, 22 ignored. gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges ok, so the pixel shader compiled and ran through the AMD driver. The 2 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and _3, the same as on main cbc296a without this PR on this card.
  • NVIDIA RTX 3060, driver 32.0.16.1088: 590 passed, 0 failed, 22 ignored. Same test ok.

Not tested: the gfx_half wave32-in-wave64 path specifically; RDNA2/3.

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

**@⁠DarkPanda69** on GitHub · 2026-11-25 03:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7152326645) Native 64-lane AMD run with live `amdxc64` PSO compilation, which this PR lists as not tested (the other report here is Arc). **Tested:** pass, head `ad28142` applied on its base `main` `cbc296a`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. `cargo test -p xcl --lib -- gpu:: --test-threads=4`: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, waves 32..64: 588 passed, 2 failed, 22 ignored. `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges` ok, so the pixel shader compiled and ran through the AMD driver. The 2 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `_3`, the same as on `main` `cbc296a` without this PR on this card. - NVIDIA RTX 3060, driver 32.0.16.1088: 590 passed, 0 failed, 22 ignored. Same test ok. **Not tested:** the `gfx_half` wave32-in-wave64 path specifically; RDNA2/3. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠WebIdentity1 on GitHub · 2026-11-25 04:32 UTC · original

I’m checking one remaining AMD compiler shape: a pixel-shader waterfall loop whose V_ADD_CO_U32 carry depends on V_READFIRSTLANE, then feeds EXEC. The current GPU fixture covers VOPC predicates; the non-VOPC carry fixture validates/disassembles but does not draw. I’ll use a synthetic triangle-edge oracle on our AMD iGPU and RTX3090, preserving exact revisions and distinguishing compiler failures from output differences. This is an investigation, not yet a confirmed bug. AI assistance: Codex (GPT-6).

**@⁠WebIdentity1** on GitHub · 2026-11-25 04:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7152933861) I’m checking one remaining AMD compiler shape: a pixel-shader waterfall loop whose V_ADD_CO_U32 carry depends on V_READFIRSTLANE, then feeds EXEC. The current GPU fixture covers VOPC predicates; the non-VOPC carry fixture validates/disassembles but does not draw. I’ll use a synthetic triangle-edge oracle on our AMD iGPU and RTX3090, preserving exact revisions and distinguishing compiler failures from output differences. This is an investigation, not yet a confirmed bug. AI assistance: Codex (GPT-6).
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-25 05:22 UTC · original

A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 4 new tests pass, none skipped.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. ad28142 as it is (merge base with main cbc296a), no uncommitted changes. The lib test binary runs under Wine, one test per process.
    • direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only: ok
    • direct_ps_constant_false_ballot_skips_quad_ops: ok
    • direct_ps_non_vopc_carry_ballot_uses_quad_op: ok
    • gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges: ok

Not tested

  • the whole suite on this head, a retail title, native Windows, AMD.

AI use

  • Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-25 05:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7153704447) A run with vkd3d-proton as the host D3D12. The DXIL goes through dxil-spirv and then the NVIDIA Vulkan driver, not the native-Windows path: this PR's 4 new tests pass, none skipped. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `ad28142` as it is (merge base with `main` `cbc296a`), no uncommitted changes. The lib test binary runs under Wine, one test per process. - `direct_ps_ballot_uses_quad_ops_and_keeps_entry_exec_live_only`: ok - `direct_ps_constant_false_ballot_skips_quad_ops`: ok - `direct_ps_non_vopc_carry_ballot_uses_quad_op`: ok - `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges`: ok **Not tested** - the whole suite on this head, a retail title, native Windows, AMD. **AI use** - Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 05:26 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 05:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7153783847) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠MarcosMDev on GitHub · 2026-11-25 12:53 UTC · original

Test report: ad28142 against its base cbc296a, RTX 4060 8 GB (Windows): GPU tests, and what the new ballots cost in the driver on retail pixel shaders. Counts and timings only.

Tests, XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu:: -- --test-threads=4, debug: head 589 passed, 1 failed, 22 ignored; base 585 passed, 1 failed, 22 ignored. The failure is gpu_image_get_resinfo_1d_array on both, so it is not from this PR.

Driver time. 24 distinct retail 1.0.2.1 PS programs, 8 per size at even spacing, direct DXIL, 4 windows. One CreateGraphicsPipelineState per program with a small generated VS with the PS's inputs. Order base, head, head, base; the table has both runs, as sums of 8 programs.

form RDNA2 code DXIL driver, base driver, head change slower
switch windows 4–12 KB +42 % 4.69 / 4.62 s 6.59 / 6.24 s +38 % 8 of 8
switch windows 12–24 KB +57 % 18.31 / 17.49 s 25.31 / 23.75 s +37 % 8 of 8
switch windows 24–57 KB +42 % 37.45 / 34.08 s 47.53 / 44.32 s +28 % 8 of 8
heap windows 4–12 KB +49 % 2.70 / 2.69 s 4.26 / 4.12 s +56 % 8 of 8
heap windows 12–24 KB +66 % 8.42 / 8.27 s 15.66 / 14.58 s +81 % 8 of 8
heap windows 24–57 KB +49 % 17.60 / 16.06 s 27.62 / 25.24 s +57 % 8 of 8

This is a cost, not an argument against the fix: the base's masks drop helper lanes. It may be worth finding masks that are only ever read by their own lane, which need no ballot across the wave (as x64_whole_live does for the split form). I have not tried that on this branch.

Cold: a new exe basename per run; the second call for the same pipeline took 56 ms at most. NVIDIA's caches were not cleared, there was no ETW proof.

RTX 4060 (32.0.16.2101), Ryzen 7 5700X, 24 GB, Windows 11 26200, DXC 1.9.2609, rustc 1.100.0; timings release. Not tested: images or the title, the branch on today's main, real VS / blend state, GPU time, the HLSL path on this sample, AMD.

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

**@⁠MarcosMDev** on GitHub · 2026-11-25 12:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7162988247) **Test report: `ad28142` against its base `cbc296a`, RTX 4060 8 GB (Windows): GPU tests, and what the new ballots cost in the driver on retail pixel shaders.** Counts and timings only. **Tests**, `XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu:: -- --test-threads=4`, debug: head 589 passed, 1 failed, 22 ignored; base 585 passed, 1 failed, 22 ignored. The failure is `gpu_image_get_resinfo_1d_array` on both, so it is not from this PR. **Driver time.** 24 distinct retail 1.0.2.1 PS programs, 8 per size at even spacing, direct DXIL, 4 windows. One `CreateGraphicsPipelineState` per program with a small generated VS with the PS's inputs. Order base, head, head, base; the table has both runs, as sums of 8 programs. | form | RDNA2 code | DXIL | driver, base | driver, head | change | slower | |---|---|---:|---|---|---:|---:| | switch windows | 4–12 KB | +42 % | 4.69 / 4.62 s | 6.59 / 6.24 s | +38 % | 8 of 8 | | switch windows | 12–24 KB | +57 % | 18.31 / 17.49 s | 25.31 / 23.75 s | +37 % | 8 of 8 | | switch windows | 24–57 KB | +42 % | 37.45 / 34.08 s | 47.53 / 44.32 s | +28 % | 8 of 8 | | heap windows | 4–12 KB | +49 % | 2.70 / 2.69 s | 4.26 / 4.12 s | +56 % | 8 of 8 | | heap windows | 12–24 KB | +66 % | 8.42 / 8.27 s | 15.66 / 14.58 s | +81 % | 8 of 8 | | heap windows | 24–57 KB | +49 % | 17.60 / 16.06 s | 27.62 / 25.24 s | +57 % | 8 of 8 | This is a cost, not an argument against the fix: the base's masks drop helper lanes. It may be worth finding masks that are only ever read by their own lane, which need no ballot across the wave (as `x64_whole_live` does for the split form). I have not tried that on this branch. **Cold:** a new exe basename per run; the second call for the same pipeline took 56 ms at most. NVIDIA's caches were not cleared, there was no ETW proof. RTX 4060 (32.0.16.2101), Ryzen 7 5700X, 24 GB, Windows 11 26200, DXC 1.9.2609, rustc 1.100.0; timings release. **Not tested:** images or the title, the branch on today's `main`, real VS / blend state, GPU time, the HLSL path on this sample, AMD. AI use: Claude Code (Claude Opus 5.5) ran the measurements and wrote this.
Author
Owner

@⁠MarcosMDev on GitHub · 2026-11-25 13:31 UTC · original

@⁠Decodere, a follow-up to my cost report: I tried the idea at its end on ad28142. It is the direct form of what the HLSL path already does with ballot_px_local. I'm not opening a PR; it is yours if you want it.

What: whole_live (x64_masks::by_pc) is computed for pixel shaders too, and a mask that is not whole-live there is written as the lane's own bit, cond << lane31 in the word of its half, instead of ballot_ps or the VOPC quad reads. No wave or quad op. Helper lanes get their own condition. ballot_px_local also ORs in the WaveActiveBallot; this leaves that out, since only the own bit is read. About 40 changed lines in kernel.rs, lower.rs and lower_valu.rs.

Driver time, RTX 4060, direct DXIL, 21 retail 1.0.2.1 PS programs (7 per size), same harness as before, sums over 7. "Unfixed" is ad28142 with plain WaveActiveBallot, for scale.

form RDNA2 code ad28142 with local masks unfixed
switch 4–12 KB 4.95 s 4.39 s (−11 %) 3.74 s
switch 12–24 KB 21.27 s 22.20 s (+4 %) 17.95 s
switch 24–57 KB 42.16 s 37.93 s (−10 %) 30.96 s
heap 4–12 KB 3.48 s 3.04 s (−12 %) 2.39 s
heap 12–24 KB 11.85 s 11.48 s (−3 %) 8.07 s
heap 24–57 KB 23.81 s 20.71 s (−13 %) 14.62 s

DXIL −10 to −14 %. 18 of 21 programs were faster with the switch, 19 of 21 with the heap. In the middle size, 2 of 7 were slower in both forms; I did not look into them. So it gives back about a third of the added cost in the other sizes. The rest are masks that really are read whole (s_and_saveexec and the like).

Tests, XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu:: -- --test-threads=4: 587 passed, 3 failed, 22 ignored. gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges passes. Failed: gpu_image_get_resinfo_1d_array, as on your base, and two of this PR's structure tests (direct_ps_ballot_uses_quad_ops_..., direct_ps_non_vopc_carry_ballot_uses_quad_op): they expect quad ops for a mask only v_cndmask reads, which is what this removes. They would need a program that reads the mask whole.

1 run per form; new exe basename per run, second call 9 ms at most; NVIDIA caches not cleared, no ETW. RTX 4060 (32.0.16.2101), Windows 11 26200, DXC 1.9.2609. Not tested: AMD (the #134 crash), images or the title, today's main, GPU time.

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

**@⁠MarcosMDev** on GitHub · 2026-11-25 13:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7163912070) @⁠Decodere, a follow-up to my [cost report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2083): I tried the idea at its end on `ad28142`. It is the direct form of what the HLSL path already does with `ballot_px_local`. I'm not opening a PR; it is yours if you want it. **What:** `whole_live` (`x64_masks::by_pc`) is computed for pixel shaders too, and a mask that is not whole-live there is written as the lane's own bit, `cond << lane31` in the word of its half, instead of `ballot_ps` or the VOPC quad reads. No wave or quad op. Helper lanes get their own condition. `ballot_px_local` also ORs in the `WaveActiveBallot`; this leaves that out, since only the own bit is read. About 40 changed lines in `kernel.rs`, `lower.rs` and `lower_valu.rs`. **Driver time**, RTX 4060, direct DXIL, 21 retail 1.0.2.1 PS programs (7 per size), same harness as before, sums over 7. "Unfixed" is `ad28142` with plain `WaveActiveBallot`, for scale. | form | RDNA2 code | `ad28142` | with local masks | unfixed | |---|---|---:|---:|---:| | switch | 4–12 KB | 4.95 s | 4.39 s (−11 %) | 3.74 s | | switch | 12–24 KB | 21.27 s | 22.20 s (+4 %) | 17.95 s | | switch | 24–57 KB | 42.16 s | 37.93 s (−10 %) | 30.96 s | | heap | 4–12 KB | 3.48 s | 3.04 s (−12 %) | 2.39 s | | heap | 12–24 KB | 11.85 s | 11.48 s (−3 %) | 8.07 s | | heap | 24–57 KB | 23.81 s | 20.71 s (−13 %) | 14.62 s | DXIL −10 to −14 %. 18 of 21 programs were faster with the switch, 19 of 21 with the heap. In the middle size, 2 of 7 were slower in both forms; I did not look into them. So it gives back about a third of the added cost in the other sizes. The rest are masks that really are read whole (`s_and_saveexec` and the like). **Tests**, `XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu:: -- --test-threads=4`: 587 passed, 3 failed, 22 ignored. `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges` passes. Failed: `gpu_image_get_resinfo_1d_array`, as on your base, and two of this PR's structure tests (`direct_ps_ballot_uses_quad_ops_...`, `direct_ps_non_vopc_carry_ballot_uses_quad_op`): they expect quad ops for a mask only `v_cndmask` reads, which is what this removes. They would need a program that reads the mask whole. 1 run per form; new exe basename per run, second call 9 ms at most; NVIDIA caches not cleared, no ETW. RTX 4060 (32.0.16.2101), Windows 11 26200, DXC 1.9.2609. **Not tested:** AMD (the #134 crash), images or the title, today's `main`, GPU time. AI use: Claude Code (Claude Opus 5.5) wrote the change, ran the measurements and wrote this.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 17:20 UTC · original

NVIDIA test report for ad28142 (head as is, base cbc296a), for #1607's NVIDIA list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after cargo build --workspace:

  • cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 1149 passed, 0 failed, 46 ignored. The end-to-end title tests pass.
  • main 0829441 on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests).
  • Skipped hle::xaudio2, because its tests fail or hang on this machine on main too. The PR doesn't touch it.
  • SKIPPED lines: 25: 20 no wave64 on this card, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, and 1 PSO measurement that needs Developer Mode to turn the driver cache off.

AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.

**@⁠upipibi** on GitHub · 2026-11-25 17:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/2083#issuecomment-7169365208) NVIDIA test report for `ad28142` (head as is, base `cbc296a`), for #1607's NVIDIA list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after `cargo build --workspace`: - `cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2`: **1149 passed, 0 failed, 46 ignored**. The end-to-end title tests pass. - `main` `0829441` on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests). - Skipped `hle::xaudio2`, because its tests fail or hang on this machine on `main` too. The PR doesn't touch it. - SKIPPED lines: 25: 20 `no wave64` on this card, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, and 1 PSO measurement that needs Developer Mode to turn the driver cache off. AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
This discussion has been locked. Commenting is limited to contributors.
No description provided.