Repository navigation
recomp/dxil: f16 signature packing, CFG v_interp modes, bounded movrel/M0[7:0], and MS barriers - #1975
recomp/dxil: f16 signature packing, CFG v_interp modes, bounded movrel/M0[7:0], and MS barriers#1975raylitebull wants to merge 3 commits into
Conversation
|
Update: verified the author's integration repair at 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. Native Windows 10 19045 / Ryzen 7800X3D / RTX 3090 driver 591.74 / Rust 1.98.1 MSVC / DXC 1.8.2502.11, debug; Original reproducer, proposed patch and earlier resultsVerified the #1961 / #1890 interaction on Tested — native Windows 10 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, DXC 1.8.2502.11, debug;
The patch uses #1961's Integration patch on top of #1975 + #1961diff --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. |
367982c to
b62e6e3
Compare
|
Thanks for catching the Updated Verified locally with |
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Tested Clean PR head 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-outputThe 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 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 ( |
b62e6e3 to
a85fa25
Compare
|
Rebased
|
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
|
Regression run of Against the limits in CONTRIBUTING.md: 104 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
a85fa25 to
f6289cb
Compare
|
Rebased Pushed |
f6289cb to
1447d7e
Compare
|
Rebased Verified locally ( |
…ing, and bounded movrel ranges
…n-uniform MS barriers
1447d7e to
865350c
Compare
|
Rebased Verified locally ( |
|
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:
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 Two ways forward, whichever you and the maintainer prefer:
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. |
Fixes several shader fidelity issues across both the HLSL recompiler and the Direct DXIL translator:
v_interpmode tracking & pairedf16attributes (HIGHbit / packed inputs): tracks interpolation modes across copied, reused, and joinedv_interpregisters, supports 16-bit signature packing/unpacking (from_d3d/place/ps_attribute_slot_and_comp) for VS/MS/PS including compressed VS params and pairedf16PS attributes.v_movrel/v_swaprelranges &M0[7:0]masking: propagatesM0bounds across constants, masks, clamps, and counted loops (m0_bounds), emits bounded switch cases, and masksM0to the low byte (M0[7:0]) in both HLSL and Direct DXIL (Lw::movrel/Lw::swaprelinlower_wide.rsviaself.top_vgpr()).s_barrierusage in mesh shaders (has_non_uniform_barrier) in both backends.Part of #1269.
What is in it
crates/xcl/src/gpu/recomp/mod.rs&crates/xcl/src/gpu/recomp/emit.rs: addps_attribute_slot_and_compandf16paired-attribute unpacking, CFGv_interpmode tracking,m0_boundsanalysis andM0[7:0]masking forv_movrel/v_swaprel, bounded switch generation, and non-uniform mesh barrier handling (has_non_uniform_barrier), preserving#2008'sif let Some(e)EXP VMsurvival flow alongside 16-bitSV_Targetcomponent types.crates/xcl/src/gpu/dxil/graphics.rs,kernel.rs,lower.rs,lower_gfx.rs,lower_mem.rs,lower_valu.rs,lower_wide.rs: 16-bit signature row packing/unpacking in Direct DXIL (VS/MS/PS),M0[7:0]masking andconst_u64/value_upper_boundrange-narrowing insideLw::movrel/Lw::swaprel, non-uniform MS barrier guarding, and#21745-argtranslate_entry(..., None, None)alignment inkernel.rs::translate_mesh.crates/xcl/src/gpu/recomp/tests.rs&fidelity_tests/attribute_tests: 19 targeted tests acrossgpu::dxil::graphics::fidelity_tests,gpu::dxil::lower_valu::fidelity_tests,gpu::recomp::emit::fidelity_tests, andgpu::recomp::attribute_tests, plusv_swaprel_b32_uses_the_m0_relative_switch.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), DXCdxcompiler 1.8.2502.11/dxil 1.8.2502.11, rebased cleanly onto1c17aa55(865350cc).cargo check --workspace --tests: passed (0warnings in touched files).cargo test -p xcl --lib fidelity_tests: 19 passed, 0 failed (dxil 1.8.2502.11validated).cargo test -p xcl --lib attribute_tests: 4 passed, 0 failed.Regression run
scripts/smoke.ps1pair on865350ccvs1c17aa55has not been run yet. AMD and NVIDIA reviewers are invited to test on865350ccvs1c17aa55(includingscripts/smoke.ps1,XCL_DIRECT_DXIL=1, and HLSL recompilation paths) and post results in the comments.Not tested
scripts/smoke.ps1pair on865350cc, fullcargo test --workspacesuite on865350cc, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use
1c17aa55, and DXIL/recompiler validation tests; the author reviewed the diff and test output.