Recompiler: translate v_mullit_f32 and v_cvt_off_f32_i4 as RDNA2 runs them #2232
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by NWProgramming00 on 2026-11-25T11:08:30Z.
Both 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
Imported from ivall/xcl. Originally posted by GustavoEllwanger on 2026-11-25T13:14:59Z.
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.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T16:42:10Z.
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!
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T21:00:42Z.
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
Imported from ivall/xcl. Originally posted by NWProgramming00 on 2026-11-26T16:54:18Z.
The failed "Build and test" run (2026-11-25 18:31) is not from this PR. It ran on the merge ref while
mainwas mid-churn, and its two failures are tests this PR does not touch:gpu::recomp::pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translatorhle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaaChecked today on Windows 11 with an RTX 5070 Ti, release. I merged
d7df3f9into currentmain8b957be; the merge was clean.cargo test --release -p xcl --lib:main8b957bealone: 1314 passed, 4 failed.fuzz_validate_and_gpu_0..3, the NVIDIA fuzz failures tracked in #1905.gpu_mullit_and_cvt_off_match_rdna2.Could a maintainer re-run the job? I left the head as it is, so the independent reports on
d7df3f9still apply.AI use: Claude Code (Claude Opus 5.5) ran the merge and the tests and wrote this.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:08:40Z.
Tested: Clean
d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8, Windows 11 build 26200, Ryzen 7 3800X, Rust 1.100.0 MSVC, debug, Intel Arc A770 driver 32.0.101.9175, DXC 1.9.2602.17.cargo test --locked -j 2 -p xcl --lib --no-run, then the built test withgpu::recomp::tests::gpu_mullit_and_cvt_off_match_rdna2 --exact --nocapture --test-threads=1. WithXCL_ADAPTER=A770, 1 passed, 0 failed, 0 ignored, 0 skips. HLSL/DXC and direct DXIL both matched all 64v_mullit_f32and 64v_cvt_off_f32_i4results bit for bit against the checked-in gfx1036 expectations. Both ran split wave64.Not tested: Native wave64 arithmetic, full workspace suite, and retail smoke.
AI use: T3 Code / Codex (
gpt-6.2-sol) ran and independently reran the checks and drafted this report.Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T05:52:45Z.
Independent desktop NVIDIA verification of PR #2241 at head
d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8(1commit; exact parent & merge-base:568e7db7729c8fa6c8f0f4b32d798faaf11462bb, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
d7df3f9f)cargo test --release -p xcl --lib gpu_mullit_and_cvt_off_match_rdna2 -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1124 filtered out× 3 (0.24s,0.21s,0.21s,0skipped; live RTX 4060 execution checking both HLSL and direct-DXIL backends)cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4(3 consecutive runs)122 passed; 0 failed; 3 ignored; 1000 filtered out× 3 (3.07s,3.06s,3.08s,0skipped)cargo build --release -p xcl1m 02s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
568e7db7729c8fa6c8f0f4b32d798faaf11462bb, same machine):PR #2241 (
d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8):Limits of coverage
v_mullit_f32andv_cvt_off_f32_i4were directly verified on desktop RTX 4060 viagpu_mullit_and_cvt_off_match_rdna2(3/3,0skipped) andgpu::dxil::(122/122× 3); as noted by the author, rows with a NaNS0or denormals are omitted from that fixture.title: 29640639(single-run frame/commit delta vs. parent reflects normal startup variance, not this PR).AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-27T06:39:24Z.
RX 9070 / RADV / Wine verification of exact head
d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8, current mainc2ee10e4e905eb736e56953c52b749e18bcc7edeand the PR automatically applied to that main. This adds special-value and NaN-class coverage through both backends on this stack.Tested
26.3.1-arch3.5, Ryzen 7 7700, CachyOS7.3.0-5-cachyos. Windows GNU release executables, Rust1.97.1, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton8293130ebe370b1+(local asserts-disabled build), DXC/DXIL1.9.2602.17.568e7db7729c8fa6c8f0f4b32d798faaf11462bb. Test-only translation/container/readback captures and owned fixtures. Production code, original tables and assertions preserved; main gets the identical original test and tables.cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.<unit.exe> gpu_mullit_and_cvt_off_match_rdna2 --nocapture --test-threads=1, then--test-threads=4.Main fails the HLSL translation assertion before GPU execution, recording both instructions as unsupported. Head/integration execute both original backends in native wave64; all 64 lane results for each instruction match the checked-in goldens and an independent recomputation.
Additional owned filter
<unit.exe> workflow_special_value_matrix --nocapture --test-threads=1, three fresh processes per source. Head/integration: 1 passed, 0 failed in all six runs. Each runs HLSL/DXC and direct DXIL separately in native wave32, native wave64 and split wave64:V_MULLIT_F32: 24 × 24 × 13 = 7,488 triples per configuration. S0/S1 include signed zeros, signed finite values from2^-16through2^16, signed max-finite, infinities, and positive/negative signaling and quiet NaNs. S2 includes zeros, positive/negative finite values, infinities and both NaN classes.V_CVT_OFF_F32_I4: 16 independent inputs per lane row, 119,808 conversions per configuration. These include all 65,536 low-word patterns with mixed upper-word tags. Results match the signed low nibble divided by 16, bit-for-bit.Across the six GPU matrix runs: 269,568 mullit outputs and 4,313,088 conversion outputs agree with the reference. This includes 11,520 quiet-NaN class checks. NaN payload bits are archived but are not an assertion: finite/infinite results and signed-zero behavior are checked exactly, while NaN results require the IEEE NaN class and quiet bit.
The finite multiplication oracle independently multiplies the binary32 integer significands and performs exact round-to-nearest-even. No denormal inputs or products are included. The full input cross-product checks the S1/S2 sentinel rules, including their priority over legacy zero multiplication. Raw captures repeat identically within each source; head and current-main integration agree after normalizing only NaN payloads for comparison.
Main's additional filter passes explicit CPU translation-refusal controls in all three modes for both backends: 0 matrix GPU dispatches. It does not claim GPU support for those instructions.
Across original and owned groups: 5,636 captured GPU dispatches, including 12 physical-width probes and 1,418 physical native-wave64 dispatches. Independently verified 19,152,368 words, including result/input registers, inactive physical lanes, 16 SGPR and 16 VGPR guards, unchanged SCC and complete memory readbacks. Programs were independently re-encoded from the public ISA tables; shader metadata and physical widths agree. 0 ignored, 0 skipped, no device-removal markers.
Inherited
XCL_*cleared;XCL_NETWORK=0, RX 9070 selected,XCL_REQUIRE_GPU=wave64,XCL_DXC_THREADS=1; private enabled caches per process. Both original and owned tests explicitly select their translation paths.Not tested
Denormal operands/results, non-default f32 rounding modes, packed/source modifiers, raw RDNA4 ISA measurements, graphics-stage or guest Compute ABI execution, full suite, native Windows, other GPUs, retail workload,
scripts/smoke.ps1, timing or FPS. The special-value reference follows the stated RDNA2 contract.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and captures, ran comparisons, independently verified IEEE multiplication/rounding, NaN classes, nibble conversion, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner.
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T22:28:39Z.
merge-check claim
head:
d7df3f9faeImported from ivall/xcl. Originally posted by throny on 2026-11-27T23:13:01Z.
merge-check
base:
2c717a04head:
d7df3f9faemerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1467 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1466 passed, 0 failed, 47 ignored
review: no defect found. Opcodes and operand counts match the repo's spec table (which has no semantics to check against). The offset conversion (sign-extended low four bits times 1/16) is exact. For the multiply: the bit test gives the negative maximum for a zero, negative or NaN third operand and treats +inf as positive, in line with the hardware rows in the PR. Only hardware can confirm: those rows themselves, a positive denormal third operand (counted as positive here; hardware that flushes denormals may differ) and NaN payloads. The test fails without the change (the translation was refused before).
performance: none at frame time. It changes a translator source: every tester re-translates all shaders once.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T03:53:41Z.
merge-check claim
head:
d7df3f9faeImported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T11:32:58Z.
merge-check claim
head:
d7df3f9faeImported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T11:37:41Z.
merge-check
base:
e429936c10head:
d7df3f9faemerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2125 passed, 11 failed, 48 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_whole, gpu::dxil::module::split::tests::dispatch_chain_wave32_live_loops, gpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchange, gpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_output, gpu::recomp::tests::gpu_compute_mode_dispatch_abi, gpu::recomp::tests::gpu_float_cas_uses_ieee_equality, test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer, test_title_runs_under_the_debug_layer_with_dred: these 9 fail on the base too (the base e429936c's suite, run alone on this PC with the same command: 2126 passed, 9 failed, 48 ignored, 25 SKIPPED, these same 9 failing), and each also failed when rerun alone on this merge (the two debug-layer e2e tests stop on the D3D12 debug layer rejecting a pixel shader as corrupt or unsigned, and test_title_runs_and_game_folder_is_untouched on the test title's console command list memory-methods check, "post-Wait32/64 write failed"); not caused by this PR; also failing: two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, under the concurrent load only: rerun alone on the same merge commit it passed (1 passed, 0 failed); and hle::kernelx::tests::fine_timer_makes_short_sleeps_short (a sleep-timing test): it also failed its first rerun alone, part of the batch job, and passed a later rerun alone in its own queued job (cargo test -p xcl --lib : 1 passed, 0 failed); it passed on the base; the diff (recompiler only) does not touch either test or the code they test. The suite ran on this PC at the same time as 4 other PRs' suites, in one queued job.
review: none. Whole diff read (lower_valu.rs and emit.rs: v_cvt_off_f32_i4 and v_mullit_f32 on both the direct DXIL and HLSL paths, the HLSL prelude's mullit; tests.rs GPU test against values read from RDNA2 hardware). The two lowerings agree with each other and with the table (c not above +0 or NaN, or b = -MAX_FLOAT / -inf / NaN, gives -MAX_FLOAT; else the legacy multiply with 0 * anything = +0); cvt_off sign-extends bits 3:0 and scales by 1/16. The test ran here in the split wave64 form (no native wave64).
performance: reasoned, not measured: shader translation only; two more instructions translate; no change to existing shaders.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 22b3a2f4a2de78277eaace07525a8f61d6c1c355 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).
correction (2026-11-28): the base counts above were first given as 2128 passed: that base run reused this PC's merge test binary (one cargo target dir for both sides). The base was rerun with its own target dir; the same 9 tests fail on it, so the classification and the verdict stand.