Skip to content

Recompiler tests: GPU checks for VOP3 bit-field, perm, align and min3/max3/med3 - #445

Open
AC-Storm-YT wants to merge 1 commit into
xcl-dev:mainfrom
AC-Storm-YT:recomp-vop3-int-tests
Open

AC-Storm-YT wants to merge 1 commit into
xcl-dev:mainfrom
AC-Storm-YT:recomp-vop3-int-tests

Conversation

@AC-Storm-YT

Copy link
Copy Markdown

Eleven 32-bit VOP3 integer instructions the recompiler translates had no test: v_bfi_b32, v_bfm_b32, v_perm_b32, v_alignbit_b32, v_alignbyte_b32 and v_min3 / v_max3 / v_med3 for u32 and i32. This adds one GPU test for them. Test only: nothing outside tests.rs changes.

What is in it

  • gpu_vop3_integer_bit_and_minmax3 (crates/xcl/src/gpu/recomp/tests.rs): one kernel with all eleven instructions, run as wave64 and wave32 (gpu_waves), 32 dispatches of operand triples from a fixed LCG – edge values (0, 1, 31, 32, 33, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF, every v_perm_b32 selector kind: bytes 0..7, the sign selectors 8..11, 12 and 13+) mixed with arbitrary words. Each result is compared bit for bit with the instruction's RDNA2 definition computed on the CPU (not with the emitted HLSL).

Tested

  • AMD Radeon RX 9070 XT (RDNA4, wave64), driver 32.0.32029.2010; AMD Ryzen 7 9800X3D; Windows 11 Pro build 26200; Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug; DXC 1.8.2502.11
  • cargo test --workspace -- --test-threads=4 on this branch's head: 677 passed, 0 failed, 41 ignored. No SKIPPED tests.
  • The new test fails when the emitter is broken: with each of these changes made to emit.rs by hand (and reverted), it reported wrong results for that instruction – v_med3_i32 compared unsigned (1407 results), v_perm_b32 selector 8 reading s0 (37), v_alignbyte_b32 shifting by 4 bits a byte (1215), v_bfm_b32 with the wrong zero-width case (488), v_max3_u32 ignoring src2 (629).

Regression run
Not needed: the PR changes only crates/xcl/src/gpu/recomp/tests.rs.

Not tested

  • NVIDIA / Intel and wave32-only GPUs: wave32 ran on the RX 9070 XT only.
  • Operand modifiers (neg / abs / clamp / op_sel) and inline-constant or SGPR operands: every source is a VGPR.

AI use

  • Claude Code with Claude Opus 5.5 wrote the test and this description, and ran the tests and the emitter-break checks on my machine. I can't review the bit-level semantics myself.

…/max3/med3

v_bfi_b32, v_bfm_b32, v_perm_b32, v_alignbit_b32, v_alignbyte_b32 and
v_min3 / v_max3 / v_med3 (u32 and i32) are translated but had no test.
One kernel runs all eleven as wave64 and wave32 over 32 dispatches of
operand triples (edge values and every v_perm_b32 selector kind, mixed
with arbitrary words by a fixed LCG), and compares each result with the
instruction's RDNA2 definition computed on the CPU.

Checked that it fails when the emitter is broken: v_med3_i32 compared
unsigned, v_perm_b32 selector 8 reading s0, v_alignbyte_b32 shifting by
4 bits a byte, v_bfm_b32's zero-width case and v_max3_u32 ignoring src2
each made it report wrong results.
@PHeitor1

Copy link
Copy Markdown

Tested 77eab20 merged onto main 2997c9a.

RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*.

Pass: 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2 no wave64 tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware). gpu_vop3_integer_bit_and_minmax3 runs on the GPU and passes. Build clean.

Run and written with Claude Code (Claude Opus 5.5).

@CryingLaughing

Copy link
Copy Markdown

The exact PR head 77eab20adfdb2472c77a747db16c3e9e6e7fabb4 passed on an RTX 4080. This adds Ada wave32 coverage alongside the RDNA4 and Blackwell runs above.

Tested

  • NVIDIA RTX 4080, driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, DXC 1.8.2502.11, debug. XCL_ADAPTER=4080, synthetic fixtures, all XCL_SAMPLE_* variables unset.
  • cargo test -p xcl --lib --locked -j 4 gpu_vop3_integer_bit_and_minmax3 -- --show-output passed 1/1 on native wave32. The fixture checks 11 instructions across 32 waves of 32 lane inputs against Rust results.
  • cargo build --workspace --locked -j 4 passed. cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output reported 677 passed, 0 failed, 41 ignored. That includes four explicit capability skips and opt-in game-data tests that returned early.
  • SKIPPED for native wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware. SKIPPED for D3D12 debug-layer availability: test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state.

Not tested

  • Native wave64, other adapters, release builds, retail titles.

AI use

  • OpenAI Codex (GPT-6 family, exact variant unavailable) ran the commands, checked the logs, and drafted this report.

@AC-Storm-YT
AC-Storm-YT marked this pull request as ready for review November 24, 2026 01:05
@13hourstilliland

Copy link
Copy Markdown
Contributor

Adding an Ampere 8 GB (RTX 3070, 32-lane waves) run on the exact PR head 77eab20.

Tested

  • Commit: 77eab20adfdb2472c77a747db16c3e9e6e7fabb4 (PR Recompiler tests: GPU checks for VOP3 bit-field, perm, align and min3/max3/med3 #445 head), clean worktree
  • Hardware: NVIDIA GeForce RTX 3070 8 GB, driver 610.88; Intel Core i5-12600K, 31.8 GB RAM; Windows 11 Home build 26200.9974
  • Toolchain: Rust 1.100.0 (stable-x86_64-pc-windows-gnu, not MSVC); DXC 1.9.2609.5 (01b62ad4) via XCL_DXC_DIR; debug build; no XCL_SAMPLE_* set
  • Targeted command: cargo test -p xcl --lib -- gpu_vop3_integer_bit_and_minmax3 --show-output
    • Result: 1 passed, 0 failed, 0 ignored (ran on the GPU, no skip)
  • Full workspace command: cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output (interactive desktop session)
    • Result: 677 passed, 0 failed, 41 ignored across 16 test binaries (xcl lib: 637 passed, 0 failed, 21 ignored; e2e: 3/0)
  • SKIPPED (4, not coverage):
    • no wave64 (2): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware
    • no D3D12 debug layer (2): test_title_draws_with_a_root_signature_under_the_debug_layer, uploads_start_from_each_subresources_state

Not tested

  • AMD / wave64 hardware, MSVC toolchain, release build, retail title / scripts/smoke.ps1, D3D12 debug-layer tests

AI use

  • Hermes Agent, gemini-4-neon: ran the commands and wrote this report from the logs; the human reviewed it.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants