Recompiler: translate v_mullit_f32 and v_cvt_off_f32_i4 as RDNA2 runs them #2241
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2241
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2241"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@NWProgramming00 on GitHub · 2026-11-25 11:08 UTC · original
NWProgramming00:recomp/mullit-cvt-off→main· +181 −0 · 3 files · 1 commits · openBoth backends refused
v_mullit_f32(VOP3) andv_cvt_off_f32_i4(VOP1). This translates both as RDNA2 hardware runs them. I measured the hardware first, because the ISA text forv_mullit_f32does not spell out its special cases.Measured on an RDNA2 gfx1036 (2,656 input rows: 18 special S0 / S1 values × 8 S2 values, plus 64
cvt_offinputs with high bits set):v_cvt_off_f32_i4: bits 3:0 are a signed 4-bit number in sixteenths (1→ 0.0625,8→ -0.5,15→ -0.0625). Bits 31:4 are ignored.v_mullit_f32:0xff7fffff) when S2 is not above +0 (that is, +0, -0, negative or NaN), or when S1 is -MAX_FLOAT, -inf or NaN.v_mul_legacy_f32. For example, 0 × +inf = +0 and 0 × -1 = +0.What is in it
crates/xcl/src/gpu/recomp/emit.rs: both instructions, plus amullit()helper in the HLSL prelude. It decides on the operand bits, so no float compare can be folded away.crates/xcl/src/gpu/dxil/lower_valu.rs: the same rule in the direct DXIL translator.crates/xcl/src/gpu/recomp/tests.rs:gpu_mullit_and_cvt_off_match_rdna2runs both backends (HLSL + DXC, and direct DXIL) and checks them against hardware values:v_mullit_f32rows: every special S1 with a positive S2, every S2, every non-NaN S0, and the zero products;v_cvt_off_f32_i4inputs.Tested
XCL_ADAPTER=radeon). Rust 1.100 MSVC, release.v_cvt_off_f32_i4: 2656/2656 equal everywhere.v_mullit_f32: 2458 equal on the RTX 5070 Ti and 2488 on the Radeon, in each backend. Every other row is either a NaN result that differs only in payload bits (60 / 30) or a row with a denormal (138). No other difference.S2 < 0only (HLSL);cvt_offscale changed (direct DXIL).cargo build --release --workspace, thencargo test --release --workspace --no-fail-fast -- --test-threads=4, with and withoutXCL_DIRECT_DXIL=all, against base568e7dbon the same machine:568e7dbd7df3f9)XCL_DIRECT_DXIL=allXCL_DIRECT_DXIL=allThe +1 is the new test. The failing tests are the same on base and PR, and all are tracked:
fuzz_validate_and_gpu_0..3on NVIDIA (#1905),fuzz_validate_and_gpu_1seed 540 on RDNA2 (#2115, #2170),gpu_image_get_resinfo_1d_arraywith direct DXIL (#2046) andoffline_compute_pipeline_is_reused_by_a_second_processwith direct DXIL (#1674).Regression run
Base (
main06c9f55), NVIDIA GeForce RTX 5070 Ti:This PR (
d7df3f9), same card:Earlier runs here ended at about 44 s on
mainand on this PR alike. The cause was #695: this PC had no active playback device. With one active, both runs reach their end.Not tested
v_mullit_f32in a program that sets a non-default f32 rounding mode. The rounding-mode path (valu_f32_rm) does not cover it, so it rounds to nearest.AI use
🤖 Generated with Claude Code
@GustavoEllwanger on GitHub · 2026-11-25 13:14 UTC · original
Independent dual-GPU Windows verification on exact PR head
d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8(parent568e7db), testing both HLSL (XCL_DIRECT_DXIL=0) and direct DXIL (XCL_DIRECT_DXIL=1) on AMD RDNA2 and NVIDIA Blackwell.Tested
1.95.0 (59807616e 2026-04-14), DXC1.8.2502.11, debug build.32.0.21042.62, native wave64):XCL_ADAPTER=Radeon XCL_DIRECT_DXIL=0 cargo test -p xcl --lib gpu::recomp::tests::gpu_mullit_and_cvt_off_match_rdna2 -- --nocapture: 1 passed, 0 failed, 0 ignored (0 skipped).XCL_ADAPTER=Radeon XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests::gpu_mullit_and_cvt_off_match_rdna2 -- --nocapture: 1 passed, 0 failed, 0 ignored (0 skipped).32.0.16.1088, wave32 / split-wave64):XCL_ADAPTER=5060 XCL_DIRECT_DXIL=0 cargo test -p xcl --lib gpu::recomp::tests::gpu_mullit_and_cvt_off_match_rdna2 -- --nocapture: 1 passed, 0 failed, 0 ignored (0 skipped).XCL_ADAPTER=5060 XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests::gpu_mullit_and_cvt_off_match_rdna2 -- --nocapture: 1 passed, 0 failed, 0 ignored (0 skipped).XCL_ADAPTER=5060 cargo test -p xcl --lib gpu::recomp::tests:: -- --test-threads=4: 148 passed, 0 failed, 17 ignored (2 runtimeSKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware—no wave64).XCL_ADAPTER=5060 cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4: 122 passed, 0 failed, 3 ignored (0 skipped).Not tested
scripts/smoke.ps1), full workspace run, Intel GPUs, non-Windows hosts.AI use
d7df3f9, rangpu_mullit_and_cvt_off_match_rdna2across HLSL and direct DXIL on both GPUs plusgpu::recomp::tests::andgpu::dxil::on RTX 5060, and drafted this comment from the raw logs.@DavidM1911 on GitHub · 2026-11-25 16:42 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@emirduran707 on GitHub · 2026-11-25 21:00 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1153 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.gpu::recomp::tests::gpu_mullit_and_cvt_off_match_rdna2.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.