Repository navigation
Recompiler: bridge non-native DPP16/DPP8 VALU ops in the per-lane form - #1845
emirduran707 wants to merge 1 commit into
Conversation
|
I checked the NVIDIA gap in this PR on exact head I made a test-only overlay in 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]); |
|
NVIDIA test report for Tested
Regression run ( base ( this PR: Not tested: this code in the title: it is on the opt-in direct-DXIL path ( 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. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
7898971 to
0f2344c
Compare
Arc A770 verification for PR #1845Tested open PR head Tested
& '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
}
Not tested
AI use
|
|
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.
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.
|
|
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)
0f2344c to
7385722
Compare
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 modifiersSRC0_ABS/SRC0_NEG) failed to lower:valu()eagerly ranself.dpp(), DPP source modifiers returned a hard error without theunsupportedprefix, andbridge()calledLw::inst_guardedwithmask = None, soLw::exec_mask()read SSA EXEC (register 126) and failed the per-lane register check. Part of #1269.Ir::foreignnow passes an optional active-lane mask through toLw::inst_guarded. For bridged DPP16/DPP8 instructions,bridge()checksall_laneswhen fetch-inactive (FI) is set and passes the half-wave EXEC ballot (exec_words(b, true)).Lw::sourcesalso clamps inactive DPP16/DPP8 source lane indices toself.lanebeforeread_lane_halfsoWaveReadLaneAtnever reads an inactive lane.What is in it
crates/xcl/src/gpu/recomp/lower.rs: addmask: Option<(Self::V, Self::V)>toIr::foreign; skip eagerself.dpp()for non-native VALU opcodes (keepingV_CMP*_dpprefused); inbridge(), enforceall_lanesforFI=1and passexec_words(b, true)for DPP16/DPP8.crates/xcl/src/gpu/recomp/lower/wave.rs: makeall_lanesandexec_wordspub(super); prefix DPP modifier refusal withunsupportedso it can bridge.crates/xcl/src/gpu/recomp/lower_dxil.rs: forwardmasktoself.lw.inst_guarded, and add GPU parity testbridged_dpp_agrees_with_hlsl_on_the_gpu(wave32 and wave64, DPP16, DPP16SRC0_NEG+ROW_MASK, DPP8, and narrowed EXEC withBOUND_CTRL=0andBOUND_CTRL=1).crates/xcl/src/gpu/dxil/lower_valu.rs: clamp inactive DPP16/DPP8 source lanes toself.lanebeforeread_lane_half.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on 7385722 (rebased ontomain68a284a): 1288 passed, 3 failed, 46 ignored; 8 SKIPPED (6 inlower_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)main68a284a:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599) on this GPU, plusgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(currently failing onmainCI since50a9fde/ Recompiler: a bridged mask write in the split form meets no barrier #2074).bridged_dpp_agrees_with_hlsl_on_the_gpubefore 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 afterRegression run
main:
this PR:
Not tested
WaveSize(32)) GPUs (NVIDIA / Intel / wave32-only).V_CMP*_dpp(still refused, sincedxil/lower_valu.rsonly appliesdpp_enableto VGPR destinations).AI use
main68a284a(preserving bothself.lw.local_masksfrom Recompiler: a bridged mask write in the split form meets no barrier #2074 and themaskparameter inlower_dxil.rs) and reran the suite and smoke pair.main2aa2d1a(resolving a test conflict incrates/xcl/src/gpu/recomp/lower_dxil.rs).