Repository navigation
Recompiler: translate v_mullit_f32 and v_cvt_off_f32_i4 as RDNA2 runs them - #2241
NWProgramming00 wants to merge 1 commit into
Conversation
… them Both instructions were refused by both backends. Their behaviour was measured on an RDNA2 gfx1036 (2,656 rows): - v_cvt_off_f32_i4: bits 3:0 as a signed 4-bit number in sixteenths (-0.5 .. 0.4375); bits 31:4 are ignored. - v_mullit_f32: -MAX_FLOAT when S2 is not above +0 (-0, negative or NaN) or S1 is -MAX_FLOAT, -inf or NaN; otherwise S0 * S1 with 0 * anything = +0 (as v_mul_legacy_f32). The HLSL path gets a `mullit` prelude helper, the direct DXIL path the same rule on the operand bits. gpu_mullit_and_cvt_off_match_rdna2 checks both backends against hardware values (rows with a NaN S0 or a denormal left out). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent dual-GPU Windows verification on exact PR head Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
…ort upstream xcl-dev#2241) LATER shared semantics: the measured gfx1036 hardware tables (MULLIT_RDNA2 41 rows, CVT_OFF_RDNA2 64 rows) land verbatim in recomp/tests.rs for the future SPIR-V lowering to rebuild the select-tree from. The HLSL/DXIL emit halves + the GPU test stay out until a backend consumes them.
|
The failed "Build and test" run (2026-11-25 18:31) is not from this PR. It ran on the merge ref while
Checked today on Windows 11 with an RTX 5070 Ti, release. I merged
Could a maintainer re-run the job? I left the head as it is, so the independent reports on AI use: Claude Code (Claude Opus 5.5) ran the merge and the tests and wrote this. |
|
Tested: Clean Not tested: Native wave64 arithmetic, full workspace suite, and retail smoke. AI use: T3 Code / Codex ( |
|
Independent desktop NVIDIA verification of PR #2241 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
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, 0 skipped; 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, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 02s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (568e7db7729c8fa6c8f0f4b32d798faaf11462bb, same machine):
xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1587)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14527 MB
PR #2241 (d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8):
xcl-smoke v1
commit: d7df3f9faed0ef34c495d45ae0261b91e9c6f7f8
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1569 (PresentX 1569)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14537 MB
Limits of coverage
- Both HLSL and direct-DXIL lowerings of
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. - The 60 s retail smoke confirms zero runtime regression on
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).
|
RX 9070 / RADV / Wine verification of exact head Tested
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
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 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, 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. |
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