Recompiler tests: GPU checks for three-input VOP3 logic and add-shift #545

Closed
github-bot wants to merge 1 commit from gh-pr/545/head into gh-pr/545/base
Owner

@⁠13hourstilliland on GitHub · 2026-11-24 01:36 UTC · original
13hourstilliland:recomp-vop3-three-input-tests → main · +52 −0 · 1 files · 1 commits · closed without merging

Adds a GPU test for six RDNA2 VOP3 instructions that emit.rs already translates but no test runs: v_or3_b32, v_xor3_b32, v_and_or_b32, v_lshl_or_b32, v_add_lshl_u32 and v_xad_u32. Test only, no runtime change.

What is in it

  • gpu_vop3_three_input_logic_and_add_shift in crates/xcl/src/gpu/recomp/tests.rs, built like the open #445: one kernel with all six instructions, run as wave64 where the adapter has it and as wave32 everywhere (gpu_waves), 32 waves of operand triples from a fixed LCG mixed with edge values (0, 1, 31, 32, 33, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF, ...), each lane compared with the RDNA2 definition computed on the CPU. Shift counts use their low five bits and adds wrap. v_xad_u32 is (a ^ b) + c, as in LLVM's AMDGPU patterns (ThreeOp_i32_Pats<xor, add, V_XAD_U32_e64>).
  • A failure lists the lane, instruction, operands, result and expected value.
  • Placed after gpu_valu_16_and_64_bit, away from the lines #445 and #202 add to, so it does not conflict with them.
  • Checked that it catches bugs: with any one of the six emit.rs expressions changed on a local copy (or3 emitted with an xor, xor3 with an or, and_or with an xor, lshl_or with a 4-bit shift mask, add_lshl shifting only b, xad with an or), the test fails and names only that instruction (361 to 838 of 1024 lane results wrong). Those edits are not in the PR.

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 7f6f458 (identical tree to 6d9c320, author metadata amended; on main 508a0c7)
  • cargo test --workspace --no-fail-fast -- --test-threads=4, run in the interactive desktop session: 681 passed, 0 failed, 41 ignored (lib: 641 passed, 0 failed, 21 ignored; every other test binary ok, e2e 3 of 3, gpu_vop3_three_input_logic_and_add_shift ok)
  • 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 01:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/545) `13hourstilliland:recomp-vop3-three-input-tests` → `main` · +52 −0 · 1 files · 1 commits · closed without merging Adds a GPU test for six RDNA2 VOP3 instructions that `emit.rs` already translates but no test runs: `v_or3_b32`, `v_xor3_b32`, `v_and_or_b32`, `v_lshl_or_b32`, `v_add_lshl_u32` and `v_xad_u32`. Test only, no runtime change. **What is in it** - `gpu_vop3_three_input_logic_and_add_shift` in `crates/xcl/src/gpu/recomp/tests.rs`, built like the open #445: one kernel with all six instructions, run as wave64 where the adapter has it and as wave32 everywhere (`gpu_waves`), 32 waves of operand triples from a fixed LCG mixed with edge values (0, 1, 31, 32, 33, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF, ...), each lane compared with the RDNA2 definition computed on the CPU. Shift counts use their low five bits and adds wrap. `v_xad_u32` is `(a ^ b) + c`, as in LLVM's AMDGPU patterns (`ThreeOp_i32_Pats<xor, add, V_XAD_U32_e64>`). - A failure lists the lane, instruction, operands, result and expected value. - Placed after `gpu_valu_16_and_64_bit`, away from the lines #445 and #202 add to, so it does not conflict with them. - Checked that it catches bugs: with any one of the six `emit.rs` expressions changed on a local copy (or3 emitted with an xor, xor3 with an or, and_or with an xor, lshl_or with a 4-bit shift mask, add_lshl shifting only b, xad with an or), the test fails and names only that instruction (361 to 838 of 1024 lane results wrong). Those edits are not in the PR. **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 7f6f458 (identical tree to 6d9c320, author metadata amended; on main 508a0c7) - `cargo test --workspace --no-fail-fast -- --test-threads=4`, run in the interactive desktop session: 681 passed, 0 failed, 41 ignored (lib: 641 passed, 0 failed, 21 ignored; every other test binary ok, `e2e` 3 of 3, `gpu_vop3_three_input_logic_and_add_shift` ok) - `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.
v_or3_b32, v_xor3_b32, v_and_or_b32, v_lshl_or_b32, v_add_lshl_u32 and
v_xad_u32 are translated by emit.rs but no test ran them. The new test
runs all six in one kernel, as wave64 where the adapter has it and as
wave32 everywhere, over 32 waves of operand triples from a fixed LCG
mixed with edge values (0, 1, 31, 32, 33, 0x7FFFFFFF, 0x80000000,
0xFFFFFFFF), and compares every lane with the RDNA2 definition computed
on the CPU (shift counts use their low five bits, adds wrap; v_xad_u32
is (a ^ b) + c, as in LLVM's AMDGPU patterns).

Measured on an RTX 3070 (wave32 only): the test passes against the
current emitter, and fails, naming only the broken instruction, when
any one of the six emitter expressions is changed (or3 emitted with an
xor, xor3 with an or, and_or with an xor, lshl_or with a 4-bit shift
mask, add_lshl shifting only b, xad with an or).

Assisted-by: Hermes Agent (Claude Opus 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:25:14 +00:00
github-bot closed this pull request 2026-11-26 04:25:14 +00:00
Author
Owner

@⁠WebIdentity1 on GitHub · 2026-11-24 01:50 UTC · original

Additional MSVC / wave64 validation for 7f6f4588da41ef1d33c5367ef80cf35b78cf398a: applied this PR's 52-line test patch to #546 head 526f93cb1f1b6f5fb798514b246b76d5c686a05d, both based on main 508a0c7. No runtime changes. #546 makes the shared helpers run both wave sizes, using split wave64 on NVIDIA.

Tested

  • Windows 10 Home 19045, Ryzen 7 7800X3D, Rust 1.98.1 stable-x86_64-pc-windows-msvc, debug, SDK DXC 1.8.2502.11, public Agility 1.620.2.
  • cargo test --locked -p xcl --lib gpu_vop3_three_input_logic_and_add_shift -- --nocapture --test-threads=1:
    • XCL_ADAPTER=NVIDIA GeForce RTX 3090, driver 591.74, XCL_REQUIRE_GPU=mesh: 1 passed / 0 failed / 0 ignored, 662 filtered out, no skips. Both wave32 and split wave64 were checked by the combined helpers.
    • XCL_ADAPTER=AMD Radeon(TM) Graphics, driver 32.0.21030.2001, XCL_REQUIRE_GPU=wave64, XCL_SPLIT_WAVE64 unset: 1 passed / 0 failed / 0 ignored, 662 filtered out, no skips. Both native wave64 and wave32 were checked.
  • Each run checks all six instruction results across 32 rounds of each wave size. The combined tests.rs SHA256 is 5eaf62a97856b9467ca47bee61a0e8f3f02dc0bdf2412f421ece3529437d41d4; verified against the remote source. Patches and logs retained locally.

Not tested
Full workspace on this combined tree, release build, retail titles or console hardware. This report covers the PR combined with the separate test-helper change, not an unmodified run of this PR head. I did not repeat the author's mutation checks.

AI use
Codex (GPT-6) prepared the test-only integration, ran native Windows tests and wrote this report.

**@⁠WebIdentity1** on GitHub · 2026-11-24 01:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/545#issuecomment-7119488874) Additional MSVC / wave64 validation for `7f6f4588da41ef1d33c5367ef80cf35b78cf398a`: applied this PR's 52-line test patch to #546 head `526f93cb1f1b6f5fb798514b246b76d5c686a05d`, both based on main `508a0c7`. No runtime changes. #546 makes the shared helpers run both wave sizes, using split wave64 on NVIDIA. **Tested** - Windows 10 Home 19045, Ryzen 7 7800X3D, Rust 1.98.1 `stable-x86_64-pc-windows-msvc`, debug, SDK DXC 1.8.2502.11, public Agility 1.620.2. - `cargo test --locked -p xcl --lib gpu_vop3_three_input_logic_and_add_shift -- --nocapture --test-threads=1`: - `XCL_ADAPTER=NVIDIA GeForce RTX 3090`, driver 591.74, `XCL_REQUIRE_GPU=mesh`: **1 passed / 0 failed / 0 ignored**, 662 filtered out, no skips. Both wave32 and split wave64 were checked by the combined helpers. - `XCL_ADAPTER=AMD Radeon(TM) Graphics`, driver 32.0.21030.2001, `XCL_REQUIRE_GPU=wave64`, `XCL_SPLIT_WAVE64` unset: **1 passed / 0 failed / 0 ignored**, 662 filtered out, no skips. Both native wave64 and wave32 were checked. - Each run checks all six instruction results across 32 rounds of each wave size. The combined `tests.rs` SHA256 is `5eaf62a97856b9467ca47bee61a0e8f3f02dc0bdf2412f421ece3529437d41d4`; verified against the remote source. Patches and logs retained locally. **Not tested** Full workspace on this combined tree, release build, retail titles or console hardware. This report covers the PR combined with the separate test-helper change, not an unmodified run of this PR head. I did not repeat the author's mutation checks. **AI use** Codex (GPT-6) prepared the test-only integration, ran native Windows tests and wrote this report.
Author
Owner

@⁠Diskuss on GitHub · 2026-11-24 08:39 UTC · original · edited 2026-11-24 09:29 UTC

Tested on AMD Radeon RX 9070 XT (RDNA4) at 7f6f4588da41ef1d33c5367ef80cf35b78cf398a

Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, driver 32.0.32015.7029, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17, debug build.

Tested:

  • cargo build --workspace: OK.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 681 passed, 0 failed, 41 ignored.
  • cargo test -p xcl --lib gpu_vop3_three_input_logic_and_add_shift -- --test-threads=1: 1 passed, 0 failed. No SKIPPED line on stderr.
  • The PR notes it was tested only on an RTX 3070, which has no wave64. This AMD run is meant to exercise the wave64 half. The test loops over gpu_waves(), which includes wave64 when wave64_supported() is true. The test does not log which waves it ran, so I did not see wave64 directly. I infer it ran from the absence of SKIPPED and the pass.
  • SKIPPED lines: 0. Device removal (DXGI_ERROR_DEVICE_REMOVED): none.
  • Main at 1ec4c98 gave 715 passed, 0 failed, 41 ignored. The lower passed count is expected: this branch is 57 commits behind main.

Not tested: retail title / scripts/smoke.ps1 (no game files), release build.

Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.

Correction (hidden skips): "0 SKIPPED" above means no SKIPPED line appeared in the normal run. A later -- --nocapture run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / d3d12SDKLayers.dll). libtest captures their output, so they show as ok: e2e::test_title_draws_with_a_root_signature_under_the_debug_layer and texture_states::uploads_start_from_each_subresources_state. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.

**@⁠Diskuss** on GitHub · 2026-11-24 08:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/545#issuecomment-7126401347) · edited 2026-11-24 09:29 UTC **Tested on AMD Radeon RX 9070 XT (RDNA4) at `7f6f4588da41ef1d33c5367ef80cf35b78cf398a`** Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, driver 32.0.32015.7029, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17, debug build. **Tested**: - `cargo build --workspace`: OK. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 681 passed, 0 failed, 41 ignored. - `cargo test -p xcl --lib gpu_vop3_three_input_logic_and_add_shift -- --test-threads=1`: 1 passed, 0 failed. No SKIPPED line on stderr. - The PR notes it was tested only on an RTX 3070, which has no wave64. This AMD run is meant to exercise the wave64 half. The test loops over `gpu_waves()`, which includes wave64 when `wave64_supported()` is true. The test does not log which waves it ran, so I did not see wave64 directly. I infer it ran from the absence of SKIPPED and the pass. - SKIPPED lines: 0. Device removal (DXGI_ERROR_DEVICE_REMOVED): none. - Main at 1ec4c98 gave 715 passed, 0 failed, 41 ignored. The lower passed count is expected: this branch is 57 commits behind main. **Not tested**: retail title / `scripts/smoke.ps1` (no game files), release build. Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine. **Correction (hidden skips):** "0 SKIPPED" above means no `SKIPPED` line appeared in the normal run. A later `-- --nocapture` run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / `d3d12SDKLayers.dll`). libtest captures their output, so they show as `ok`: `e2e::test_title_draws_with_a_root_signature_under_the_debug_layer` and `texture_states::uploads_start_from_each_subresources_state`. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.
Author
Owner

@⁠ivall on GitHub · 2026-11-24 11:20 UTC · original

Closing as overlapping test coverage is proposed in #703, which covers the same six operations and additional instructions. Neither PR has been merged yet. Thank you for the contribution.

**@⁠ivall** on GitHub · 2026-11-24 11:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/545#issuecomment-7129962696) Closing as overlapping test coverage is proposed in #703, which covers the same six operations and additional instructions. Neither PR has been merged yet. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.