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. |
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