Repository navigation
Recompiler tests: GPU checks for v_max3_u16, v_min3_u16 and v_med3_u16 - #738
13hourstilliland wants to merge 1 commit into
Conversation
emit.rs translates v_max3_u16, v_min3_u16 and v_med3_u16, but no test runs them. gpu_valu_16_bit_unsigned_min3_max3_med3 assembles the three as VOP3 and runs them in every wave size the GPU has (gpu_waves), 32 rounds of operands per lane: u16 edges (0, 1, 2, 0x00F1, 0x7FFE, 0x7FFF, 0x8000, 0x8001, 0xFFFE, 0xFFFF) and random halves, always with non-zero bits in each source's high half, against a plain Rust reference (sort the three low halves). Only the low 16 bits of the result are compared: the AMD machine-readable RDNA2 spec (VOP3 OP_SEL field) says op_sel[3] = 0 zeroes the high half, while LLVM's GCNSubtarget::zeroesHigh16BitsOfDest says gfx10 preserves it. Measured on an RTX 3070 (wave32 only): - reference with v_med3_u16 returning the minimum: the test fails with "wave32, 984 wrong (V_MED3_U16: 984)". - one wrong emitter expression per instruction, all at once: "wave32, 1940 wrong (V_MAX3_U16: 659, V_MIN3_U16: 635, V_MED3_U16: 646)". - the real emitter: 1 passed. Assisted-by: Hermes Agent (Claude Opus 5.5)
|
Test run of Tested
Review: med3 is the middle of the three sorted values and only D[15:0] is compared, as the ISA defines. Overlap: #638's description says #445 has the 16-bit min3 / max3 / med3; if #445 covers the unsigned forms too, one of the two is enough. 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. |
|
Native RDNA2 check of the untouched destination half The PR description notes the ambiguity over the upper 16 bits. On the RX 6800M ( Tested
For inputs Not tested The PR's translated GPU test and other GPU generations. This measures the three native RDNA2 instructions. AI use OpenAI Codex (GPT-6 family, exact model variant unavailable) wrote and ran the probe and drafted this report. |
Adds a GPU test for three RDNA2 instructions that
emit.rstranslates but no test runs:v_max3_u16,v_min3_u16andv_med3_u16. Test only, no runtime change.What is in it
gpu_valu_16_bit_unsigned_min3_max3_med3incrates/xcl/src/gpu/recomp/tests.rs, aftergpu_grouped_loads_bounds_and_inactive_lanes(away from the lines open PRs add to): one kernel with all 3 instructions, run as wave64 where the adapter has it and as wave32 everywhere (gpu_waves), 32 rounds of operands per lane: u16 edges (0, 1, 2, 0x00F1, 0x7FFE, 0x7FFF, 0x8000, 0x8001, 0xFFFE, 0xFFFF) and random halves, always with non-zero bits in each source's high half, each lane compared with the RDNA2 definition computed on the CPU (sort the three low halves). Only the low 16 bits of the result are compared: the AMD machine-readable RDNA2 spec (VOP3OP_SELfield) saysop_sel[3] = 0zeroes the high half, while LLVM'sGCNSubtarget::zeroesHigh16BitsOfDestsays gfx10 preserves it, so the high half is left unchecked.v_med3_u16returning the minimum:wave32, 984 wrong (V_MED3_U16: 984), no other instruction) the test fails; with max3 with the inner op as min, min3 with the inner op as max, and med3 with the third operand replaced by the second applied toemit.rsall at once it fails and names every instruction (wave32, 1940 wrong (V_MAX3_U16: 659, V_MIN3_U16: 635, V_MED3_U16: 646), 635 to 659 wrong per instruction). Those edits are not in the PR.Tested
stable-x86_64-pc-windows-gnu(MinGW linker), DXC 1.9.2609.5, debug build, commit 3f81263 (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_16_bit_unsigned_min3_max3_med3ok).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).AI use