Recompiler: guard NULL (125) dests and bridged lane_mask inputs in per-lane lowering #2107

Open
Decodere wants to merge 1 commit from upstream-pr/2117 into main
Decodere commented 2026-11-25 04:59:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T04:59:58Z.


What is in it

Fixes two correctness bugs in the per-lane lowering (crates/xcl/src/gpu/recomp/lower.rs) and lane-mask analysis (crates/xcl/src/gpu/recomp/lane_masks.rs):

  1. NULL (125) destination & source handling (recomp/lower.rs, recomp/lane_masks.rs):
    • Lower::write_num and Lower::write_bit lacked an early return on r == 125. In wave64, mask writes to null (such as S_AND_B64 null, exec, vcc, S_WQM_B64 null, exec, S_CSELECT_B64 null, ..., and VOP3 V_CMP_* null, ...) wrote num_marker/bit_marker to r + 1 = 126 (destroying EXEC), and 64-bit scalar / multi-dword SMEM writes (S_GETPC_B64, S_MOV_B64, S_CSELECT_B64, S_LOAD_DWORD*) wrote sd + 1 = 126. Added if r == 125 { return; } to write_num and write_bit, guarded the 64-bit scalar and SMEM write sites with != 125, and excluded 125 in reads_mask and cmp64.
    • In lane_masks.rs, mapped 125 (null) to Some(FALSE) in mask_src, avoided pushing 125 into set (st.regs[125]) on V_CMP_*, saveexec/wrexec, and SALU mask ops while preserving SCC tracking (scc = Some((v, SccKind::Any))) for non-MOV/CSELECT mask ops to null, and excluded 125 when detecting tracked mask sources.
  2. Bridged lane_mask input clobbering (recomp/lower.rs::bridge):
    • bridge() pushed (Var::S(m), ...) and (Var::S(m + 1), ...) unconditionally after the whole SGPR loop, overwriting live scalar operands already placed in inputs (for example, wave32 V_ADD_CO_CI_U32 v2, vcc_lo, s1, v1, s0 clobbered s1 with 0; SRC0 == SRC2 clobbered the scalar addend with 1 << lane; and m == 127 pushed out-of-range Var::S(128)).
    • Guarded lane_mask pushes so (Var::S(r), val) is only pushed when r < 128 and Var::S(r) is not already in inputs (in wave32 dxil::Lw::lane_of ignores hi, and a scalar register already present as a number in inputs already holds its true mask bit for every lane).
  3. Tests (lane_masks.rs, lower.rs):
    • lane_masks::tests::null_dest_and_source_in_lane_masks: verifies S_AND_SAVEEXEC_B64 null, vcc + S_OR_B64 s[0:1], null, vcc reads FALSE for null (keeping MOV2 guarded) and S_AND_B64 null, exec, vcc / null still tracks mask SCC.
    • lower::tests::null_dest_preserves_exec_and_scc: CPU Interp test covering wave64 S_AND_B64, VOP3 V_CMP_EQ_U32, S_MOV_B64, S_CSELECT_B64, and S_GETPC_B64 to null (125), verifying EXEC and SCC.
    • lower::tests::bridged_wave32_carry_preserves_scalar_operands_in_dxil: CPU + dxil.dll validation test checking lower_dxil::kernel preserves s1=42 (SRC0 adjacent to SRC2=s0) and s4=5 (SRC0 == SRC2) in the generated DXIL.
    • lower::tests::gpu_null_dest_and_bridged_carry_agree_with_hlsl: CI-WARP-safe (gpu_waves() + dxc::location()) GPU parity test verifying wave32 bridged V_ADD_CO_CI_U32 (lower_dxil::kernel) and wave64 split NULL dests (lower_dxil::kernel_split) match HLSL on the GPU.

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 fixes on 6987e496):
    • CPU tests: 0 passed, 3 failed:
      • null_dest_and_source_in_lane_masks failed (left: [], right: [16] — null read stale st.regs[125]).
      • null_dest_preserves_exec_and_scc failed (s126: a mask read as a number — write_bit(125) clobbered EXEC).
      • bridged_wave32_carry_preserves_scalar_operands_in_dxil failed (adjacent scalar operand s1=42 must not be clobbered by lane_mask).
    • GPU test on RTX 4060: gpu_null_dest_and_bridged_carry_agree_with_hlsl failed (lane 0: v2 (s1 + v0 + cin): left: 0, right: 43).
  • After the fix (targeted, RTX 4060 + WARP):
    • RTX 4060 (null_dest_and_source_in_lane_masks, null_dest_preserves_exec_and_scc, bridged_wave32_carry_preserves_scalar_operands_in_dxil, gpu_null_dest_and_bridged_carry_agree_with_hlsl): 4 passed, 0 failed, 0 ignored, 0 skipped.
    • WARP (XCL_ADAPTER="Microsoft Basic Render Driver" and XCL_ADAPTER=warp): 4 passed, 0 failed (all 3 CPU tests pass; GPU test skips cleanly with no GPU with 32-lane waves).
  • 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, 6987e496):

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

This PR (d758ce8b):

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

No regressions (1602 vs 1590 frames, 14471 MB vs 14516 MB peak commit, 60 61 60 presents per 2 s, 0 device removals, 0 crashes).

Not tested

  • Native 64-lane hardware waves (AMD / Intel GPUs); wave64 GPU parity was verified on RTX 4060 via lower_dxil::kernel_split, and wave64 per-lane semantics were verified on the CPU via Interp.

AI use

  • Google Antigravity (Gemini 4 Neon) investigated the NULL (125) destination/source and bridged lane_mask input-clobbering bugs in recomp/lower.rs and recomp/lane_masks.rs, authored the fixes and CPU/GPU regression tests, and ran all build, unit, GPU, WARP, workspace, and paired smoke checks.
<!-- greyfinch-sync:ivall/xcl:issue:5485466855 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-25T04:59:58Z. --- **What is in it** Fixes two correctness bugs in the per-lane lowering (`crates/xcl/src/gpu/recomp/lower.rs`) and lane-mask analysis (`crates/xcl/src/gpu/recomp/lane_masks.rs`): 1. **`NULL` (`125`) destination & source handling (`recomp/lower.rs`, `recomp/lane_masks.rs`):** - `Lower::write_num` and `Lower::write_bit` lacked an early return on `r == 125`. In wave64, mask writes to `null` (such as `S_AND_B64 null, exec, vcc`, `S_WQM_B64 null, exec`, `S_CSELECT_B64 null, ...`, and VOP3 `V_CMP_* null, ...`) wrote `num_marker`/`bit_marker` to `r + 1 = 126` (destroying `EXEC`), and 64-bit scalar / multi-dword SMEM writes (`S_GETPC_B64`, `S_MOV_B64`, `S_CSELECT_B64`, `S_LOAD_DWORD*`) wrote `sd + 1 = 126`. Added `if r == 125 { return; }` to `write_num` and `write_bit`, guarded the 64-bit scalar and SMEM write sites with `!= 125`, and excluded `125` in `reads_mask` and `cmp64`. - In `lane_masks.rs`, mapped `125` (`null`) to `Some(FALSE)` in `mask_src`, avoided pushing `125` into `set` (`st.regs[125]`) on `V_CMP_*`, `saveexec`/`wrexec`, and SALU mask ops while preserving `SCC` tracking (`scc = Some((v, SccKind::Any))`) for non-`MOV`/`CSELECT` mask ops to `null`, and excluded `125` when detecting tracked mask sources. 2. **Bridged `lane_mask` input clobbering (`recomp/lower.rs::bridge`):** - `bridge()` pushed `(Var::S(m), ...)` and `(Var::S(m + 1), ...)` unconditionally after the `whole` SGPR loop, overwriting live scalar operands already placed in `inputs` (for example, wave32 `V_ADD_CO_CI_U32 v2, vcc_lo, s1, v1, s0` clobbered `s1` with `0`; `SRC0 == SRC2` clobbered the scalar addend with `1 << lane`; and `m == 127` pushed out-of-range `Var::S(128)`). - Guarded `lane_mask` pushes so `(Var::S(r), val)` is only pushed when `r < 128` and `Var::S(r)` is not already in `inputs` (in wave32 `dxil::Lw::lane_of` ignores `hi`, and a scalar register already present as a number in `inputs` already holds its true mask bit for every lane). 3. **Tests (`lane_masks.rs`, `lower.rs`):** - `lane_masks::tests::null_dest_and_source_in_lane_masks`: verifies `S_AND_SAVEEXEC_B64 null, vcc` + `S_OR_B64 s[0:1], null, vcc` reads `FALSE` for `null` (keeping `MOV2` guarded) and `S_AND_B64 null, exec, vcc` / `null` still tracks mask `SCC`. - `lower::tests::null_dest_preserves_exec_and_scc`: CPU `Interp` test covering wave64 `S_AND_B64`, VOP3 `V_CMP_EQ_U32`, `S_MOV_B64`, `S_CSELECT_B64`, and `S_GETPC_B64` to `null` (`125`), verifying `EXEC` and `SCC`. - `lower::tests::bridged_wave32_carry_preserves_scalar_operands_in_dxil`: CPU + `dxil.dll` validation test checking `lower_dxil::kernel` preserves `s1=42` (`SRC0` adjacent to `SRC2=s0`) and `s4=5` (`SRC0 == SRC2`) in the generated DXIL. - `lower::tests::gpu_null_dest_and_bridged_carry_agree_with_hlsl`: CI-WARP-safe (`gpu_waves()` + `dxc::location()`) GPU parity test verifying wave32 bridged `V_ADD_CO_CI_U32` (`lower_dxil::kernel`) and wave64 split `NULL` dests (`lower_dxil::kernel_split`) match HLSL on the GPU. 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 fixes on `6987e496`): - CPU tests: **0 passed, 3 failed**: - `null_dest_and_source_in_lane_masks` failed (`left: [], right: [16]` — `null` read stale `st.regs[125]`). - `null_dest_preserves_exec_and_scc` failed (`s126: a mask read as a number` — `write_bit(125)` clobbered `EXEC`). - `bridged_wave32_carry_preserves_scalar_operands_in_dxil` failed (`adjacent scalar operand s1=42 must not be clobbered by lane_mask`). - GPU test on RTX 4060: `gpu_null_dest_and_bridged_carry_agree_with_hlsl` failed (`lane 0: v2 (s1 + v0 + cin): left: 0, right: 43`). - After the fix (targeted, RTX 4060 + WARP): - RTX 4060 (`null_dest_and_source_in_lane_masks`, `null_dest_preserves_exec_and_scc`, `bridged_wave32_carry_preserves_scalar_operands_in_dxil`, `gpu_null_dest_and_bridged_carry_agree_with_hlsl`): **4 passed, 0 failed, 0 ignored, 0 skipped**. - WARP (`XCL_ADAPTER="Microsoft Basic Render Driver"` and `XCL_ADAPTER=warp`): **4 passed, 0 failed** (all 3 CPU tests pass; GPU test skips cleanly with `no GPU with 32-lane waves`). - 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`, `6987e496`): ``` xcl-smoke v1 commit: 6987e496c35653f9ccc9dbdc1f1d342734306811 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1590 (PresentX 1590) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14516 MB ``` This PR (`d758ce8b`): ``` xcl-smoke v1 commit: d758ce8b2cf1a2f1f961c316b8a76a7d1206572a gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1602 (PresentX 1602) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14471 MB ``` No regressions (`1602` vs `1590` frames, `14471 MB` vs `14516 MB` peak commit, `60 61 60` presents per 2 s, `0` device removals, `0` crashes). **Not tested** - Native 64-lane hardware waves (AMD / Intel GPUs); wave64 GPU parity was verified on RTX 4060 via `lower_dxil::kernel_split`, and wave64 per-lane semantics were verified on the CPU via `Interp`. **AI use** - Google Antigravity (Gemini 4 Neon) investigated the `NULL` (`125`) destination/source and bridged `lane_mask` input-clobbering bugs in `recomp/lower.rs` and `recomp/lane_masks.rs`, authored the fixes and CPU/GPU regression tests, and ran all build, unit, GPU, WARP, workspace, and paired smoke checks.
DarkPanda69 commented 2026-11-25 06:05:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T05:24:21Z.


Tested: gpu_null_dest_and_bridged_carry_agree_with_hlsl passes on an AMD D3D12 driver and on an RTX 3060.

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010): ok. Whole gpu:: filter: 588 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way on main.
  • RTX 3060 (driver 32.0.16.1088): ok. 590 passed, 0 failed, 22 ignored.

Head d758ce8 applied on main 6020a33, cargo test -p xcl --lib -- gpu:: --test-threads=4 with XCL_ADAPTER set to each card.
The new test runs its wave32 case and the split form of its wave64 case (kernel_split, split_wave64: true), so even on the 9070 XT it does not run the NULL-dest case in native 64-lane waves. This is an AMD driver result, not the native wave64 check the PR lists as untested.
Not tested: native wave64 per-lane, retail runs.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7153737921 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7153737921). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-25T05:24:21Z. --- Tested: `gpu_null_dest_and_bridged_carry_agree_with_hlsl` passes on an AMD D3D12 driver and on an RTX 3060. - RX 9070 XT (RDNA4, driver 32.0.32029.2010): ok. Whole `gpu::` filter: 588 passed, 2 failed, 22 ignored. The 2 failures are the AMD fuzz seeds 722 and 1599 tracked in #2115, which fail the same way on `main`. - RTX 3060 (driver 32.0.16.1088): ok. 590 passed, 0 failed, 22 ignored. Head `d758ce8` applied on `main` `6020a33`, `cargo test -p xcl --lib -- gpu:: --test-threads=4` with `XCL_ADAPTER` set to each card. The new test runs its wave32 case and the split form of its wave64 case (`kernel_split`, `split_wave64: true`), so even on the 9070 XT it does not run the NULL-dest case in native 64-lane waves. This is an AMD driver result, not the native wave64 check the PR lists as untested. Not tested: native wave64 per-lane, retail runs. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
futurepro62 commented 2026-11-25 06:05:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T05:18:36Z.


Full-suite run, since this PR has no test report yet. Tested exact head d758ce8 (on its base 6987e49).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1146 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: null_dest_and_source_in_lane_masks, bridged_wave32_carry_preserves_scalar_operands_in_dxil, null_dest_preserves_exec_and_scc, gpu_null_dest_and_bridged_carry_agree_with_hlsl.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1157 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 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))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 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))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 6020a33 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7153647101 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7153647101). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T05:18:36Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `d758ce8` (on its base `6987e49`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **1146 passed, 0 failed, 44 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `null_dest_and_source_in_lane_masks`, `bridged_wave32_carry_preserves_scalar_operands_in_dxil`, `null_dest_preserves_exec_and_scc`, `gpu_null_dest_and_bridged_carry_agree_with_hlsl`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **1157 passed, 0 failed, 46 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `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))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `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))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `6020a33` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests, `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` and `mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://github.com/xcl-dev/xcl/issues/1651#issuecomment-7146069648)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
JoaoPauluu commented 2026-11-25 07:05:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T06:12:04Z.


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. d758ce8 as it is (merge base with main 6987e49), no uncommitted changes. The lib test binary runs under Wine, one test per process.
    • null_dest_and_source_in_lane_masks: ok
    • bridged_wave32_carry_preserves_scalar_operands_in_dxil: ok
    • gpu_null_dest_and_bridged_carry_agree_with_hlsl: ok
    • null_dest_preserves_exec_and_scc: 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.
<!-- greyfinch-sync:ivall/xcl:comment:7154545823 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7154545823). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-25T06:12:04Z. --- 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`. `d758ce8` as it is (merge base with `main` `6987e49`), no uncommitted changes. The lib test binary runs under Wine, one test per process. - `null_dest_and_source_in_lane_masks`: ok - `bridged_wave32_carry_preserves_scalar_operands_in_dxil`: ok - `gpu_null_dest_and_bridged_carry_agree_with_hlsl`: ok - `null_dest_preserves_exec_and_scc`: 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.
DavidM1911 commented 2026-11-25 07:05:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:17:41Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7154642493 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7154642493). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T06:17:41Z. --- 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!
throny commented 2026-11-28 14:56:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T14:56:59Z.


merge-check claim
head: d758ce8b2c

<!-- greyfinch-sync:ivall/xcl:comment:7241062457 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7241062457). Originally posted by [throny](https://github.com/throny) on 2026-11-28T14:56:59Z. --- merge-check claim head: d758ce8b2cf1a2f1f961c316b8a76a7d1206572a
throny commented 2026-11-28 15:17:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T15:17:06Z.


merge-check
base: 309c3ec5
head: d758ce8b2c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2145 passed, 1 failed, 48 ignored (26 SKIPPED lines). Base alone at 309c3ec5: 2142 passed, 0 failed, 48 ignored. The failure is one of this PR's own new tests, gpu::recomp::lower::tests::bridged_wave32_carry_preserves_scalar_operands_in_dxil ("adjacent scalar operand s1=42 must not be clobbered by lane_mask"). Rerun alone: it fails twice on the merge result and passes on this PR's head d758ce8b without main (merge base 6987e496). It is a CPU-only test of the generated DXIL text, so this is not about the GPU here.
review: the code reads as correct and the merge itself is clean (main renamed a helper next to one of the PR's lines; the three-way merge keeps main's name). The real fix, writers of a 64-bit value with the null register as destination no longer touching the register after it, is not on main yet; parts of the rest are (main already reads register 125 as false and skips it in two paths). The blocking point is only the test above: on current main either the test's expectation or the code path it checks no longer fits what main generates, and that needs the author's look after a rebase. Minor: a few guards are now redundant with the new early return.
performance: no runtime cost. It changes per-lane translator sources only: testers who use the per-lane path re-translate those entries once.
verdict: not yet: rebase onto main and make the PR's own test bridged_wave32_carry_preserves_scalar_operands_in_dxil pass there; I will re-check the new head.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7241348471 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7241348471). Originally posted by [throny](https://github.com/throny) on 2026-11-28T15:17:06Z. --- merge-check base: 309c3ec5 head: d758ce8b2cf1a2f1f961c316b8a76a7d1206572a merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2145 passed, 1 failed, 48 ignored (26 SKIPPED lines). Base alone at 309c3ec5: 2142 passed, 0 failed, 48 ignored. The failure is one of this PR's own new tests, gpu::recomp::lower::tests::bridged_wave32_carry_preserves_scalar_operands_in_dxil ("adjacent scalar operand s1=42 must not be clobbered by lane_mask"). Rerun alone: it fails twice on the merge result and passes on this PR's head d758ce8b without main (merge base 6987e496). It is a CPU-only test of the generated DXIL text, so this is not about the GPU here. review: the code reads as correct and the merge itself is clean (main renamed a helper next to one of the PR's lines; the three-way merge keeps main's name). The real fix, writers of a 64-bit value with the null register as destination no longer touching the register after it, is not on main yet; parts of the rest are (main already reads register 125 as false and skips it in two paths). The blocking point is only the test above: on current main either the test's expectation or the code path it checks no longer fits what main generates, and that needs the author's look after a rebase. Minor: a few guards are now redundant with the new early return. performance: no runtime cost. It changes per-lane translator sources only: testers who use the per-lane path re-translate those entries once. verdict: not yet: rebase onto main and make the PR's own test bridged_wave32_carry_preserves_scalar_operands_in_dxil pass there; I will re-check the new head. hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
jsalzy commented 2026-11-30 01:57:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-11-30T01:57:41Z.


merge-check claim
head: d758ce8b2c

<!-- greyfinch-sync:ivall/xcl:comment:7266586819 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7266586819). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-11-30T01:57:41Z. --- merge-check claim head: d758ce8b2cf1a2f1f961c316b8a76a7d1206572a
jsalzy commented 2026-11-30 02:12:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by jsalzy on 2026-11-30T02:12:47Z.


merge-check
base: 9335bc0d86
head: d758ce8b2c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2804 passed, 2 failed, 50 ignored; SKIPPED: 28 (22 no wave64 on this GPU; 3 per-lane form refused (#1426 semantics); 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: (1) this PR's own new test gpu::recomp::lower::tests::bridged_wave32_carry_preserves_scalar_operands_in_dxil (lower.rs:4791, "adjacent scalar operand s1=42 must not be clobbered by lane_mask"), not on main; (2) hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, fails on base too. Main alone at 9335bc0: 2800 passed, 2 failed, 50 ignored (the same standin test, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs in its warm child run, which passed on the merge result). The PR's other three new tests pass, including gpu_null_dest_and_bridged_carry_agree_with_hlsl on the GPU (wave32 and split wave64).
review: the failing test is stale, not the fix. It looks for "zext i32 42 to i64" in the DXIL, but since aa63928 ("keep VALU carry arithmetic in i32", adapted from #2565, on main through #2959) the carry is lowered as two i32 operations and an unsigned compare: the DXIL in the failure message has "add i32 42, %30" and "add i32 5, %30", so both operands reach the add unclobbered. The GPU test of the same program agrees: every lane gives 42 + lane + carry-in and 5 + lane + carry-in, matching HLSL. That explains the first check's finding (passes on the PR's own base, fails merged). The fix itself reads right: write_num / write_bit drop writes to register 125, and the 64-bit pair writers (S_GETPC_B64, S_MOV_B64, S_CSELECT_B64, SMEM loads) skip both halves, which is what keeps EXEC_LO (126) intact, so those guards are not redundant with the early return; lane_masks reads null as FALSE and never records it as a destination; the lane-mask inputs no longer overwrite an SGPR the instruction also reads whole. Overlaps without duplicating: #1864 (on main) handles null as a source in the same lowering; #2136 handles the null destination in upper_lanes.rs; #2833 touches the same files for SRC_SCC.
performance: none at run time; per-lane translations of programs with these instructions change once.
verdict: not yet: update bridged_wave32_carry_preserves_scalar_operands_in_dxil to main's i32 carry lowering (e.g. look for "add i32 42," and "add i32 5,"); the fix itself has no finding.
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.

<!-- greyfinch-sync:ivall/xcl:comment:7266804772 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7266804772). Originally posted by [jsalzy](https://github.com/jsalzy) on 2026-11-30T02:12:47Z. --- merge-check base: 9335bc0d86dbdc17c0e322bca617f35375b3e289 head: d758ce8b2cf1a2f1f961c316b8a76a7d1206572a merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2804 passed, 2 failed, 50 ignored; SKIPPED: 28 (22 no wave64 on this GPU; 3 per-lane form refused (#1426 semantics); 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: (1) this PR's own new test gpu::recomp::lower::tests::bridged_wave32_carry_preserves_scalar_operands_in_dxil (lower.rs:4791, "adjacent scalar operand s1=42 must not be clobbered by lane_mask"), not on main; (2) hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, fails on base too. Main alone at 9335bc0: 2800 passed, 2 failed, 50 ignored (the same standin test, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs in its warm child run, which passed on the merge result). The PR's other three new tests pass, including gpu_null_dest_and_bridged_carry_agree_with_hlsl on the GPU (wave32 and split wave64). review: the failing test is stale, not the fix. It looks for "zext i32 42 to i64" in the DXIL, but since aa63928 ("keep VALU carry arithmetic in i32", adapted from #2565, on main through #2959) the carry is lowered as two i32 operations and an unsigned compare: the DXIL in the failure message has "add i32 42, %30" and "add i32 5, %30", so both operands reach the add unclobbered. The GPU test of the same program agrees: every lane gives 42 + lane + carry-in and 5 + lane + carry-in, matching HLSL. That explains the first check's finding (passes on the PR's own base, fails merged). The fix itself reads right: write_num / write_bit drop writes to register 125, and the 64-bit pair writers (S_GETPC_B64, S_MOV_B64, S_CSELECT_B64, SMEM loads) skip both halves, which is what keeps EXEC_LO (126) intact, so those guards are not redundant with the early return; lane_masks reads null as FALSE and never records it as a destination; the lane-mask inputs no longer overwrite an SGPR the instruction also reads whole. Overlaps without duplicating: #1864 (on main) handles null as a source in the same lowering; #2136 handles the null destination in upper_lanes.rs; #2833 touches the same files for SRC_SCC. performance: none at run time; per-lane translations of programs with these instructions change once. verdict: not yet: update bridged_wave32_carry_preserves_scalar_operands_in_dxil to main's i32 carry lowering (e.g. look for "add i32 42," and "add i32 5,"); the fix itself has no finding. hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.
Foniass commented 2026-12-01 07:24:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:24:47Z.


Triage (#1607) – head d758ce8

Part of this is on main now: 15fff3b4 (#1864) reads NULL as a FALSE mask in lower.rs, skips NULL in the lane-mask inputs and the saveexec destination, and 574bda48 passes the real SGPRs for a wave32 bridged carry. Still missing on main: lane_masks.rs:mask_src treats 125 as a register, and S_MOV_B64 / S_CSELECT_B64 / S_GETPC_B64 with SDST = NULL still write sd + 1 = s126 (EXEC_LO).
The PR conflicts and needs a rebase down to those parts. #2136 fixes the same class of NULL-destination bug in upper_lanes.rs, a different module.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7304024607 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2117#issuecomment-7304024607). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:24:47Z. --- **Triage (#1607)** – head d758ce8 Part of this is on main now: 15fff3b4 (#1864) reads NULL as a FALSE mask in `lower.rs`, skips NULL in the lane-mask inputs and the saveexec destination, and 574bda48 passes the real SGPRs for a wave32 bridged carry. Still missing on main: `lane_masks.rs:mask_src` treats 125 as a register, and `S_MOV_B64` / `S_CSELECT_B64` / `S_GETPC_B64` with SDST = NULL still write `sd + 1` = s126 (EXEC_LO). The PR conflicts and needs a rebase down to those parts. #2136 fixes the same class of NULL-destination bug in `upper_lanes.rs`, a different module. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2117:upstream-pr/2117'
git switch 'upstream-pr/2117'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2117'
git switch 'upstream-pr/2117'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2117'
git switch 'upstream-pr/2117'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2117'
git switch 'main'
git merge --squash 'upstream-pr/2117'
git switch 'main'
git merge --ff-only 'upstream-pr/2117'
git switch 'main'
git merge 'upstream-pr/2117'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2107
No description provided.