Repository navigation
Recompiler tests: GPU check for v_dot4c_i32_i8 - #748
13hourstilliland wants to merge 1 commit into
Conversation
emit.rs translates the VOP2 v_dot4c_i32_i8 (destination as accumulator) with dot4add_i8packed, but no test runs it. gpu_valu_dot4c_i32_i8 runs it in every wave size the GPU has (gpu_waves) over 32 rounds of per-lane operands, half random and half edges (bytes of 0x7F and 0x80, 0xFF00FF00, 0x00FF00FF, 0x01020304, and accumulators at 0, i32::MAX, i32::MIN and -1 so the sum wraps), against a plain Rust reference: the four signed byte products added to the old destination, wrapping, with no clamp (LLVM's VOP2Instructions.td ties $vdst to $src2 and maps sdot4 to the e32 form only without clamp). Measured on an RTX 3070 (wave32 only): - reference with the bytes read unsigned: the test fails with "wave32, 842 wrong (V_DOT4C_I32_I8: 842)". - emitter with the accumulator replaced by 0: "wave32, 973 wrong (V_DOT4C_I32_I8: 973)". - the real emitter: 1 passed. Assisted-by: Hermes Agent (Claude Opus 5.5)
|
Test run of Tested
Review: The reference adds the four signed byte products to the old destination with wrap-around, which is 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
|
There was a problem hiding this comment.
Verified
bf9f34b (on main 64b3f35) on Windows 11 26200, Ryzen 5 5600X, RTX 3070, cargo 1.100.0 MSVC.
- cargo build --locked --workspace passed.
- cargo test --locked -p xcl --lib gpu_valu_dot4c_i32_i8 passed as wave32 (this GPU has no native wave64).
- cargo test --locked --workspace --no-fail-fast --jobs 3 -- --test-threads=4 — 702 passed, 0 failed, 41 ignored; 2 no-wave64 skips plus 2 no-D3D12-debug-layer skips here. The new test passed.
- git merge-tree --write-tree pr-748 origin/main — clean.
- The reference matches LLVM's VOP2Instructions.td: V_DOT4C_I32_I8 is VOP2 with $vdst = $src2, signed bytes, wrap, no clamp. The edges cover the 0x7F/0x80 extremes and accumulator wrap; the described unsigned-reference and zero-accumulator mutations are the right negative checks. The AMD RDNA4 comment covers wave64 and wave32; this run covers MSVC.
Non-blocking suggested changes
- The assertion message prints bad.len() twice ("wave{lanes}, {} wrong (V_DOT4C_I32_I8: {}):"); drop one.
- Not tested still lists the wave64 path and MSVC as untested; the AMD RDNA4 comment and this run now cover both, so update it if you want the description current.
No blocking issues; this is good to merge.
AI use
OpenCode (DeepSeek Flash 1017) ran the checks and drafted this; I checked it.
Empirical test report (bf9f34b)Hardware / environment
Commands and results
Observed behavior The translated shader ran with DXC 1.9.2609.5. Across 32 rounds per wave configuration exercised by the fixture, every checked lane matched the Rust reference for signed packed-byte multiplication and addition to the previous destination with 32-bit wrapping. The fixture mixes pseudorandom operands and edge values. The log does not identify the wave sizes exercised. Not tested Full GPU workspace suite and game smoke runs were omitted. The run was limited to the Arc A770 and the exact PR test. 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 the RDNA2 instruction
v_dot4c_i32_i8(VOP2, the destination is the accumulator), whichemit.rstranslates withdot4add_i8packedbut no test runs. Test only, no runtime change.What is in it
gpu_valu_dot4c_i32_i8incrates/xcl/src/gpu/recomp/tests.rs, aftergpu_global_atomics_and_sub_dword_access(away from the lines open PRs add to): run as wave64 where the adapter has it and as wave32 everywhere (gpu_waves), 32 rounds of per-lane operands, half random and half edges (bytes of0x7Fand0x80,0xFF00FF00,0x00FF00FF,0x01020304, and accumulators at 0,i32::MAX,i32::MINand -1 so the sum wraps), each lane compared with the RDNA2 definition computed on the CPU: the four signed byte products added to the old destination, wrapping, with no clamp (LLVMVOP2Instructions.tdties$vdstto$src2and maps sdot4 to the e32 form only without clamp).wave32, 842 wrong (V_DOT4C_I32_I8: 842)); with the accumulator replaced by 0 inemit.rsit fails (wave32, 973 wrong (V_DOT4C_I32_I8: 973)). Those edits are not in the PR.v_ashrrev_i32,v_lshrrev_b64andv_ashrrev_i64are covered by the open Tests: 3-operand bitwise, shift, bitfield, and popcount ops on the GPU #703 and Tests: check 64-bit shifts, v_mad_i64_i32 and f64 fma/min/max on the GPU #682, so they are not here.Tested
stable-x86_64-pc-windows-gnu(MinGW linker), DXC 1.9.2609.5, debug build, commit bf9f34b (on main 64b3f35)cargo test --workspace --no-fail-fast -- --test-threads=4, run in the interactive desktop session: 702 passed, 0 failed, 41 ignored (lib: 661 passed, 0 failed, 21 ignored;e2e3 of 3;gpu_valu_dot4c_i32_i8ok).main64b3f35 on the same machine: 701 passed, 0 failed, 41 ignored (lib: 660 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