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

Closed
13hourstilliland wants to merge 1 commit from upstream-pr/545 into main
13hourstilliland commented 2026-11-24 01:36:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by 13hourstilliland on 2026-11-24T01:36:08Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6572605421 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/545). Originally posted by [13hourstilliland](https://github.com/13hourstilliland) on 2026-11-24T01:36:08Z. --- 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.
towiice commented 2026-11-24 06:58:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T01:57:21Z.

Review: COMMENTED


Tested PR head 7f6f458 on NVIDIA GeForce GTX 1650 SUPER (Turing / TU116, wave32, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (stable-x86_64-pc-windows-gnullvm), DXC v1.9.2609:

  • cargo test -p xcl --lib gpu_vop3_three_input_logic_and_add_shift -- --test-threads=4: 1 passed, 0 failed (0.96 s).

Three-input VOP3 logic and add-shift GPU checks pass on Turing.

<!-- greyfinch-sync:ivall/xcl:review:6032482044 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/545#pullrequestreview-6032482044). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T01:57:21Z. **Review:** COMMENTED --- Tested PR head `7f6f458` on **NVIDIA GeForce GTX 1650 SUPER** (Turing / TU116, wave32, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (`stable-x86_64-pc-windows-gnullvm`), DXC `v1.9.2609`: - `cargo test -p xcl --lib gpu_vop3_three_input_logic_and_add_shift -- --test-threads=4`: **1 passed, 0 failed** (0.96 s). Three-input VOP3 logic and add-shift GPU checks pass on Turing.
WebIdentity1 commented 2026-11-24 07:05:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-24T01:50:00Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7119488874 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/545#issuecomment-7119488874). Originally posted by [WebIdentity1](https://github.com/WebIdentity1) on 2026-11-24T01:50:00Z. --- 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.
Diskuss commented 2026-11-24 09:07:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Diskuss on 2026-11-24T08:39:27Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7126401347 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/545#issuecomment-7126401347). Originally posted by [Diskuss](https://github.com/Diskuss) on 2026-11-24T08:39:27Z. --- **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.
upstream-sync closed this pull request 2026-11-24 12:04:56 +00:00
ivall commented 2026-11-24 12:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-24T11:20:05Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7129962696 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/545#issuecomment-7129962696). Originally posted by [ivall](https://github.com/ivall) on 2026-11-24T11:20:05Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!540
No description provided.