Skip to content

Recompiler: bridge non-native DPP16/DPP8 VALU ops in the per-lane form - #1845

Open
emirduran707 wants to merge 1 commit into
xcl-dev:mainfrom
emirduran707:recomp-per-lane-dpp-bridge
Open

emirduran707 wants to merge 1 commit into
xcl-dev:mainfrom
emirduran707:recomp-per-lane-dpp-bridge

Conversation

@emirduran707

@emirduran707 emirduran707 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

In the per-lane direct DXIL backend (#1745), non-native VALU instructions with DPP16 or DPP8 modifiers (such as float wave reductions with v_add_f32_dpp / v_max_f32_dpp, or DPP16 source modifiers SRC0_ABS/SRC0_NEG) failed to lower: valu() eagerly ran self.dpp(), DPP source modifiers returned a hard error without the unsupported prefix, and bridge() called Lw::inst_guarded with mask = None, so Lw::exec_mask() read SSA EXEC (register 126) and failed the per-lane register check. Part of #1269.

Ir::foreign now passes an optional active-lane mask through to Lw::inst_guarded. For bridged DPP16/DPP8 instructions, bridge() checks all_lanes when fetch-inactive (FI) is set and passes the half-wave EXEC ballot (exec_words(b, true)). Lw::sources also clamps inactive DPP16/DPP8 source lane indices to self.lane before read_lane_half so WaveReadLaneAt never reads an inactive lane.

What is in it

  • crates/xcl/src/gpu/recomp/lower.rs: add mask: Option<(Self::V, Self::V)> to Ir::foreign; skip eager self.dpp() for non-native VALU opcodes (keeping V_CMP*_dpp refused); in bridge(), enforce all_lanes for FI=1 and pass exec_words(b, true) for DPP16/DPP8.
  • crates/xcl/src/gpu/recomp/lower/wave.rs: make all_lanes and exec_words pub(super); prefix DPP modifier refusal with unsupported so it can bridge.
  • crates/xcl/src/gpu/recomp/lower_dxil.rs: forward mask to self.lw.inst_guarded, and add GPU parity test bridged_dpp_agrees_with_hlsl_on_the_gpu (wave32 and wave64, DPP16, DPP16 SRC0_NEG + ROW_MASK, DPP8, and narrowed EXEC with BOUND_CTRL=0 and BOUND_CTRL=1).
  • crates/xcl/src/gpu/dxil/lower_valu.rs: clamp inactive DPP16/DPP8 source lanes to self.lane before read_lane_half.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on 7385722 (rebased onto main 68a284a): 1288 passed, 3 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record)
    • The 3 failures are pre-existing on unmodified main 68a284a: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722) and fuzz_validate_and_gpu_3 (seed 1599) on this GPU, plus gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier (currently failing on main CI since 50a9fde / Recompiler: a bridged mask write in the split form meets no barrier #2074).
  • bridged_dpp_agrees_with_hlsl_on_the_gpu before the change failed (wave32: unsupported V_ADD_F32 (it reads register 126 the per-lane form did not pass)); passes on both wave32 and native wave64 after

Regression run

main:

xcl-smoke v1
commit: 68a284a596bd558b6bd9db6eedda6d6aa178c360
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1573 (PresentX 1573)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14420 MB

this PR:

xcl-smoke v1
commit: 7385722abd96651d4436f5b7831d7477456a9522
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1620 (PresentX 1620)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16333 MB

Not tested

  • Split wave64 (WaveSize(32)) GPUs (NVIDIA / Intel / wave32-only).
  • V_CMP*_dpp (still refused, since dxil/lower_valu.rs only applies dpp_enable to VGPR destinations).
  • The smoke title's run is a regression check only.

AI use

  • Antigravity with Gemini 4 Neon: found the gap, wrote the change, GPU parity test and this description, and ran the test suite and smoke runs above; later rebased onto main 68a284a (preserving both self.lw.local_masks from Recompiler: a bridged mask write in the split form meets no barrier #2074 and the mask parameter in lower_dxil.rs) and reran the suite and smoke pair.
  • Claude Code with Claude Opus 5.5: earlier rebase onto main 2aa2d1a (resolving a test conflict in crates/xcl/src/gpu/recomp/lower_dxil.rs).

@WebIdentity1

Copy link
Copy Markdown
Contributor

I checked the NVIDIA gap in this PR on exact head e5ccb4968e383dc1ebd40b24e6f414f1b829df6a with the RTX 3090 (Windows 10 19045, driver 591.74, Rust 1.98.1 MSVC debug, DXC 1.8.2502.11). The stock bridged_dpp_agrees_with_hlsl_on_the_gpu passed 1/0/0, but its stderr explicitly says SKIPPED ... bridged_dpp, wave64: no wave64; it exercised only wave32.

I made a test-only overlay in lower_dxil.rs that accepts split wave64 as a supported console program, sets Options::split_wave64 for the HLSL reference, and calls kernel_split for the direct DXIL side. In a fresh desktop-session process with XCL_ADAPTER=3090 and no forced split override, that same test passed 1/0/0, zero skips. Its log shows both wave32 split=false and wave64 split=true; it compared direct-DXIL and HLSL GPU readbacks for v1–v7 on all 64 console lanes. Both 303-file Windows source trees matched their SHA-256 manifests before and after, and there was no timeout or device removal.

This answers the PR's stated wave32-only NVIDIA coverage gap for this synthetic DPP fixture. It does not establish retail rendering, the full workspace suite on this head, or other DPP encodings. The overlay changes only the test; no runtime code was committed or pushed. The small patch is below for integration into this PR if useful.

diff --git a/crates/xcl/src/gpu/recomp/lower_dxil.rs b/crates/xcl/src/gpu/recomp/lower_dxil.rs
index ad258ef..eb81453 100644
--- a/crates/xcl/src/gpu/recomp/lower_dxil.rs
+++ b/crates/xcl/src/gpu/recomp/lower_dxil.rs
@@ -788,13 +788,14 @@ mod tests {
             runner::skip_test("no DXC");
             return;
         }
-        let wave64_ok = runner::wave64_supported() == Ok(true);
+        let wave64_ok = runner::wave64_programs_supported() == Ok(true);
         for w64 in [false, true] {
             let lanes = if w64 { 64 } else { 32 };
             if w64 && !wave64_ok {
                 runner::skip_test("bridged_dpp, wave64: no wave64");
                 continue;
             }
+            let split = w64 && runner::split_wave64();
             let saveexec = if w64 { "S_AND_SAVEEXEC_B64" } else { "S_AND_SAVEEXEC_B32" };
             let movexec = if w64 { "S_MOV_B64" } else { "S_MOV_B32" };
             let lines: &[I] = &[
@@ -830,12 +831,14 @@ mod tests {
                 st.vgpr[l][..regs.len()].copy_from_slice(regs);
             }
             let bytes: Vec<u8> = lines.iter().flat_map(encode_line).collect();
-            let t = translate(&bytes, &Options { wave64: w64, ..Default::default() }).unwrap();
+            let t = translate(&bytes, &Options { wave64: w64, split_wave64: split, ..Default::default() }).unwrap();
             assert!(t.complete(), "wave{lanes}: {:?}", t.unsupported_why);
             let hlsl = runner::run(&dxc::compile(&t.hlsl, "main", "cs_6_6", &["-Gis"]).unwrap(), &st, &[]).unwrap();
             let insts = decode(lines);
-            let (dxil, _) = super::kernel(&insts, w64).unwrap_or_else(|e| panic!("wave{lanes}: {e}"));
+            let (dxil, _) = if split { super::kernel_split(&insts) } else { super::kernel(&insts, w64) }
+                .unwrap_or_else(|e| panic!("wave{lanes} split={split}: {e}"));
             let direct = runner::run(&dxil, &st, &[]).unwrap();
+            println!("bridged DPP: wave{lanes} split={split}");
             for l in 0..lanes {
                 for r in 1..=7 {
                     assert_eq!(direct.vgpr[l][r], hlsl.vgpr[l][r], "wave{lanes}: lane {l} v{r}: {:#x} vs {:#x}", direct.vgpr[l][r], hlsl.vgpr[l][r]);

@frenziedcoder

frenziedcoder commented Nov 24, 2026 •

Copy link
Copy Markdown

NVIDIA test report for e5ccb49: full suite green, its own GPU test skipped here (no wave64), and a clean smoke pair on the retail title (1651 vs 1653 frames).

Tested

  • NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head e5ccb4968e383dc1ebd40b24e6f414f1b829df6a, no local changes.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug): 960 passed, 0 failed, 43 ignored; the PR's own test bridged_dpp_agrees_with_hlsl_on_the_gpu SKIPPED here. SKIPPED: gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu (no wave64), gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu (no wave64), gpu::recomp::lower_dxil::tests::bridged_dpp_agrees_with_hlsl_on_the_gpu (bridged_dpp, wave64: no wave64), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 arithmetic, wave64: no wave64), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu (f16 packed, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 arithmetic, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 compares, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 conversions, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 rounding, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 three-source, wave64: no wave64), gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 transcendentals, wave64: no wave64), gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu (f64, wave64: no wave64), gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu (integer arithmetic, wave64: no wave64), gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu (integer carries, wave64: no wave64), gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • This PR's own GPU test bridged_dpp_agrees_with_hlsl_on_the_gpu SKIPPED on this card (no wave64: NVIDIA runs 32-lane waves only), so the change itself is not exercised by its test here; this report covers the rest of the suite and the smoke pair.
  • test_title_draws_with_a_root_signature_under_the_debug_layer reports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.

Regression run (scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen; XCL_PSO_PRELOAD=0 for both builds, because this machine's preload list holds the program of #1307)

base (c4d37be, this PR's merge base with main):

xcl-smoke v1
commit: c4d37bec1bb4286eb373aea963404a23f13401fa
gpu: NVIDIA GeForce RTX 5080
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1653 (PresentX 1653)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14599 MB

this PR:

xcl-smoke v1
commit: e5ccb4968e383dc1ebd40b24e6f414f1b829df6a
gpu: NVIDIA GeForce RTX 5080
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1651 (PresentX 1651)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14598 MB

Not tested: this code in the title: it is on the opt-in direct-DXIL path (XCL_PER_LANE=1 with XCL_DIRECT_DXIL), which the smoke runs leave unset (default HLSL backend), so they show only that nothing else regressed; the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD.

AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@emirduran707
emirduran707 force-pushed the recomp-per-lane-dpp-bridge branch 2 times, most recently from 7898971 to 0f2344c Compare November 25, 2026 02:28
@JJAutoCompare

Copy link
Copy Markdown

Arc A770 verification for PR #1845

Tested open PR head 0f2344c953f91316a525f28240ddc2edbf6ff5d3. The assigned checkout was clean and detached at that SHA before and after the run. The live PR discussion and issue #42 contained no equivalent Arc report for this revision.

Tested

  • STOR-WINLAB, Windows 11 Enterprise Evaluation 25H2 (26200.9974), Ryzen 7 3800X, Intel Arc A770 (32.0.101.9175). Rust and Cargo 1.100.0 (x86_64-pc-windows-msvc), unoptimized test profile. The fixture logged loading DXC 1.9.2609.5 (01b62ad4) and DXIL 1.9.2609.5 from %LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64.
  • Built with cargo test --locked -p xcl --lib --no-run outside the Arc lock. Used the assigned L:/XclTooling/pr1778-2e2ee55-20261125-020159/target with CARGO_BUILD_JOBS=2, CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, and CARGO_PROFILE_TEST_DEBUG=0. Set XCL_ADAPTER=A770 and XCL_DXC_DIR to the path above.
  • Ran the checked-in fixture in a fresh powershell.exe -NoProfile -ExecutionPolicy RemoteSigned process, using the executable path reported by Cargo:
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & 'L:/XclTooling/pr1778-2e2ee55-20261125-020159/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe' --exact gpu::recomp::lower_dxil::tests::bridged_dpp_agrees_with_hlsl_on_the_gpu --test-threads=1 --nocapture
}
  • Result: 1 passed, 0 failed, 0 ignored, 1 explicit subcase skip in 0.29 s. On wave32, the direct DXIL and HLSL GPU readbacks matched bit for bit across v1–v7 on all 32 lanes (224 comparisons). The full-EXEC cases exercised DPP16 V_ADD_F32 with row_shr:1 and BOUND_CTRL=1, DPP16 V_MAX_F32 with reversed quad permutation, SRC0_NEG=1, ROW_MASK=0xA, and BOUND_CTRL=0, and DPP8 V_ADD_F32 with reversed eight-lane selection and FI=0. With EXEC narrowed to even lanes, the fixture repeated the DPP16 add with BOUND_CTRL=0 and 1 and repeated the DPP8 add, then restored EXEC.
  • The fixture emitted SKIPPED gpu::recomp::lower_dxil::tests::bridged_dpp_agrees_with_hlsl_on_the_gpu: bridged_dpp, wave64: no wave64. This skipped the entire 64-lane iteration before shader compilation, GPU dispatch, or comparisons for those cases.

Not tested

  • Native wave64, split wave64, other DPP encodings, and retail-title rendering.

AI use

  • T3 Code / Codex gpt-6.2-sol ran the fixture and wrote this report.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@thehollowedone

Copy link
Copy Markdown

Independent Windows run on 0f2344c. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug.

cargo build --offline --locked --workspace passed. cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapture reported 1,138 passed, 0 failed, 46 ignored, with 26 runtime skip notices included in Cargo's pass count.

A scratch extension of the checked-in fixture ran both native wave32 and split wave64. HLSL and per-lane Direct DXIL matched across 864 register values. Two additional DPP16/DPP8 fetch-inactive instructions ran with only even lanes in EXEC. Both instruction encodings matched LLVM MC 23.1.6 for gfx1030. All 192 output words for those two instructions matched the CPU reference, including preserved inactive destinations.

cargo test --offline --locked -p xcl --lib bridged_dpp_agrees_with_hlsl_on_the_gpu -- --nocapture --test-threads=1 passed 1/0/0 with zero skips in the scratch run, using XCL_ADAPTER=3080 Ti and XCL_REQUIRE_GPU=wave64. Synthetic split-wave64 coverage on wave32 hardware. AI-assisted. Codex (GPT-6, exact variant unavailable) extended the fixture, ran the tests, and drafted this report.

@jennydeth

Copy link
Copy Markdown

Split wave64 run on a 32-lane NVIDIA card (listed under Not tested).

Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head 0f2344c.

Result: cargo test --workspace -- --test-threads=4: 1138 passed, 0 failed, 46 ignored. SKIPPED: 19 GPU tests for no wave64 (expected on this card); the per-lane f16 arithmetic / f16 packed / f32 conversions cases (per-lane form: refused); heap windows; driver cache cannot be disabled.

Not tested: native wave64; a title run.

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

In the per-lane direct DXIL backend (xcl-dev#1745), non-native VALU instructions
with DPP16 or DPP8 modifiers (such as float wave reductions with
v_add_f32_dpp, v_max_f32_dpp, or DPP source modifiers SRC0_ABS/SRC0_NEG)
failed to lower: `valu()` eagerly ran `self.dpp()`, DPP source modifiers
hard-refused without the `unsupported ` prefix, and `bridge()` called
`Lw::inst_guarded` with `mask = None`, causing `Lw::exec_mask()` to read
SSA EXEC (register 126) and fail the per-lane register check.

`Ir::foreign` now forwards an optional active-lane mask to
`Lw::inst_guarded`. For bridged DPP16/DPP8 instructions, `bridge()` checks
`all_lanes` when fetch-inactive (`FI`) is set and passes the half-wave
EXEC ballot (`exec_words(b, true)`). `Lw::sources` also clamps inactive
DPP16/DPP8 source lane indices to `self.lane` before `read_lane_half` so
`WaveReadLaneAt` never reads an inactive lane.

Assisted-by: Antigravity (Gemini 4 Neon)
@emirduran707
emirduran707 force-pushed the recomp-per-lane-dpp-bridge branch from 0f2344c to 7385722 Compare November 25, 2026 17:14
@emirduran707 emirduran707 reopened this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants