Recompiler tests: GPU check for v_dot4c_i32_i8 #748

Open
github-bot wants to merge 1 commit from github-bot/gh-748 into main AGit
Owner

@⁠13hourstilliland on GitHub · 2026-11-24 04:33 UTC · original
13hourstilliland:recomp-tests-dot4c-i32-i8 → main · +38 −0 · 1 files · 1 commits · open

Adds a GPU test for the RDNA2 instruction v_dot4c_i32_i8 (VOP2, the destination is the accumulator), which emit.rs translates with dot4add_i8packed but no test runs. Test only, no runtime change.

What is in it

  • gpu_valu_dot4c_i32_i8 in crates/xcl/src/gpu/recomp/tests.rs, after gpu_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 of 0x7F and 0x80, 0xFF00FF00, 0x00FF00FF, 0x01020304, and accumulators at 0, i32::MAX, i32::MIN and -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 (LLVM VOP2Instructions.td ties $vdst to $src2 and maps sdot4 to the e32 form only without clamp).
  • A failure lists the lane, operands, accumulator, result and expected value.
  • Checked that it catches bugs, on a local copy: with the reference reading the bytes unsigned the test fails (wave32, 842 wrong (V_DOT4C_I32_I8: 842)); with the accumulator replaced by 0 in emit.rs it fails (wave32, 973 wrong (V_DOT4C_I32_I8: 973)). Those edits are not in the PR.
  • The reversed shifts v_ashrrev_i32, v_lshrrev_b64 and v_ashrrev_i64 are covered by the open #703 and #682, so they are not here.

Tested

  • NVIDIA GeForce RTX 3070 8 GB, driver 610.88; Intel Core i5-12600K; Windows 11 Home build 26200
  • Rust 1.100.0 stable-x86_64-pc-windows-gnu (MinGW linker), DXC 1.9.2609.5, debug build, commit bf9f34b8c2 (on main 64b3f35599)
  • 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; e2e 3 of 3; gpu_valu_dot4c_i32_i8 ok). main 64b3f35599 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_hardware

Not tested

  • The wave64 path: the RTX 3070 has 32-lane waves only, so the test ran as wave32. Not run on AMD.
  • The MSVC toolchain (stable-x86_64-pc-windows-msvc): built with the GNU toolchain only.
  • A release build.
  • A retail title: not needed for a test-only change (no crates/xcl/src runtime file changes).

AI use

  • Hermes Agent with Claude Opus 5.5: wrote the test, ran the tests and the mutation check on the hardware above, and wrote this description.
**@⁠13hourstilliland** on GitHub · 2026-11-24 04:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/748) `13hourstilliland:recomp-tests-dot4c-i32-i8` → `main` · +38 −0 · 1 files · 1 commits · open Adds a GPU test for the RDNA2 instruction `v_dot4c_i32_i8` (VOP2, the destination is the accumulator), which `emit.rs` translates with `dot4add_i8packed` but no test runs. Test only, no runtime change. **What is in it** - `gpu_valu_dot4c_i32_i8` in `crates/xcl/src/gpu/recomp/tests.rs`, after `gpu_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 of `0x7F` and `0x80`, `0xFF00FF00`, `0x00FF00FF`, `0x01020304`, and accumulators at 0, `i32::MAX`, `i32::MIN` and -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 (LLVM `VOP2Instructions.td` ties `$vdst` to `$src2` and maps sdot4 to the e32 form only without clamp). - A failure lists the lane, operands, accumulator, result and expected value. - Checked that it catches bugs, on a local copy: with the reference reading the bytes unsigned the test fails (`wave32, 842 wrong (V_DOT4C_I32_I8: 842)`); with the accumulator replaced by 0 in `emit.rs` it fails (`wave32, 973 wrong (V_DOT4C_I32_I8: 973)`). Those edits are not in the PR. - The reversed shifts `v_ashrrev_i32`, `v_lshrrev_b64` and `v_ashrrev_i64` are covered by the open #703 and #682, so they are not here. **Tested** - NVIDIA GeForce RTX 3070 8 GB, driver 610.88; Intel Core i5-12600K; Windows 11 Home build 26200 - Rust 1.100.0 `stable-x86_64-pc-windows-gnu` (MinGW linker), DXC 1.9.2609.5, debug build, commit bf9f34b8c286 (on main 64b3f35599bb) - `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; `e2e` 3 of 3; `gpu_valu_dot4c_i32_i8` ok). `main` 64b3f35599bb 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_hardware` **Not tested** - The wave64 path: the RTX 3070 has 32-lane waves only, so the test ran as wave32. Not run on AMD. - The MSVC toolchain (`stable-x86_64-pc-windows-msvc`): built with the GNU toolchain only. - A release build. - A retail title: not needed for a test-only change (no `crates/xcl/src` runtime file changes). **AI use** - Hermes Agent with Claude Opus 5.5: wrote the test, ran the tests and the mutation check on the hardware above, and wrote this description.
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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:31:18 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:39 UTC · original

Test run of bf9f34b8c2863572ca57bf18bf0272d4323888ef on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, mesh shaders), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; gpu_valu_dot4c_i32_i8 passes, as wave64 and wave32.

Review: The reference adds the four signed byte products to the old destination with wrap-around, which is v_dot4c_i32_i8's definition. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/748#issuecomment-7122224496) Test run of `bf9f34b8c2863572ca57bf18bf0272d4323888ef` on AMD RDNA4. I merged it onto current `main` `64b3f35` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, mesh shaders), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **702 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 661 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `gpu_valu_dot4c_i32_i8` passes, as wave64 and wave32. **Review:** The reference adds the four signed byte products to the old destination with wrap-around, which is `v_dot4c_i32_i8`'s definition. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 04:46 UTC · original

An NVIDIA run, since the report above is on RDNA4 (native wave64). Tested exact head bf9f34b (on its base f4ce27c).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 702 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new test ran and passed (not skipped): gpu::recomp::tests::gpu_valu_dot4c_i32_i8 ... ok.
    Not tested
  • AMD (covered above), a release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 04:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/748#issuecomment-7122332443) An NVIDIA run, since the report above is on RDNA4 (native wave64). Tested exact head `bf9f34b` (on its base `f4ce27c`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **702 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new test ran and passed (not skipped): `gpu::recomp::tests::gpu_valu_dot4c_i32_i8 ... ok`. **Not tested** - AMD (covered above), a release build. **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:03 UTC · original

Empirical test report (bf9f34b8)

Hardware / environment

  • Windows 11 Enterprise Evaluation x64, build 26200.9974. AMD Ryzen 7 3800X. Intel Arc A770 16 GiB, driver 32.0.101.9175.
  • Rust: rustc 1.100.0 (0ef1bc386 2026-11-09).
  • DXC: dxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47).
  • PR #748, commit bf9f34b8c2863572ca57bf18bf0272d4323888ef, clean detached checkout. Cargo test profile, unoptimized, with incremental compilation and debug info disabled.

Commands and results

  • cargo test -p xcl --lib --no-run --message-format=json-render-diagnostics exited 0 before the GPU lock was acquired. The build emitted one deprecation warning for AtomicU32::fetch_update in XGameRuntime.

  • With XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1, ran the Cargo-produced library test executable inside Invoke-ArcTest.ps1:

    & $testExe gpu::recomp::tests::gpu_valu_dot4c_i32_i8 --exact --nocapture --test-threads=1
    
  • The focused run exited 0. 1 passed, 0 failed, 0 ignored, 0 GPU skips, 681 filtered out. Libtest reported 0.60 s. The log records acquisition and release of the Arc lock.

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 pr748-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/748#issuecomment-7154391668) ### Empirical test report (bf9f34b8) **Hardware / environment** - Windows 11 Enterprise Evaluation x64, build 26200.9974. AMD Ryzen 7 3800X. Intel Arc A770 16 GiB, driver 32.0.101.9175. - Rust: `rustc 1.100.0 (0ef1bc386 2026-11-09)`. - DXC: `dxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47)`. - PR #748, commit `bf9f34b8c2863572ca57bf18bf0272d4323888ef`, clean detached checkout. Cargo test profile, unoptimized, with incremental compilation and debug info disabled. **Commands and results** - `cargo test -p xcl --lib --no-run --message-format=json-render-diagnostics` exited 0 before the GPU lock was acquired. The build emitted one deprecation warning for `AtomicU32::fetch_update` in XGameRuntime. - With `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`, ran the Cargo-produced library test executable inside `Invoke-ArcTest.ps1`: ```powershell & $testExe gpu::recomp::tests::gpu_valu_dot4c_i32_i8 --exact --nocapture --test-threads=1 ``` - The focused run exited 0. 1 passed, 0 failed, 0 ignored, 0 GPU skips, 681 filtered out. Libtest reported 0.60 s. The log records acquisition and release of the Arc lock. **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 `pr748-focused.log` and published.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 11:28 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 11:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/748#issuecomment-7161102308) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/748/head:github-bot/gh-748'
git switch 'github-bot/gh-748'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-748'
git switch 'github-bot/gh-748'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-748'
git switch 'github-bot/gh-748'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-748'
git switch 'main'
git merge --squash 'github-bot/gh-748'
git switch 'main'
git merge --ff-only 'github-bot/gh-748'
git switch 'main'
git merge 'github-bot/gh-748'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.