recomp/dxil: CFG v_interp modes, bounded movrel/M0[7:0], and MS barrier guard #1965

Open
raylitebull wants to merge 1 commit from upstream-pr/1975 into main
raylitebull commented 2026-11-25 00:13:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T00:13:22Z.


Fixes shader fidelity issues across both the HLSL recompiler and the Direct DXIL translator (all 16-bit signature / f16 interpolant packing has been cleanly deferred to @MacieGx's recomp/f16-packed-interpolants PR with zero file overlap on recomp/mod.rs, dxil/graphics.rs, dxil/lower_gfx.rs, or dxil/lower_mem.rs):

  1. CFG v_interp mode tracking (emit.rs): tracks interpolation modes (ps_attr_modes, BasicCfg) across copied, reused, and joined v_interp registers.
  2. Bounded v_movrel / v_swaprel / s_movrel ranges & M0[7:0] / M0[23:16] masking (emit.rs, lower.rs, lower_valu.rs, lower_wide.rs, tests.rs): propagates M0 bounds across constants, masks, clamps, and counted loops (m0_bounds / Lw::value_upper_bound), emits bounded switch cases, and masks M0 to the low byte (M0[7:0] / M0[23:16]) in both HLSL and Direct DXIL (Lw::movrel/Lw::swaprel in lower_wide.rs via self.top_vgpr()).
  3. Non-uniform MS barriers (kernel.rs, lower.rs): detects and guards non-uniform s_barrier usage in mesh shaders in both backends.

Part of #1269.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs & tests.rs: CFG v_interp mode tracking (ps_attr_modes, BasicCfg), m0_bounds analysis and M0[7:0] masking for v_movrel/v_swaprel/s_movrel, bounded switch generation, non-uniform mesh barrier handling, scalar_relative_move_cluster, and v_swaprel_b32_uses_the_m0_relative_switch.
  • crates/xcl/src/gpu/dxil/kernel.rs, lower.rs, lower_valu.rs, lower_wide.rs: M0[7:0] / M0[23:16] masking and const_u64/value_upper_bound range-narrowing inside Lw::movrel/Lw::swaprel, plus non-uniform MS barrier guarding (6 files total, +1198 / -81).

Tested

  • Toolchain: Windows 11 x64, rustc 1.99.1 (58cf8f9c3 2026-10-13), DXC dxcompiler 1.8.2502.11 / dxil 1.8.2502.11, rebased cleanly onto c9ee916a (72960386).
  • cargo check --workspace --tests: passed (0 warnings in touched files).
  • Targeted tests (fidelity_tests 7/7, saveexec_tests::direct_* 1/1, recomp::tests scalar_relative_move_cluster + v_swaprel_b32_uses_the_m0_relative_switch 2/2): 10 passed, 0 failed (0.18s, dxil 1.8.2502.11 validated).

Regression run

  • Standalone scripts/smoke.ps1 pair on 72960386 vs c9ee916a has not been run yet. AMD and NVIDIA reviewers are invited to test on 72960386 vs c9ee916a (including scripts/smoke.ps1, XCL_DIRECT_DXIL=1, and HLSL recompilation paths) and post results in the comments.

Not tested

  • 60 s scripts/smoke.ps1 pair on 72960386, full cargo test --workspace suite on 72960386, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.

AI use

  • Antigravity assisted with implementation, scoping, rebase onto c9ee916a, and DXIL/recompiler validation tests; the author reviewed the diff and test output.
<!-- greyfinch-sync:ivall/xcl:issue:5482594405 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T00:13:22Z. --- Fixes shader fidelity issues across both the HLSL recompiler and the Direct DXIL translator *(all 16-bit signature / `f16` interpolant packing has been cleanly deferred to `@MacieGx`'s `recomp/f16-packed-interpolants` PR with zero file overlap on `recomp/mod.rs`, `dxil/graphics.rs`, `dxil/lower_gfx.rs`, or `dxil/lower_mem.rs`)*: 1. **CFG `v_interp` mode tracking (`emit.rs`):** tracks interpolation modes (`ps_attr_modes`, `BasicCfg`) across copied, reused, and joined `v_interp` registers. 2. **Bounded `v_movrel` / `v_swaprel` / `s_movrel` ranges & `M0[7:0]` / `M0[23:16]` masking (`emit.rs`, `lower.rs`, `lower_valu.rs`, `lower_wide.rs`, `tests.rs`):** propagates `M0` bounds across constants, masks, clamps, and counted loops (`m0_bounds` / `Lw::value_upper_bound`), emits bounded switch cases, and masks `M0` to the low byte (`M0[7:0]` / `M0[23:16]`) in both HLSL and Direct DXIL (`Lw::movrel`/`Lw::swaprel` in `lower_wide.rs` via `self.top_vgpr()`). 3. **Non-uniform MS barriers (`kernel.rs`, `lower.rs`):** detects and guards non-uniform `s_barrier` usage in mesh shaders in both backends. Part of #1269. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs` & `tests.rs`: CFG `v_interp` mode tracking (`ps_attr_modes`, `BasicCfg`), `m0_bounds` analysis and `M0[7:0]` masking for `v_movrel`/`v_swaprel`/`s_movrel`, bounded switch generation, non-uniform mesh barrier handling, `scalar_relative_move_cluster`, and `v_swaprel_b32_uses_the_m0_relative_switch`. - `crates/xcl/src/gpu/dxil/kernel.rs`, `lower.rs`, `lower_valu.rs`, `lower_wide.rs`: `M0[7:0]` / `M0[23:16]` masking and `const_u64`/`value_upper_bound` range-narrowing inside `Lw::movrel`/`Lw::swaprel`, plus non-uniform MS barrier guarding (`6` files total, `+1198 / -81`). **Tested** - Toolchain: Windows 11 x64, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, DXC `dxcompiler 1.8.2502.11` / `dxil 1.8.2502.11`, rebased cleanly onto `c9ee916a` (`72960386`). - `cargo check --workspace --tests`: passed (`0` warnings in touched files). - Targeted tests (`fidelity_tests` `7/7`, `saveexec_tests::direct_*` `1/1`, `recomp::tests` `scalar_relative_move_cluster` + `v_swaprel_b32_uses_the_m0_relative_switch` `2/2`): **10 passed, 0 failed** (`0.18s`, `dxil 1.8.2502.11` validated). **Regression run** - Standalone `scripts/smoke.ps1` pair on `72960386` vs `c9ee916a` has not been run yet. AMD and NVIDIA reviewers are invited to test on `72960386` vs `c9ee916a` (including `scripts/smoke.ps1`, `XCL_DIRECT_DXIL=1`, and HLSL recompilation paths) and post results in the comments. **Not tested** - 60 s `scripts/smoke.ps1` pair on `72960386`, full `cargo test --workspace` suite on `72960386`, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton. **AI use** - Antigravity assisted with implementation, scoping, rebase onto `c9ee916a`, and DXIL/recompiler validation tests; the author reviewed the diff and test output.
raylitebull commented 2026-11-25 01:10:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T00:43:55Z.


Thanks for catching the #1961 integration issue and narrowing it down, @WebIdentity1!

Updated #1975 cleanly onto 6567c5f (b62e6e3): instead of duplicating movrel/swaprel in lower_valu.rs with touched_top_vgpr(), moved the const_u64 and value_upper_bound range-narrowing directly into Lw::movrel and Lw::swaprel in crates/xcl/src/gpu/dxil/lower_wide.rs (which already use self.top_vgpr()). That works standalone on main and automatically picks up #1961's program-wide self.max_vgpr in either merge order with zero conflicts.

Verified locally with cargo check --workspace --tests, fidelity_tests (15 passed, 0 failed, dxil 1.8.2502.11 validated), attribute_tests (4 passed, 0 failed), and v_swaprel_b32_uses_the_m0_relative_switch (1 passed, 0 failed). (GPU hardware tests on #1975 + #1961 have not been run locally.)

<!-- greyfinch-sync:ivall/xcl:comment:7148817115 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7148817115). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T00:43:55Z. --- Thanks for catching the `#1961` integration issue and narrowing it down, @WebIdentity1! Updated `#1975` cleanly onto `6567c5f` (`b62e6e3`): instead of duplicating `movrel`/`swaprel` in `lower_valu.rs` with `touched_top_vgpr()`, moved the `const_u64` and `value_upper_bound` range-narrowing directly into `Lw::movrel` and `Lw::swaprel` in `crates/xcl/src/gpu/dxil/lower_wide.rs` (which already use `self.top_vgpr()`). That works standalone on `main` and automatically picks up `#1961`'s program-wide `self.max_vgpr` in either merge order with zero conflicts. Verified locally with `cargo check --workspace --tests`, `fidelity_tests` (`15 passed, 0 failed`, `dxil 1.8.2502.11` validated), `attribute_tests` (`4 passed, 0 failed`), and `v_swaprel_b32_uses_the_m0_relative_switch` (`1 passed, 0 failed`). (GPU hardware tests on `#1975` + `#1961` have not been run locally.)
futurepro62 commented 2026-11-25 01:10:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T00:50:07Z.


Full-suite run, since this PR has no test report yet. Tested exact head b62e6e3 (on its base 2c95f01).

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::dxil::fuzz_tests: 1002 passed, 0 failed, 43 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: from_d3d_supports_16bit_component_types, place_separates_16bit_and_32bit_rows_and_packs_16bit_together, mixed_mode_fixed_row_adopts_row_interp_mode, direct_dxil_vs_compr_and_ps_16bit_inputs_validate, direct_dxil_movrel_const_and_umin_bound_validate, direct_dxil_movrel_masks_m0_low_byte, direct_dxil_packed_f16_vs_ps_and_ms_validate, direct_dxil_mesh_non_uniform_barrier_guard, ps_attr_modes_follows_copied_reused_and_joined_interp_regs, m0_bounds_tracks_constants_masks_clamps_and_counted_loops, v_movrel_emits_bounded_switch_cases, vs_compr_param_and_16bit_sig_types_unpack_cleanly, ps_packed_f16_interp_high_bit_and_paired_attrs, vs_and_ms_packed_f16_param_unpack, v_movrel_and_swaprel_mask_m0_low_byte, native_wave_branches_keep_inactive_lanes_in_scalar_control_flow, native_wave_branches_on_the_gpu, fssm_16bit_packed_tables_and_slot_mapping, stream_pipeline_defaults_depth_enable_from_dsv_format.
  • The previous head 367982c (the PR was updated before the NVIDIA run above) 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: 1008 passed, 0 failed, 45 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 80f4819 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 and const_and_null_mask_operands_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.
  • An earlier run at the previous head 367982c, with a second suite running on the same machine, failed only hle::kernelx::tests::fine_timer_makes_short_sleeps_short (a Sleep(1) timing test that is sensitive to CPU load). The run above had the machine to itself.

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:7148928962 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7148928962). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T00:50:07Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `b62e6e3` (on its base `2c95f01`). **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::dxil::fuzz_tests`: **1002 passed, 0 failed, 43 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: `from_d3d_supports_16bit_component_types`, `place_separates_16bit_and_32bit_rows_and_packs_16bit_together`, `mixed_mode_fixed_row_adopts_row_interp_mode`, `direct_dxil_vs_compr_and_ps_16bit_inputs_validate`, `direct_dxil_movrel_const_and_umin_bound_validate`, `direct_dxil_movrel_masks_m0_low_byte`, `direct_dxil_packed_f16_vs_ps_and_ms_validate`, `direct_dxil_mesh_non_uniform_barrier_guard`, `ps_attr_modes_follows_copied_reused_and_joined_interp_regs`, `m0_bounds_tracks_constants_masks_clamps_and_counted_loops`, `v_movrel_emits_bounded_switch_cases`, `vs_compr_param_and_16bit_sig_types_unpack_cleanly`, `ps_packed_f16_interp_high_bit_and_paired_attrs`, `vs_and_ms_packed_f16_param_unpack`, `v_movrel_and_swaprel_mask_m0_low_byte`, `native_wave_branches_keep_inactive_lanes_in_scalar_control_flow`, `native_wave_branches_on_the_gpu`, `fssm_16bit_packed_tables_and_slot_mapping`, `stream_pipeline_defaults_depth_enable_from_dsv_format`. - The previous head `367982c` (the PR was updated before the NVIDIA run above) 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`: **1008 passed, 0 failed, 45 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 `80f4819` 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 and `const_and_null_mask_operands_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`. - An earlier run at the previous head `367982c`, with a second suite running on the same machine, failed only `hle::kernelx::tests::fine_timer_makes_short_sleeps_short` (a `Sleep(1)` timing test that is sensitive to CPU load). The run above had the machine to itself. **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.
WebIdentity1 commented 2026-11-25 01:10:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-25T00:34:13Z.


Update: verified the author's integration repair at b62e6e391d26db4637670818dbef5777834831d3 together with #1961 (62b85c19888af59fc166069412244ee5ddcb59e7). Applied #1961's runtime/test diff, excluding its README change, directly to this head without conflicts. No additional integration fix was needed. The relocated Lw::movrel/swaprel implementation now uses the program-wide register bound.

6 passed / 0 failed / 0 ignored, zero skips. The existing 20-dispatch compute-output regression passes all 1,280 words across Direct DXIL/per-lane and wave32/split-wave64, including inactive lanes. Both Direct DXIL movrel checks, the M0-bounds and bounded-switch checks, and the swaprel switch test also pass.

cargo test --locked -p xcl --lib -- relative_registers_reach_compute_output direct_dxil_movrel m0_bounds_tracks v_movrel_emits_bounded_switch_cases v_swaprel_b32_uses_the_m0_relative_switch --test-threads=1 --show-output

Native Windows 10 19045 / Ryzen 7800X3D / RTX 3090 driver 591.74 / Rust 1.98.1 MSVC / DXC 1.8.2502.11, debug; XCL_ADAPTER=3090, XCL_REQUIRE_GPU=wave64,mesh, XCL_SPLIT_WAVE64=1, XCL_DIRECT_DXIL unset. All 311 source hashes matched before/after and XCL recompiled. This closes the reported #1961 integration failure. These are combined-tree results, not standalone-head or full-suite results. No retail, AMD, performance or unrelated #1975 feature coverage is claimed. AI use for this follow-up: Codex (GPT-6), source review, running the existing checks and report preparation.

Original reproducer, proposed patch and earlier results

Verified the #1961 / #1890 interaction on 367982c674e5ca536fdcca95dced926696530562: the new movrel_bounded / swaprel_bounded call touched_top_vgpr() instead of the program-wide bound. Consequently, applying #1961's runtime fix and regression here is insufficient: the new bounded paths bypass that fix.

Tested — native Windows 10 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, DXC 1.8.2502.11, debug; XCL_ADAPTER=3090, XCL_SPLIT_WAVE64=1.

cargo test --locked -p xcl --lib -- relative_registers_reach_compute_output direct_dxil_movrel m0_bounds_tracks v_movrel_emits_bounded_switch_cases --test-threads=1 --show-output
  • Control: exact 367982c + #1961 (62b85c1) runtime/test changes, without its README edit: 4 passed / 1 failed / 0 ignored, zero skips. Your four existing checks pass, but the compute-output regression fails 14/20 dispatch comparisons, 800 wrong words. It exercises Direct DXIL/per-lane, wave32/split-wave64, relative read/write forms and inactive lanes.
  • Same combined source + the patch below: 5 passed / 0 failed / 0 ignored, zero skips, all 20 × 64 GPU output words correct. Both runs recompiled XCL; all 311 source-file hashes matched before/after.

The patch uses #1961's Lw.max_vgpr at both new call sites and removes the obsolete helper. It retains your per-index constant/upper-bound narrowing. Please integrate it with #1961; it depends on that field and the per-lane bridge changes.

Integration patch on top of #1975 + #1961
diff --git a/crates/xcl/src/gpu/dxil/lower_valu.rs b/crates/xcl/src/gpu/dxil/lower_valu.rs
index fb749a7..99b7b08 100644
--- a/crates/xcl/src/gpu/dxil/lower_valu.rs
+++ b/crates/xcl/src/gpu/dxil/lower_valu.rs
@@ -1360,17 +1360,6 @@ impl Lw {
         }
     }
 
-    /// Highest VGPR touched so far (for relative VGPR indexing upper cap).
-    fn touched_top_vgpr(&self) -> u64 {
-        self.init
-            .touched
-            .iter()
-            .filter(|&&v| (VAR_VGPR..VAR_VGPR + 256).contains(&v))
-            .map(|&v| (v - VAR_VGPR) as u64)
-            .max()
-            .unwrap_or(0)
-    }
-
     /// Range-bounded `v_movrel*`: avoids touching/selecting across unrelated VGPRs when `M0`
     /// is a compile-time constant or carries a provable `UMin`/SSA upper bound.
     fn movrel_bounded(&mut self, d: &Decoded, name: &str) -> LResult<()> {
@@ -1381,7 +1370,7 @@ impl Lw {
         let vdst = Self::fv(d, "VDST");
         let m0 = self.sreg(124);
         let m0_lo = self.andc(m0, 0xFF);
-        let top = self.touched_top_vgpr().max(vdst).max(src_code.saturating_sub(256));
+        let top = self.max_vgpr.max(vdst).max(src_code.saturating_sub(256));
         let (rd_idx, wr_idx) = match name {
             "v_movrels_b32" => (Some(m0_lo), None),
             "v_movreld_b32" => (None, Some(m0_lo)),
@@ -1458,7 +1447,7 @@ impl Lw {
             return err(d, "swaprel: the source is not a VGPR");
         }
         let base = src_code - 256;
-        let top = self.touched_top_vgpr().max(vdst).max(base);
+        let top = self.max_vgpr.max(vdst).max(base);
         let m0 = self.sreg(124);
         let m0_lo = self.andc(m0, 0xFF);
         let a = self.act();

Not tested: this PR's unrelated changes, the full combined workspace suite, retail smoke, AMD/native wave64, or compilation-time/memory improvements. This checks relative moves; it does not settle the separate swaprel destination-semantics issue in #803. No performance inference is made from a control producing incorrect output.

AI use: Codex with GPT-6 Astra inspected the integration, prepared the small adjustment, ran the paired Windows tests and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7148648764 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7148648764). Originally posted by [WebIdentity1](https://github.com/WebIdentity1) on 2026-11-25T00:34:13Z. --- **Update: verified the author's integration repair at `b62e6e391d26db4637670818dbef5777834831d3` together with #1961 (`62b85c19888af59fc166069412244ee5ddcb59e7`).** Applied #1961's runtime/test diff, excluding its README change, directly to this head without conflicts. No additional integration fix was needed. The relocated `Lw::movrel`/`swaprel` implementation now uses the program-wide register bound. **6 passed / 0 failed / 0 ignored, zero skips**. The existing 20-dispatch compute-output regression passes all **1,280 words** across Direct DXIL/per-lane and wave32/split-wave64, including inactive lanes. Both Direct DXIL movrel checks, the M0-bounds and bounded-switch checks, and the swaprel switch test also pass. ```text cargo test --locked -p xcl --lib -- relative_registers_reach_compute_output direct_dxil_movrel m0_bounds_tracks v_movrel_emits_bounded_switch_cases v_swaprel_b32_uses_the_m0_relative_switch --test-threads=1 --show-output ``` Native Windows 10 19045 / Ryzen 7800X3D / RTX 3090 driver 591.74 / Rust 1.98.1 MSVC / DXC 1.8.2502.11, debug; `XCL_ADAPTER=3090`, `XCL_REQUIRE_GPU=wave64,mesh`, `XCL_SPLIT_WAVE64=1`, `XCL_DIRECT_DXIL` unset. All 311 source hashes matched before/after and XCL recompiled. This closes the reported #1961 integration failure. These are combined-tree results, not standalone-head or full-suite results. No retail, AMD, performance or unrelated #1975 feature coverage is claimed. AI use for this follow-up: Codex (GPT-6), source review, running the existing checks and report preparation. <details><summary>Original reproducer, proposed patch and earlier results</summary> Verified the #1961 / #1890 interaction on `367982c674e5ca536fdcca95dced926696530562`: the new `movrel_bounded` / `swaprel_bounded` call `touched_top_vgpr()` instead of the program-wide bound. Consequently, applying #1961's runtime fix and regression here is insufficient: the new bounded paths bypass that fix. **Tested** — native Windows 10 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, DXC 1.8.2502.11, debug; `XCL_ADAPTER=3090`, `XCL_SPLIT_WAVE64=1`. ```text cargo test --locked -p xcl --lib -- relative_registers_reach_compute_output direct_dxil_movrel m0_bounds_tracks v_movrel_emits_bounded_switch_cases --test-threads=1 --show-output ``` - Control: exact `367982c` + #1961 (`62b85c1`) runtime/test changes, without its README edit: **4 passed / 1 failed / 0 ignored, zero skips**. Your four existing checks pass, but the compute-output regression fails **14/20 dispatch comparisons, 800 wrong words**. It exercises Direct DXIL/per-lane, wave32/split-wave64, relative read/write forms and inactive lanes. - Same combined source + the patch below: **5 passed / 0 failed / 0 ignored, zero skips**, all **20 × 64 GPU output words** correct. Both runs recompiled XCL; all 311 source-file hashes matched before/after. The patch uses #1961's `Lw.max_vgpr` at both new call sites and removes the obsolete helper. It retains your per-index constant/upper-bound narrowing. Please integrate it with #1961; it depends on that field and the per-lane bridge changes. <details><summary>Integration patch on top of #1975 + #1961</summary> ```diff diff --git a/crates/xcl/src/gpu/dxil/lower_valu.rs b/crates/xcl/src/gpu/dxil/lower_valu.rs index fb749a7..99b7b08 100644 --- a/crates/xcl/src/gpu/dxil/lower_valu.rs +++ b/crates/xcl/src/gpu/dxil/lower_valu.rs @@ -1360,17 +1360,6 @@ impl Lw { } } - /// Highest VGPR touched so far (for relative VGPR indexing upper cap). - fn touched_top_vgpr(&self) -> u64 { - self.init - .touched - .iter() - .filter(|&&v| (VAR_VGPR..VAR_VGPR + 256).contains(&v)) - .map(|&v| (v - VAR_VGPR) as u64) - .max() - .unwrap_or(0) - } - /// Range-bounded `v_movrel*`: avoids touching/selecting across unrelated VGPRs when `M0` /// is a compile-time constant or carries a provable `UMin`/SSA upper bound. fn movrel_bounded(&mut self, d: &Decoded, name: &str) -> LResult<()> { @@ -1381,7 +1370,7 @@ impl Lw { let vdst = Self::fv(d, "VDST"); let m0 = self.sreg(124); let m0_lo = self.andc(m0, 0xFF); - let top = self.touched_top_vgpr().max(vdst).max(src_code.saturating_sub(256)); + let top = self.max_vgpr.max(vdst).max(src_code.saturating_sub(256)); let (rd_idx, wr_idx) = match name { "v_movrels_b32" => (Some(m0_lo), None), "v_movreld_b32" => (None, Some(m0_lo)), @@ -1458,7 +1447,7 @@ impl Lw { return err(d, "swaprel: the source is not a VGPR"); } let base = src_code - 256; - let top = self.touched_top_vgpr().max(vdst).max(base); + let top = self.max_vgpr.max(vdst).max(base); let m0 = self.sreg(124); let m0_lo = self.andc(m0, 0xFF); let a = self.act(); ``` </details> **Not tested:** this PR's unrelated changes, the full combined workspace suite, retail smoke, AMD/native wave64, or compilation-time/memory improvements. This checks relative moves; it does not settle the separate swaprel destination-semantics issue in #803. No performance inference is made from a control producing incorrect output. **AI use:** Codex with GPT-6 Astra inspected the integration, prepared the small adjustment, ran the paired Windows tests and drafted this report. </details>
JJAutoCompare commented 2026-11-25 01:11:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T01:04:46Z.


Tested

Clean PR head b62e6e391d26db4637670818dbef5777834831d3, verified against the live open PR before and after testing. Windows 11 Enterprise Evaluation 25H2 x64, build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175. Rust 1.100.0 (0ef1bc386 2026-11-09), x86_64-pc-windows-msvc, debug. DXC and DXIL 1.9.2609.5 via XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. Cargo used an isolated target and TEMP/TMP on L:/XclTooling, CARGO_BUILD_JOBS=2, and CARGO_INCREMENTAL=0.

cargo test --locked -p xcl --lib --no-run
cargo test --locked -p xcl --lib -- gpu::dxil::lower_valu::fidelity_tests::direct_dxil_movrel_masks_m0_low_byte --exact --test-threads=1 --show-output

The build succeeded. The CPU test translated and validated a Direct DXIL compute kernel with nonzero upper M0 bits, then checked the disassembly for a low-byte mask. 1 passed, 0 failed, 0 ignored, 0 skips.

$env:XCL_ADAPTER = 'A770'
$env:XCL_SPLIT_WAVE64 = '1'
$env:XCL_REQUIRE_GPU = 'wave64'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    $env:XCL_DIRECT_DXIL = '0'
    cargo test --locked -p xcl --lib -- gpu::recomp::tests::gpu_v_swaprel_b32 --exact --test-threads=1 --show-output
    $env:XCL_DIRECT_DXIL = '1'
    cargo test --locked -p xcl --lib -- gpu::recomp::tests::gpu_v_swaprel_b32 --exact --test-threads=1 --show-output
}

Both locked A770 runs dispatched a split-wave64 compute test kernel. HLSL used DXC -E main -T cs_6_6 -HV 2021. Direct DXIL took the kernel translator path with no HLSL fallback. Each run checked all 64 logical lanes for ordinary v_swaprel_b32, EXEC-gated swaps, and a self-swap, plus EXEC restoration. Each backend had 1 passed, 0 failed, 0 ignored, 0 skips.

Not tested

GPU output with nonzero upper M0 bits, the title compute pipeline, VS/PS/MS attribute and barrier changes, native wave64 hardware, integration with #1961, the full workspace suite, and retail smoke.

AI use

Codex (gpt-6.2-sol) selected and ran the tests, verified the logs, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7149183447 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7149183447). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T01:04:46Z. --- **Tested** Clean PR head `b62e6e391d26db4637670818dbef5777834831d3`, verified against the live open PR before and after testing. Windows 11 Enterprise Evaluation 25H2 x64, build `26200.9974`, Ryzen 7 3800X, Intel Arc A770 driver `32.0.101.9175`. Rust `1.100.0 (0ef1bc386 2026-11-09)`, `x86_64-pc-windows-msvc`, debug. DXC and DXIL `1.9.2609.5` via `XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64`. Cargo used an isolated target and TEMP/TMP on `L:/XclTooling`, `CARGO_BUILD_JOBS=2`, and `CARGO_INCREMENTAL=0`. ```powershell cargo test --locked -p xcl --lib --no-run cargo test --locked -p xcl --lib -- gpu::dxil::lower_valu::fidelity_tests::direct_dxil_movrel_masks_m0_low_byte --exact --test-threads=1 --show-output ``` The build succeeded. The CPU test translated and validated a Direct DXIL compute kernel with nonzero upper M0 bits, then checked the disassembly for a low-byte mask. 1 passed, 0 failed, 0 ignored, 0 skips. ```powershell $env:XCL_ADAPTER = 'A770' $env:XCL_SPLIT_WAVE64 = '1' $env:XCL_REQUIRE_GPU = 'wave64' & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { $env:XCL_DIRECT_DXIL = '0' cargo test --locked -p xcl --lib -- gpu::recomp::tests::gpu_v_swaprel_b32 --exact --test-threads=1 --show-output $env:XCL_DIRECT_DXIL = '1' cargo test --locked -p xcl --lib -- gpu::recomp::tests::gpu_v_swaprel_b32 --exact --test-threads=1 --show-output } ``` Both locked A770 runs dispatched a split-wave64 **compute test kernel**. HLSL used DXC `-E main -T cs_6_6 -HV 2021`. Direct DXIL took the kernel translator path with no HLSL fallback. Each run checked all 64 logical lanes for ordinary `v_swaprel_b32`, EXEC-gated swaps, and a self-swap, plus EXEC restoration. Each backend had 1 passed, 0 failed, 0 ignored, 0 skips. **Not tested** GPU output with nonzero upper M0 bits, the title compute pipeline, VS/PS/MS attribute and barrier changes, native wave64 hardware, integration with #1961, the full workspace suite, and retail smoke. **AI use** Codex (`gpt-6.2-sol`) selected and ran the tests, verified the logs, and wrote this report.
raylitebull commented 2026-11-25 02:09:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:54:13Z.


Rebased #1975 cleanly onto ae0518c (0b0e182, 8da3917, a85fa25):

  • Resolved the #2008 (dc0d25f) EXP VM conflict in crates/xcl/src/gpu/recomp/emit.rs by preserving #2008's if let Some(e) valid-mask survival flow alongside 16-bit SV_Target component types 3|6 and 2|5.
  • Pushed a85fa25 for GitHub Actions Build and test and fresh AMD / NVIDIA verification (fidelity_tests, attribute_tests, v_swaprel_b32_uses_the_m0_relative_switch).
<!-- greyfinch-sync:ivall/xcl:comment:7150093010 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7150093010). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:54:13Z. --- Rebased `#1975` cleanly onto `ae0518c` (`0b0e182`, `8da3917`, `a85fa25`): - Resolved the `#2008` (`dc0d25f`) `EXP VM` conflict in `crates/xcl/src/gpu/recomp/emit.rs` by preserving `#2008`'s `if let Some(e)` valid-mask survival flow alongside 16-bit `SV_Target` component types `3|6` and `2|5`. - Pushed `a85fa25` for GitHub Actions `Build and test` and fresh AMD / NVIDIA verification (`fidelity_tests`, `attribute_tests`, `v_swaprel_b32_uses_the_m0_relative_switch`).
DavidM1911 commented 2026-11-25 04:10:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T03:19:51Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main (crates/xcl/src/gpu/recomp/emit.rs) — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7151812752 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7151812752). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T03:19:51Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** (`crates/xcl/src/gpu/recomp/emit.rs`) — needs a rebase before it can be tested.
Toons29 commented 2026-11-25 11:09:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T10:22:35Z.


Regression run of 865350cc on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 1a0bbe3a, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14561 MB
xcl-smoke v1
commit: 865350cc9fd9220948e4bd6d9517e99c1f207cd9
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14560 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; both blocks are exactly as printed, and I approved posting this.

<!-- greyfinch-sync:ivall/xcl:comment:7159608772 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7159608772). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T10:22:35Z. --- Regression run of `865350cc` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `1a0bbe3a`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1628 (PresentX 1628) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14561 MB ``` ``` xcl-smoke v1 commit: 865350cc9fd9220948e4bd6d9517e99c1f207cd9 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1630 (PresentX 1630) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14560 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; both blocks are exactly as printed, and I approved posting this.
raylitebull commented 2026-11-25 11:09:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:38:24Z.


Rebased #1975 cleanly onto 568e7db (d33c5df, 0e2be31, f6289cb), resolving the crates/xcl/src/gpu/dxil/kernel.rs::translate_mesh conflict with #2034 (translate_entry(..., None)).

Pushed f6289cb for GitHub Actions Build and test and fresh AMD / NVIDIA verification.

<!-- greyfinch-sync:ivall/xcl:comment:7159970968 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7159970968). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T10:38:24Z. --- Rebased `#1975` cleanly onto `568e7db` (`d33c5df`, `0e2be31`, `f6289cb`), resolving the `crates/xcl/src/gpu/dxil/kernel.rs::translate_mesh` conflict with `#2034` (`translate_entry(..., None)`). Pushed `f6289cb` for GitHub Actions `Build and test` and fresh AMD / NVIDIA verification.
raylitebull commented 2026-11-25 11:09:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:46:35Z.


Rebased #1975 cleanly onto 82e63982 (0a53ec86, ff58c76d, 1447d7e4), resolving #2174's 5-arg translate_entry(..., None, None) signature in crates/xcl/src/gpu/dxil/kernel.rs::translate_mesh.

Verified locally (fidelity_tests: 19 passed, 0 failed, dxil 1.8.2502.11 validated; attribute_tests: 4 passed, 0 failed) and pushed 1447d7e4.

<!-- greyfinch-sync:ivall/xcl:comment:7160157083 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7160157083). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T10:46:35Z. --- Rebased `#1975` cleanly onto `82e63982` (`0a53ec86`, `ff58c76d`, `1447d7e4`), resolving `#2174`'s 5-arg `translate_entry(..., None, None)` signature in `crates/xcl/src/gpu/dxil/kernel.rs::translate_mesh`. Verified locally (`fidelity_tests`: `19 passed, 0 failed`, `dxil 1.8.2502.11` validated; `attribute_tests`: `4 passed, 0 failed`) and pushed `1447d7e4`.
raylitebull commented 2026-11-25 11:09:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:54:58Z.


Rebased #1975 cleanly onto 1c17aa55 (f0560cb6, 3d365645, 865350cc) so #1976 stacks cleanly onto 1c17aa55.

Verified locally (cargo check --workspace --tests + fidelity_tests: 19 passed, 0 failed, dxil 1.8.2502.11 validated; attribute_tests: 4 passed, 0 failed) and pushed 865350cc.

<!-- greyfinch-sync:ivall/xcl:comment:7160342916 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7160342916). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T10:54:58Z. --- Rebased `#1975` cleanly onto `1c17aa55` (`f0560cb6`, `3d365645`, `865350cc`) so `#1976` stacks cleanly onto `1c17aa55`. Verified locally (`cargo check --workspace --tests` + `fidelity_tests`: `19 passed, 0 failed`, `dxil 1.8.2502.11` validated; `attribute_tests`: `4 passed, 0 failed`) and pushed `865350cc`.
MacieGx commented 2026-11-25 12:06:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MacieGx on 2026-11-25T11:43:53Z.


Review of the float16 interpolant part of this PR (with #1976 on top), from working on the same feature for the newer retail title (#505). I checked the layout against that title's own shaders: 442 mesh shaders and 362 pixel shaders dumped from a run, of which 383 MS params and 378 PS attributes are packed float16. Three points where this PR's pairing differs from what those programs do, and one about other titles:

  1. Where the second register of a pair goes. Here the second register is always in dwords 2–3. In the title's programs it follows the dwords the first register takes: dword 1 after a .xy register, dwords 2–3 after .xyz / .xyzw (component c of a register sits in dword c/2, even c in the low half). The exp param enable masks of all 383 packed MS params and 376 of the 378 PS attribute reads agree with that (the other 2 read one half past a .xy register). With the fixed dwords 2–3, every pair whose first register is .xy reads the wrong dword.
  2. A PS record whose second register repeats its own (#1976). #1976 takes it as the same register's .zw. In the title it is the next float16 register no other record names; with .zw the attribute reads its own upper half.
  3. Mesh programs. param_slot_regs(.., None, ..) pairs MS registers by a guess. The MS's output table ([6, reg, param, reg, 0, 1|3]) gives the pairing, and for the title's programs it agrees with the enable masks of point 1.
  4. Programs without a table. The greedy 16-bit pairing (greedy_packed_slots) changes the interface of every VS / PS / MS with 16-bit signature elements and no table, in any title. Leaving that case as today avoids a change nobody measured.

A focused branch that does only the float16 interpolants, with the layout above, is here: https://github.com/MacieGx/xcl/tree/recomp/f16-packed-interpolants (2 commits on main 9633138, ~540 lines; tests attribute_tests::f16_packed_attributes, attribute_tests::f16_packed_params, dxil::core_tests::f16_packed_attributes_interpolate_per_half, recomp::tests::gpu_mesh_f16_packed_params). On it: RTX 5080 (driver 621.24, 32-lane waves), release, cargo test --release --workspace --no-fail-fast -- --test-threads=4: 1241 passed, 6 failed, 46 ignored; the 6 failures (fuzz_validate_and_gpu_0..3, rerouted_disk_entries_follow_the_direct_translator, pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa) fail on main as well. It does not touch the M0, movrel or barrier parts of this PR.

Two ways forward, whichever you and the maintainer prefer:

  • (a) take the layout, the table-based MS pairing and the tests from that branch into this PR (feel free to use them as they are); or
  • (b) split the float16 interpolants out of this PR, and I open that branch as its own PR, leaving the rest of this one as it is.

AI use: Claude Code (Claude Opus 5.5 coordinating; Claude Fable 5.2 and Opus 5.5 subagents analysed the dumped shaders, wrote the branch and compared it with this PR). I checked each point above against the code of both.

<!-- greyfinch-sync:ivall/xcl:comment:7161424965 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7161424965). Originally posted by [MacieGx](https://github.com/MacieGx) on 2026-11-25T11:43:53Z. --- Review of the float16 interpolant part of this PR (with #1976 on top), from working on the same feature for the newer retail title (#505). I checked the layout against that title's own shaders: 442 mesh shaders and 362 pixel shaders dumped from a run, of which 383 MS params and 378 PS attributes are packed float16. Three points where this PR's pairing differs from what those programs do, and one about other titles: 1. **Where the second register of a pair goes.** Here the second register is always in dwords 2–3. In the title's programs it follows the dwords the first register takes: dword 1 after a `.xy` register, dwords 2–3 after `.xyz` / `.xyzw` (component c of a register sits in dword c/2, even c in the low half). The `exp param` enable masks of all 383 packed MS params and 376 of the 378 PS attribute reads agree with that (the other 2 read one half past a `.xy` register). With the fixed dwords 2–3, every pair whose first register is `.xy` reads the wrong dword. 2. **A PS record whose second register repeats its own (#1976).** #1976 takes it as the same register's `.zw`. In the title it is the next float16 register no other record names; with `.zw` the attribute reads its own upper half. 3. **Mesh programs.** `param_slot_regs(.., None, ..)` pairs MS registers by a guess. The MS's output table (`[6, reg, param, reg, 0, 1|3]`) gives the pairing, and for the title's programs it agrees with the enable masks of point 1. 4. **Programs without a table.** The greedy 16-bit pairing (`greedy_packed_slots`) changes the interface of every VS / PS / MS with 16-bit signature elements and no table, in any title. Leaving that case as today avoids a change nobody measured. A focused branch that does only the float16 interpolants, with the layout above, is here: https://github.com/MacieGx/xcl/tree/recomp/f16-packed-interpolants (2 commits on `main` `9633138`, ~540 lines; tests `attribute_tests::f16_packed_attributes`, `attribute_tests::f16_packed_params`, `dxil::core_tests::f16_packed_attributes_interpolate_per_half`, `recomp::tests::gpu_mesh_f16_packed_params`). On it: RTX 5080 (driver 621.24, 32-lane waves), release, `cargo test --release --workspace --no-fail-fast -- --test-threads=4`: 1241 passed, 6 failed, 46 ignored; the 6 failures (`fuzz_validate_and_gpu_0..3`, `rerouted_disk_entries_follow_the_direct_translator`, `pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa`) fail on `main` as well. It does not touch the M0, movrel or barrier parts of this PR. Two ways forward, whichever you and the maintainer prefer: - **(a)** take the layout, the table-based MS pairing and the tests from that branch into this PR (feel free to use them as they are); or - **(b)** split the float16 interpolants out of this PR, and I open that branch as its own PR, leaving the rest of this one as it is. AI use: Claude Code (Claude Opus 5.5 coordinating; Claude Fable 5.2 and Opus 5.5 subagents analysed the dumped shaders, wrote the branch and compared it with this PR). I checked each point above against the code of both.
upstream-sync changed title from [PR #1975] recomp/dxil: f16 signature packing, CFG v_interp modes, bounded movrel/M0[7:0], and MS barriers to [PR #1975] recomp/dxil: CFG v_interp modes, bounded movrel/M0[7:0], and MS barrier guard 2026-11-25 19:07:31 +00:00
raylitebull commented 2026-11-25 19:09:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T18:31:07Z.


Thanks so much for the 442-MS / 362-PS interpolant spec audit, @MacieGx (#issuecomment-7161424965)!

Rescoped and rebased #1975 cleanly onto c9ee916a in commit 72960386:

  • Deferred 100% of f16 interpolant packing to your dedicated MacieGx/xcl#recomp/f16-packed-interpolants branch (recomp/mod.rs, dxil/graphics.rs, dxil/lower_gfx.rs, and dxil/lower_mem.rs are now completely untouched — zero file overlap).
  • Kept #1975 scoped cleanly to (6 files, +1198 / -81):
    1. CFG-aware ps_attr_modes (BasicCfg in emit.rs).
    2. M0[7:0] / M0[23:16] masking and m0_bounds / Lw::value_upper_bound bounded v_movrel*/v_swaprel*/s_movrel* (emit.rs, lower.rs, lower_valu.rs, lower_wide.rs, recomp/tests.rs).
    3. Multi-wave MS non-uniform s_barrier guard (kernel.rs, lower.rs).

Verified locally (cargo check --workspace --tests PASS + 10 passed, 0 failed in 0.18s: fidelity_tests 7/7, saveexec_tests::direct_* 1/1, scalar_relative_move_cluster + v_swaprel_b32_uses_the_m0_relative_switch 2/2) and pushed 72960386.

<!-- greyfinch-sync:ivall/xcl:comment:7171016367 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7171016367). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T18:31:07Z. --- Thanks so much for the 442-MS / 362-PS interpolant spec audit, `@MacieGx` (`#issuecomment-7161424965`)! Rescoped and rebased `#1975` cleanly onto `c9ee916a` in commit `72960386`: - **Deferred 100% of `f16` interpolant packing** to your dedicated `MacieGx/xcl#recomp/f16-packed-interpolants` branch (`recomp/mod.rs`, `dxil/graphics.rs`, `dxil/lower_gfx.rs`, and `dxil/lower_mem.rs` are now completely untouched — zero file overlap). - **Kept `#1975` scoped cleanly to (`6 files, +1198 / -81`):** 1. CFG-aware `ps_attr_modes` (`BasicCfg` in `emit.rs`). 2. `M0[7:0]` / `M0[23:16]` masking and `m0_bounds` / `Lw::value_upper_bound` bounded `v_movrel*`/`v_swaprel*`/`s_movrel*` (`emit.rs`, `lower.rs`, `lower_valu.rs`, `lower_wide.rs`, `recomp/tests.rs`). 3. Multi-wave MS non-uniform `s_barrier` guard (`kernel.rs`, `lower.rs`). Verified locally (`cargo check --workspace --tests` PASS + `10 passed, 0 failed` in `0.18s`: `fidelity_tests` `7/7`, `saveexec_tests::direct_*` `1/1`, `scalar_relative_move_cluster` + `v_swaprel_b32_uses_the_m0_relative_switch` `2/2`) and pushed `72960386`.
MacieGx commented 2026-11-25 22:06:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MacieGx on 2026-11-25T21:14:30Z.


@raylitebull thanks for deferring it. The float16 interpolant part is now its own PR: #2513 (2 commits on main 6d12f58, the layout and table-based MS pairing from my comment above, with tests; full suite and regression runs in its description). Your rebased #1975 head merges cleanly with it; #1976 touches neighbouring lines in dxil/kernel.rs / lower.rs and its direct_dxil_mixed_fp16_interp_preserves_half_across_ssa_phi builds a PsAttr without the new fields, so whichever lands second needs a small rebase.

<!-- greyfinch-sync:ivall/xcl:comment:7174803991 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7174803991). Originally posted by [MacieGx](https://github.com/MacieGx) on 2026-11-25T21:14:30Z. --- @raylitebull thanks for deferring it. The float16 interpolant part is now its own PR: #2513 (2 commits on `main` `6d12f58`, the layout and table-based MS pairing from my comment above, with tests; full suite and regression runs in its description). Your rebased #1975 head merges cleanly with it; #1976 touches neighbouring lines in `dxil/kernel.rs` / `lower.rs` and its `direct_dxil_mixed_fp16_interp_preserves_half_across_ssa_phi` builds a `PsAttr` without the new fields, so whichever lands second needs a small rebase.
DavidM1911 commented 2026-11-26 01:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:42:51Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7179040153 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7179040153). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T00:42:51Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
ClosetPie107 commented 2026-11-26 16:06:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-26T15:08:23Z.


AMD RX 9070 (RDNA4, RADV / Linux) test report on 72960386

Setup

  • AMD Radeon RX 9070 16 GB (RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS (kernel 7.3.5)
  • Proton Experimental (experimental-11.0-20261112), DXVK v3.1.1-209, patched vkd3d-proton master (ec207194, dxil-spirv b540c8a2), DXC 1.9.2609.5
  • Release x86_64-pc-windows-gnu build

Tested

  • Targeted unit & DXIL validation tests (XCL_ADAPTER=9070, --test-threads=1):
    • movrel: 6 passed, 0 failed, 0 ignored, 0 skipped (peak VRAM 701 MiB)
    • m0_bounds: 1 passed, 0 failed, 0 ignored, 0 skipped
    • ps_attr_modes: 1 passed, 0 failed, 0 ignored, 0 skipped
    • non_uniform_barrier: 1 passed, 0 failed, 0 ignored, 0 skipped
    • interp: 2 passed, 0 failed, 0 ignored, 0 skipped

Not tested

  • Full workspace test suite on 72960386, Windows, NVIDIA, retail game run.

AI use

  • T3 Code / Antigravity (Gemini 4 Neon) built the test binary, ran the tests on this machine, and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7195839280 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7195839280). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-26T15:08:23Z. --- **AMD RX 9070 (RDNA4, RADV / Linux) test report on `72960386`** **Setup** - AMD Radeon RX 9070 16 GB (RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS (kernel 7.3.5) - Proton Experimental (`experimental-11.0-20261112`), DXVK `v3.1.1-209`, patched vkd3d-proton `master` (`ec207194`, `dxil-spirv` `b540c8a2`), DXC `1.9.2609.5` - Release `x86_64-pc-windows-gnu` build **Tested** - Targeted unit & DXIL validation tests (`XCL_ADAPTER=9070`, `--test-threads=1`): - `movrel`: **6 passed, 0 failed, 0 ignored, 0 skipped** (peak VRAM `701 MiB`) - `m0_bounds`: **1 passed, 0 failed, 0 ignored, 0 skipped** - `ps_attr_modes`: **1 passed, 0 failed, 0 ignored, 0 skipped** - `non_uniform_barrier`: **1 passed, 0 failed, 0 ignored, 0 skipped** - `interp`: **2 passed, 0 failed, 0 ignored, 0 skipped** **Not tested** - Full workspace test suite on `72960386`, Windows, NVIDIA, retail game run. **AI use** - T3 Code / Antigravity (Gemini 4 Neon) built the test binary, ran the tests on this machine, and drafted this report.
upipibi commented 2026-11-26 16:28:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T16:28:26Z.


Overlap with #803 (open): for v_swaprel_b32 it indexes the source with M0[9:0] and the destination with M0[25:16] (10-bit fields, the RDNA2 ISA pseudocode for VOP1 opcode 104; main already masks v_movrelsd_2_b32 / s_movrelsd_2_b32 with 0x3FF). This PR masks to M0[7:0] / M0[23:16] (0xFF), turns those 0x3FF masks into 0xFF, and its swaprel still writes VDST itself rather than VDST + M0[25:16]. Is the 8-bit width measured on hardware? If not, keeping the ISA's 10 bits and #803's separate destination index looks safer. The two also conflict in emit.rs and tests.rs.

AI-assisted (Claude Code, Claude Opus 5.5): read both diffs and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7197691445 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7197691445). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-26T16:28:26Z. --- Overlap with #803 (open): for `v_swaprel_b32` it indexes the source with M0[9:0] and the destination with M0[25:16] (10-bit fields, the RDNA2 ISA pseudocode for VOP1 opcode 104; `main` already masks `v_movrelsd_2_b32` / `s_movrelsd_2_b32` with 0x3FF). This PR masks to M0[7:0] / M0[23:16] (0xFF), turns those 0x3FF masks into 0xFF, and its `swaprel` still writes VDST itself rather than VDST + M0[25:16]. Is the 8-bit width measured on hardware? If not, keeping the ISA's 10 bits and #803's separate destination index looks safer. The two also conflict in emit.rs and tests.rs. AI-assisted (Claude Code, Claude Opus 5.5): read both diffs and wrote this.
Royalflamejlh commented 2026-11-30 02:51:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-30T02:51:09Z.


@raylitebull this conflicts with main (1c5acde4) in gpu/dxil/{kernel,lower,lower_valu,lower_wide}.rs and gpu/recomp/emit.rs, which keeps it out of the merge queue (#3041). Could you rebase it onto main? The Linux branch in #3067 carries it (without its mesh barrier guard, which main's 2ca91276 covers): with #2229 it gave the world in place of grey there.

AI use: Claude Code (Claude Fable 5.2) made the trial merge and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7267372878 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7267372878). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-11-30T02:51:09Z. --- @raylitebull this conflicts with `main` (`1c5acde4`) in `gpu/dxil/{kernel,lower,lower_valu,lower_wide}.rs` and `gpu/recomp/emit.rs`, which keeps it out of the merge queue (#3041). Could you rebase it onto `main`? The Linux branch in #3067 carries it (without its mesh barrier guard, which `main`'s `2ca91276` covers): with #2229 it gave the world in place of grey there. AI use: Claude Code (Claude Fable 5.2) made the trial merge and wrote this.
Foniass commented 2026-12-01 06:32:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:32:49Z.


Review (head 72960386, diff read, not a merge-check; it conflicts with main and CI / PR description are red, so not built or run):

  • Partly superseded. The mesh barrier guard is replaced by main's safe barrier in both translators (0c02b87b, fb55e49e, f8c01769), and direct DXIL v_movrel M0 & 0xFF is on main (lower_wide.rs ~300, 4a20b256). Still missing on main: the CFG tracking of copied barycentric (I/J) registers for v_interp modes, and the HLSL / s_movrel* M0 masking with the m0_bounds analysis.
  • v_movrelsd_2_b32 / s_movrelsd_2_b32 narrow from M0[9:0] / M0[25:16] (main, both translators) to M0[7:0] / M0[23:16] with no ISA reference (emit.rs ~1743, ~3365; lower_wide.rs ~299; lower.rs ~1609).
  • ps_attr_modes now lets an interpolated mode win over nointerpolation where main keeps the first mode found (emit.rs ~5742); not in the description.
  • Direct DXIL value_upper_bound (lower.rs ~1552) is always given M0 & 0xFF, which it doesn't follow, so non-constant bounds never apply; the test only validates the DXIL.
  • AI use names no model.

Fine: the HLSL m0_bounds dataflow reads as sound (widening caps at branch edges, unknown writes go to u32::MAX). Recommendation: close and re-split into (a) CFG tracking of copied I/J registers for v_interp modes, with a test that fails on main, and (b) HLSL / s_movrel M0 masking plus bounds, citing the ISA for the bit widths.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7302997087 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1975#issuecomment-7302997087). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:32:49Z. --- Review (head 72960386, diff read, not a merge-check; it conflicts with main and CI / `PR description` are red, so not built or run): - **Partly superseded.** The mesh barrier guard is replaced by main's safe barrier in both translators (0c02b87b, fb55e49e, f8c01769), and direct DXIL `v_movrel` M0 & 0xFF is on main (`lower_wide.rs` ~300, 4a20b256). Still missing on main: the CFG tracking of copied barycentric (I/J) registers for `v_interp` modes, and the HLSL / `s_movrel*` M0 masking with the `m0_bounds` analysis. - `v_movrelsd_2_b32` / `s_movrelsd_2_b32` narrow from M0[9:0] / M0[25:16] (main, both translators) to M0[7:0] / M0[23:16] with no ISA reference (`emit.rs` ~1743, ~3365; `lower_wide.rs` ~299; `lower.rs` ~1609). - `ps_attr_modes` now lets an interpolated mode win over nointerpolation where main keeps the first mode found (`emit.rs` ~5742); not in the description. - Direct DXIL `value_upper_bound` (`lower.rs` ~1552) is always given `M0 & 0xFF`, which it doesn't follow, so non-constant bounds never apply; the test only validates the DXIL. - AI use names no model. Fine: the HLSL `m0_bounds` dataflow reads as sound (widening caps at branch edges, unknown writes go to u32::MAX). Recommendation: close and re-split into (a) CFG tracking of copied I/J registers for v_interp modes, with a test that fails on main, and (b) HLSL / s_movrel M0 masking plus bounds, citing the ISA for the bit widths. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
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/1975:upstream-pr/1975'
git switch 'upstream-pr/1975'

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/1975'
git switch 'upstream-pr/1975'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1975'
git switch 'upstream-pr/1975'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1975'
git switch 'main'
git merge --squash 'upstream-pr/1975'
git switch 'main'
git merge --ff-only 'upstream-pr/1975'
git switch 'main'
git merge 'upstream-pr/1975'
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!1965
No description provided.