Repository navigation
Recompiler tests: GPU checks for f32 ceil/trunc/rndne, f32/i32 min/max - #739
13hourstilliland wants to merge 1 commit into
Conversation
emit.rs translates v_ceil_f32, v_trunc_f32, v_rndne_f32, v_max_f32, v_min_f32, v_max3_f32, v_min3_f32, v_max_i32 and v_min_i32, but no test ran any of them. gpu_valu_round_and_min_max_f32_i32 runs all nine as VOP3 in one kernel (wave64 and wave32 through gpu_waves) on 32 batches of operands: edge values (+-0, +-0.5, +-1.5, +-2.5, 0.49999997, +-8388607.5, +-1e30, +-inf, NaN), values on 1/256 steps up to 2^23 and random bit patterns, with denormals flushed to a signed zero and NaNs quieted. The reference is computed on the CPU: rounding keeps the sign of a zero; a quiet NaN operand of an f32 min/max gives the other operand (minNum/maxNum), and min/max zero results are compared without their sign. Measured on an RTX 3070 (wave32 only; NVIDIA has no wave64, so that half did not run): - GREEN against the real emitter: 1 passed. - RED, reference round_ties_even replaced by round: fails with "wave32, 188 wrong (V_RNDNE_F32: 188)", no other op. - MUTANT, all nine emit.rs expressions broken at once (ceil->floor, trunc->round, round->trunc, max<->min, max3/min3 inner op swapped, signed i32 min/max made unsigned): "wave32, 5199 wrong (V_CEIL_F32: 634, V_TRUNC_F32: 217, V_RNDNE_F32: 217, V_MAX_F32: 956, V_MIN_F32: 956, V_MAX3_F32: 628, V_MIN3_F32: 629, V_MAX_I32: 481, V_MIN_I32: 481)"; emit.rs restored afterwards. Assisted-by: Hermes Agent (Claude Opus 5.5)
|
Test run of Tested
Review: Overlap: Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
An NVIDIA run, since the report above is on RDNA4 (native wave64). Tested exact head Tested
AI use
|
|
Test report for Tested
16 test binaries: 692 passed, 1 failed, 41 ignored. Same machine, This PR's tests:
Failures:
16 test binaries instead of SKIPPED (no wave64 on this GPU): AI use: Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output. |
Empirical test report (586edba)Verified PR #739 at commit Hardware / environment
Commands and results
Observed behavior The fixture compiled its recompiled shader with DXC and completed its GPU comparisons against the CPU reference. It checked nine VOP3 instructions over 32 batches per executed wave mode. Coverage included f32 ceil, truncation and nearest-even rounding, two- and three-operand f32 min/max, and signed i32 min/max. The fixture checked signed zero for rounding and numeric results for min/max with a single quiet NaN. The result confirms wave32 coverage. The log does not enumerate the wave modes, so native wave64 coverage was not established by this run. Not tested The full GPU workspace suite and game smoke runs were omitted. No other GPU was tested. AI use Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Adds a GPU test for nine RDNA2 instructions that
emit.rstranslates but no test runs:v_ceil_f32,v_trunc_f32,v_rndne_f32,v_max_f32,v_min_f32,v_max3_f32,v_min3_f32,v_max_i32andv_min_i32. Test only, no runtime change.What is in it
gpu_valu_round_and_min_max_f32_i32incrates/xcl/src/gpu/recomp/tests.rs, afterf32_compares_with_nan(away from the lines open PRs add to): one kernel with all 9 instructions, run as wave64 where the adapter has it and as wave32 everywhere (gpu_waves), 32 batches of operands: edge values (±0, ±0.5, ±1.5, ±2.5, 0.49999997, ±8388607.5, ±1e30, ±inf, NaN), values on 1/256 steps up to 2^23 and random bit patterns, with denormals flushed to a signed zero and NaNs quieted, each lane compared with the RDNA2 definition computed on the CPU: rounding keeps the sign of a zero; a quiet NaN operand of an f32 min/max gives the other operand (minNum/maxNum), and min/max zero results are compared without their sign.round_ties_evenreplaced byround:wave32, 188 wrong (V_RNDNE_F32: 188), no other instruction) the test fails; with ceil as floor, trunc as round, rndne as trunc, max and min swapped, max3 and min3 with the inner op swapped, signed i32 min and max made unsigned applied toemit.rsall at once it fails and names every instruction (wave32, 5199 wrong (V_CEIL_F32: 634, V_TRUNC_F32: 217, V_RNDNE_F32: 217, V_MAX_F32: 956, V_MIN_F32: 956, V_MAX3_F32: 628, V_MIN3_F32: 629, V_MAX_I32: 481, V_MIN_I32: 481), 217 to 956 wrong per instruction). Those edits are not in the PR.v_min_f32also appears in the open Recompiler: image_sample_b/d/cd/c_o offsets move by the mip they read #247, inside an image-sample test; that PR does not test it on its own.Tested
stable-x86_64-pc-windows-gnu(MinGW linker), DXC 1.9.2609.5, debug build, commit 586edba (on main 91f9a5e)cargo test --workspace --no-fail-fast -- --test-threads=4, run in the interactive desktop session: 693 passed, 0 failed, 41 ignored (lib: 653 passed, 0 failed, 21 ignored;e2e3 of 3;gpu_valu_round_and_min_max_f32_i32ok).main91f9a5e on the same machine: 692 passed, 0 failed, 41 ignored (lib: 652 passed, 0 failed, 21 ignored)SKIPPED(no wave64 on this GPU):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareNot tested
stable-x86_64-pc-windows-msvc): built with the GNU toolchain only.crates/xcl/srcruntime file changes).gpu_typed_buffer_loads_and_stores,gpu_uma_import_check_at_init,gpu_valu_16_and_64_bitand this test) and were killed. The same four tests together passed twice, the lib suite alone passed 4 of 4,mainpassed 4 of 4, and the full-suite run counted above passed. I did not find the cause.AI use