Repository navigation
Tests: check scalar ALU results and SCC on the GPU against the ISA - #620
acaracargo wants to merge 1 commit into
Conversation
68 cases over 46 SALU opcodes that no GPU test ran (s_abs/absdiff, SOPK addk/mulk/movk/cmovk, s_bfm, s_bitcmp/bitset0, s_brev, s_cmov, s_ff0, s_lshlN_add, s_mul_hi, s_pack, s_sext, s_wqm, the n-logic ops, 64-bit shifts, s_min/max, s_sub_i32, s_cselect_b64, s_cmp_lg_u64), each on edge values, compared with a model of the RDNA2 pseudo-code: the destination and SCC, including that an op which does not write SCC keeps both values of it. Min / max get no equal operands: the RDNA2 machine-readable ISA only says "SCC iff the first value is selected", which leaves ties open. Measured: RTX 4060 (wave32), Windows 11 Pro 26300, Rust 1.100, debug. cargo test --workspace -- --test-threads=4: 678 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. The min tie case was replaced after that run; cargo test -p xcl --lib gpu_scalar: 3 passed. Breaking s_ff0 or making s_pack_hh write SCC in emit.rs fails the test. Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test run of Tested
Review: I spot-checked 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. |
|
Tested: Clean head
Not tested: Full workspace suite, release builds, retail titles, or game-data samples ( AI use: OpenCode with GPT-6.2 Sol ran the tests and drafted this report. |
|
Measured on RDNA2 hardware, for the two points under Not tested: console-generation hardware instead of the ISA text, and Method. The Radeon iGPU of a Ryzen 7 9800X3D ( Result.
For comparison, the same probe on an RX 9070 XT ( Not tested: the console itself ( Kernel shape (one case){ uint d = 0x0u; uint sc; uint a = 0x5u; uint b = 0x5u;
__asm__ volatile("s_cmp_eq_u32 0, 1\ns_min_i32 %0, %2, %3\ns_cselect_b32 %1, 1, 0"
: "+s"(d), "=&s"(sc) : "s"(a), "s"(b));
o[4*i] = d; o[4*i+2] = sc; }AI use: Claude Code (Claude Opus 5.5) wrote the OpenCL probes and the port of the reference, ran them on my PC and wrote this comment. I have not reviewed the code. |
About 80 SALU instructions are translated in
emit.rsbut never run in a GPU test. This adds one test for 46 of them, each on edge values (sign, carry and overflow boundaries, shift counts past 31 / 63, all-ones and all-zero inputs). It compares the destination and SCC with a small model of the RDNA2 pseudo-code (salu_reference). For instructions that do not write SCC, it checks that SCC keeps both of its earlier values. Test only, no runtime change.A search of open and closed PRs for "scalar", "SALU", "SCC" and the opcode names found no overlapping coverage. #445, #519, #545 and #590 cover VALU instructions only.
What is in it
crates/xcl/src/gpu/recomp/tests.rs:SaluCase,salu_referenceandgpu_scalar_alu_results_and_scc, 68 cases in programs of 30. s[0:5] hold the operands and the destination, and s[8..97] hold each result and its SCC.Tested
x86_64-pc-windows-msvc; DXC 1.9.2602.17 from the Windows SDK; debug.cargo test --workspace -- --test-threads=4on0e158e4: 685 passed, 0 failed, 41 ignored. Onmain9ce2070: 684 / 0 / 41.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).s_ff0_i32_b32scanning the wrong bits, ands_pack_hh_b32_b16writing SCC.Regression run
Not tested
AI use