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 f65c9d5b (rebased onto main 08db8020): 1428 passed, 2 failed, 47 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 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.
  • 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 (b49be183):

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

this PR (f65c9d5b):

xcl-smoke v1
commit: f65c9d5b700aa7d8e61c81380c63f02676b30c48
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18619 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 08db8020 and reran the full workspace 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.

@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

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No source-level blocker found. DPP fallback/bridge EXEC handling and inactive-lane semantics look correct; differential GPU coverage is meaningful. Gap: no DPP8 SRC0=0xEA or DPP16 FI=1 case, which takes all_lanes path—add especially for split wave64. Current Windows CI is red from an apparently unrelated pre-existing bridged-mask barrier test; rerun/triage to establish clean merge evidence.

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 7385722 to f65c9d5 Compare November 25, 2026 23:43
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

— Devin

@zhouzhidong3-hash

Copy link
Copy Markdown

RTX 5070 / current-head synthetic follow-up to the FI coverage suggestion, complementing the earlier RTX 3080 Ti scratch report on 0f2344c.

What was checked

Runtime head f65c9d5b700aa7d8e61c81380c63f02676b30c48 plus the test-only scratch fixture below. No implementation edits. Windows 10 Pro 19045, i7-12700KF, NVIDIA GeForce RTX 5070 / 591.86 (adapter identity printed by the fixture), Rust 1.100.0 MSVC debug, DXC/DXIL 1.8.2502.11 and local Agility SDK. Explicit XCL_ADAPTER=5070, XCL_DIRECT_DXIL=all.

The fixture executes both native wave32 and split wave64 on wave32 hardware: HLSL explicitly sets Options::split_wave64, and the per-lane route calls kernel_split, not kernel(..., true). It does not use the checked-in fixture's native-wave64 skip as coverage.

With EXEC narrowed to even lanes and v1 = lane + 1, inactive odd source lanes still hold distinct values. Six DPP adds cover:

  • DPP16 quad reversal with FI=1, and matching FI=0/bound=1 control.
  • DPP8 reversed lanes with SRC0=0xEA (FI) and 0xE9 (non-FI) control.
  • DPP16 row-shr:1 with FI=1, bound=0 and bound=1, including each row's invalid first source.
  • Inactive destination lanes retain a -99.0 sentinel in every case.

Actual results

cargo test --locked -p xcl --lib gpu_probe_bridged_dpp_fi_wave32_and_split64 -- --test-threads=1 --nocapture
head + fixture: 1 passed, 0 failed, 0 ignored, 1332 filtered; no SKIPPED; 0.36 s
Executed form CPU-expected output words per backend HLSL Per-lane direct DXIL
Native wave32 192 exact match exact match
Split wave64, two wave32 halves 384 exact match exact match

That is 576 expected output words per backend / 1,152 bitwise CPU checks in total. Both FI-on/off assertions also distinguish the two behaviors. This uses explicit CPU arithmetic and inactive/boundary rules, rather than only comparing the two backends with each other.

Parent control: the identical fixture on official main 08db8020d323bf478964fcc586152cce54959cfc reports 0 passed, 1 failed, 0 ignored, 1331 filtered / exit101. It reaches the wave32 per-lane translation and fails with unsupported V_ADD_F32 (it reads register 126 the per-lane form did not pass). Parent direct GPU dispatch and split64 are not reached; this is a lowering-gap control, not a parent GPU output mismatch.

The six instruction pairs were also repacked independently from AMD's RDNA2 ISA tables 76,90-92: raw FI bit50, raw bound bit51, DPP8FI source234. They match the bytes logged by both forms. This was a manual-spec bit check, not an LLVM-MC or native-RDNA execution result.

Head archive SHA256 cc7f85c8428c8ce888ab5db07bc807145aab36af16c34336e580b665768867b6; all four PR-file Git blobs match the GitHub API. After each run the entire original source file was restored byte-for-byte; all 209 Rust-file hashes match the corresponding pristine archive on each tree.

Not tested

Native wave64 hardware, a full suite on this head, release-host builds, retail/smoke/gameplay, performance, other DPP patterns/modifiers, and FI inside partial control-flow blocks. One process per tree for the final fixture; earlier development runs are not included in these counts. This is focused scratch coverage, not merge approval.

AI use

OpenAI Codex (GPT-6; exact serving variant unavailable) wrote the test-only fixture/CPU expectations, independently checked instruction fields against the AMD reference, ran the parent/head tests, verified original-source restoration, and prepared this report.

Complete test-only patch on f65c9d5 (no runtime changes)
--- a/crates/xcl/src/gpu/recomp/lower_dxil.rs
+++ b/crates/xcl/src/gpu/recomp/lower_dxil.rs
@@ -1002,6 +1002,94 @@
         }
     }
 
+    /// Scratch coverage for review #1845: inactive sources must remain readable with FI,
+    /// while inactive destinations and out-of-row sources retain their separate rules.
+    #[test]
+    fn gpu_probe_bridged_dpp_fi_wave32_and_split64() {
+        if !gpu() { return; }
+        if dxc::location().is_err() {
+            runner::skip_test("no DXC");
+            return;
+        }
+        println!("PROBE adapter={}", runner::adapter().unwrap());
+        for w64 in [false, true] {
+            let lanes = if w64 { 64 } else { 32 };
+            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] = &[
+                ("V_ADD_NC_U32", "ENC_VOP2", &[("VDST", 1), ("SRC0", 129), ("VSRC1", 0)]),
+                ("V_CVT_F32_U32", "ENC_VOP1", &[("VDST", 1), ("SRC0", 257)]),
+                ("V_AND_B32", "ENC_VOP2", &[("VDST", 8), ("SRC0", 129), ("VSRC1", 0)]),
+                ("V_CMP_EQ_U32", "ENC_VOPC", &[("SRC0", 128), ("VSRC1", 8)]),
+                (saveexec, "ENC_SOP1", &[("SDST", 4), ("SSRC0", 106)]),
+                // Quad reversal sends each active even destination to an inactive odd source.
+                ("V_ADD_F32", "VOP2_VOP_DPP16", &[("VDST", 2), ("SRC0", 0xFA), ("VSRC0", 1), ("VSRC1", 1), ("DPP_CTRL", 0x1B), ("ROW_MASK", 0xF), ("BANK_MASK", 0xF), ("BOUND_CTRL", 1), ("FI", 1)]),
+                // DPP8FI is SRC0=234; the non-FI negative control below is SRC0=233.
+                ("V_ADD_F32", "VOP2_VOP_DPP8", &[("VDST", 3), ("SRC0", 0xEA), ("VSRC0", 1), ("VSRC1", 1), ("LANE_SEL_0", 7), ("LANE_SEL_1", 6), ("LANE_SEL_2", 5), ("LANE_SEL_3", 4), ("LANE_SEL_4", 3), ("LANE_SEL_5", 2), ("LANE_SEL_6", 1), ("LANE_SEL_7", 0)]),
+                ("V_ADD_F32", "VOP2_VOP_DPP16", &[("VDST", 4), ("SRC0", 0xFA), ("VSRC0", 1), ("VSRC1", 1), ("DPP_CTRL", 0x1B), ("ROW_MASK", 0xF), ("BANK_MASK", 0xF), ("BOUND_CTRL", 1), ("FI", 0)]),
+                ("V_ADD_F32", "VOP2_VOP_DPP8", &[("VDST", 5), ("SRC0", 0xE9), ("VSRC0", 1), ("VSRC1", 1), ("LANE_SEL_0", 7), ("LANE_SEL_1", 6), ("LANE_SEL_2", 5), ("LANE_SEL_3", 4), ("LANE_SEL_4", 3), ("LANE_SEL_5", 2), ("LANE_SEL_6", 1), ("LANE_SEL_7", 0)]),
+                // FI does not make an out-of-row lane valid: bound=0 preserves, bound=1 uses 0.
+                ("V_ADD_F32", "VOP2_VOP_DPP16", &[("VDST", 6), ("SRC0", 0xFA), ("VSRC0", 1), ("VSRC1", 1), ("DPP_CTRL", 0x111), ("ROW_MASK", 0xF), ("BANK_MASK", 0xF), ("BOUND_CTRL", 0), ("FI", 1)]),
+                ("V_ADD_F32", "VOP2_VOP_DPP16", &[("VDST", 7), ("SRC0", 0xFA), ("VSRC0", 1), ("VSRC1", 1), ("DPP_CTRL", 0x111), ("ROW_MASK", 0xF), ("BANK_MASK", 0xF), ("BOUND_CTRL", 1), ("FI", 1)]),
+                (movexec, "ENC_SOP1", &[("SDST", 126), ("SSRC0", 4)]),
+                ("S_ENDPGM", "ENC_SOPP", &[]),
+            ];
+            let insts = decode(lines);
+            let dpp: Vec<_> = insts.iter().filter(|d| matches!(d.variant,
+                crate::gpu::rdna2::Variant::Dpp16 | crate::gpu::rdna2::Variant::Dpp8)).collect();
+            assert_eq!(dpp.len(), 6);
+            let ext = super::super::emit::ext_encoding(dpp[0]).unwrap();
+            assert_eq!(crate::gpu::rdna2::field_value(ext, &dpp[0].words, "FI"), Some(1));
+            assert_eq!(crate::gpu::rdna2::field_value(dpp[1].enc, &dpp[1].words, "SRC0"), Some(0xEA));
+            println!("PROBE wave{lanes} split={w64} DPP words={:?}",
+                dpp.iter().map(|d| &d.words).collect::<Vec<_>>());
+
+            let (s, v) = state(lanes);
+            let mut st = runner::KernelState::default();
+            st.sgpr.copy_from_slice(&s);
+            let sentinel = (-99.0f32).to_bits();
+            for (l, regs) in v.iter().enumerate() {
+                st.vgpr[l][..regs.len()].copy_from_slice(regs);
+                for r in 2..=7 { st.vgpr[l][r] = sentinel; }
+            }
+            let bytes: Vec<u8> = lines.iter().flat_map(encode_line).collect();
+            let tr = translate(&bytes, &Options { wave64: w64, split_wave64: w64, ..Default::default() }).unwrap();
+            assert!(tr.complete(), "wave{lanes}: {:?}", tr.unsupported_why);
+            let hlsl_dxil = dxc::compile(&tr.hlsl, "main", "cs_6_6", &["-Gis"]).unwrap();
+            let hlsl = runner::run(&hlsl_dxil, &st, &[]).unwrap();
+            let (dxil, _) = if w64 { super::kernel_split(&insts) } else { super::kernel(&insts, false) }
+                .unwrap_or_else(|e| panic!("wave{lanes}: {e}"));
+            if crate::gpu::dxil::validate::validator_supported() {
+                crate::gpu::dxil::validate::validate(&dxil).unwrap();
+            }
+            let direct = runner::run(&dxil, &st, &[]).unwrap();
+            let mut comparisons = 0usize;
+            for l in 0..lanes {
+                let x = (l + 1) as f32;
+                let mut expected = [sentinel; 6];
+                if l % 2 == 0 {
+                    let q = (l & !3) + 3 - (l & 3);
+                    let e = (l & !7) + 7 - (l & 7);
+                    expected[0] = (x + (q + 1) as f32).to_bits();
+                    expected[1] = (x + (e + 1) as f32).to_bits();
+                    expected[2] = x.to_bits();
+                    expected[3] = x.to_bits();
+                    expected[4] = if l % 16 == 0 { sentinel } else { (x + l as f32).to_bits() };
+                    expected[5] = if l % 16 == 0 { x.to_bits() } else { (x + l as f32).to_bits() };
+                }
+                for (r, want) in (2..=7).zip(expected) {
+                    assert_eq!(hlsl.vgpr[l][r], want, "HLSL wave{lanes} lane{l} v{r}");
+                    assert_eq!(direct.vgpr[l][r], want, "per-lane wave{lanes} lane{l} v{r}");
+                    comparisons += 1;
+                }
+            }
+            assert_ne!(direct.vgpr[0][2], direct.vgpr[0][4], "DPP16 FI must matter");
+            assert_ne!(direct.vgpr[0][3], direct.vgpr[0][5], "DPP8 FI must matter");
+            println!("PROBE wave{lanes} split={w64}: {comparisons} CPU-expected words per backend, both passed");
+        }
+    }
+
+
     /// With the runtime's four memory windows (`compute_with`), the memory instructions go
     /// through #1426's window switch (blocks of its own in the `Ir` block) and the program
     /// still gives the CPU lowering's memory.

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.

10 participants