Skip to content

Tests: cover RDNA2 bitops, 3-op min/max/med3, SAD/LERP and VOP3P on GPU - #1576

Open
piyonchu wants to merge 1 commit into
xcl-dev:mainfrom
piyonchu:tests/gpu-valu-bitops-packed
Open

piyonchu wants to merge 1 commit into
xcl-dev:mainfrom
piyonchu:tests/gpu-valu-bitops-packed

Conversation

@piyonchu

@piyonchu piyonchu commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Tests only — adds two GPU hardware execution tests to crates/xcl/src/gpu/recomp/tests.rs (bc24ac3, rebased onto main cbc296a) covering previously untested RDNA2 VALU bit-manipulation, 3-operand integer min3/max3/med3, video sad/msad/lerp, and packed 16-bit VOP3P instructions under the split-wave64 compute recompiler.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs:
    • gpu_bitops_min3_max3_med3_and_sad: runs V_FFBH_U32, V_FFBL_B32, V_FFBH_I32, V_BCNT_U32_B32, V_BFI_B32, V_BFM_B32, V_ALIGNBIT_B32, V_ALIGNBYTE_B32, V_PERM_B32, 32-bit and 16-bit V_MIN3/V_MAX3/V_MED3 (unsigned and signed), V_SAD_U32, V_SAD_U8, V_SAD_HI_U8, V_SAD_U16, V_MSAD_U8, and V_LERP_U8 across 64 lanes on the GPU and checks bit-exact outputs against RDNA2 reference semantics (zero inputs, signed extremes, 5-bit shift/width masking, byte selector modes 0..=16+, and zero-mask lane skips in V_MSAD_U8).
    • gpu_packed_16bit_shifts_minmax_mul_and_fma: runs V_PK_FMA_F16 (including OP_SEL and NEG_HI), V_PK_MIN_F16, V_PK_MAX_F16, V_PK_LSHLREV_B16, V_PK_LSHRREV_B16, V_PK_ASHRREV_I16 (including shift counts >= 16 masked to 4 bits), V_PK_MUL_LO_U16, V_PK_MIN_U16/V_PK_MAX_U16, and V_PK_MIN_I16/V_PK_MAX_I16 on the GPU.

Tested

  • NVIDIA GeForce RTX 4060 Laptop GPU (driver 616.56), Windows 11, DXC/DXIL 1.8.2502.11 (10.0.26100.0), rustc 1.100.0, debug build at commit bc24ac30f82c8e409b46bacee578dd8889a8a19b:
  • cargo test -p xcl --lib gpu_bitops_min3_max3_med3_and_sad: 1 passed, 0 failed (0.31s).
  • cargo test -p xcl --lib gpu_packed_16bit_shifts_minmax_mul_and_fma: 1 passed, 0 failed (0.30s).
  • cargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored.
  • SKIPPED GPU tests on this adapter (no wave64 / no heap windows / no Windows Developer Mode / refused wave32 per-lane f16 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 forms): gpu::recomp::lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu}, gpu::recomp::lower_dxil::tests::{a_per_lane_2d_or_3d_group_runs_on_the_gpu,f16_programs_on_the_gpu,const_and_null_mask_operands_agree_with_hlsl_on_the_gpu,mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu,f32_programs_on_the_gpu,integer_programs_on_the_gpu,f64_programs_on_the_gpu}, gpu::recomp::tests::{gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware}, shaders::tests::pso_measurement_compiles_an_exact_synthetic_record, heap_window_out_of_memory_falls_back_to_the_switch_form.
  • python scripts/pr_check.py --local and git diff --check upstream/main..HEAD: passed.

Regression run

  • Not needed: test-only change inside crates/xcl/src/gpu/recomp/tests.rs (only new GPU instruction tests added; no runtime code changed).

Not tested

  • Native wave64 hardware (AMD RDNA2/RDNA3/RDNA4), Windows Developer Mode PSO cache disable, heap-window fallback tests, release build, Wine/Linux, and retail titles (no game package present locally).

AI use

  • Antigravity (Google DeepMind) wrote the new GPU tests, rebased onto main, ran the local workspace test suite, and drafted this PR description.

@coenflict

Copy link
Copy Markdown

Tested

  • Head 70eb0a5060333d45a20bb577119f177cfa3461e1, Windows 11 build 26340, Ryzen 7 9800X3D with integrated AMD Radeon Graphics driver 32.0.21042.62, Rust 1.97.1 MSVC, DXC and DXIL 1.9.2602.17, debug build. Set XCL_ADAPTER=radeon and XCL_REQUIRE_GPU=wave64.
  • cargo test -p xcl --lib -- --nocapture gpu_bitops_min3_max3_med3_and_sad gpu_packed_16bit_shifts_minmax_mul_and_fma gpu_wave32_program_in_wave64_hardware reported 3 passed, 0 failed, 0 ignored, 0 skips. Both new tests ran, and the existing native-wave64 check also passed.

Not tested

  • Whole workspace at this PR head, retail titles, and the D3D12 debug layer.

AI use

  • Codex (gpt-6.2-sol) ran the tests and wrote this report.

@JesusAtirador

Copy link
Copy Markdown

The whole workspace at this head, which the report above lists as not tested, on the same integrated Radeon and on an NVIDIA card. Measurements only, no code.

Tested

  • Head 70eb0a5 (clean worktree), debug, Windows 11 Pro 26200, Ryzen 7 9800X3D, 47 GB. Rust 1.100.0 stable-x86_64-pc-windows-gnu (MinGW-w64 linker, not MSVC). DXC and DXIL 1.9.2609.5 (GitHub release v1.9.2609). XCL_TRANSLATED_CACHE=0 and an empty XCL_DXIL_CACHE per run.
  • cargo test --workspace -- --test-threads=1:
    • Integrated AMD Radeon Graphics (RDNA2, native wave64, driver 32.0.21042.62, XCL_ADAPTER=radeon): 778 passed, 0 failed, 41 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows). Both wave64-only tests ran.
    • NVIDIA GeForce RTX 4070 SUPER (32-lane waves, so the split form; driver 32.0.16.1664): 778 passed, 0 failed, 41 ignored. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
    • Both new tests passed on both adapters, in the full runs and alone (--exact, one thread).
  • Same counts as the PR description's RTX 4060 run.

Note

  • An earlier --test-threads=4 run on the integrated Radeon was stopped part-way, because the host ran short of commit memory. Before it stopped, hle::d3d12x::list_x::tests::cross_queue_cycle_and_same_queue_fifo_do_not_deadlock failed. That test passes in both single-thread runs above, and this PR does not touch it. I am reporting it only in case it turns up elsewhere under memory pressure.

Not tested

  • MSVC builds, release builds, --test-threads=4 on the integrated GPU, Intel, retail titles.

AI use

  • Claude Code (Claude Opus 5.5) set up the toolchain, ran the tests on the hardware above and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
@piyonchu
piyonchu force-pushed the tests/gpu-valu-bitops-packed branch from 70eb0a5 to 693e0a9 Compare November 25, 2026 01:41
@raylitebull

Copy link
Copy Markdown
Member

CI \Build and test\ and \PR description\ passed on \693e0a9. With #1617\ now merged at the end of
ecomp/tests.rs, please rebase onto \main\ and get an independent AMD GPU pass on the updated head (earlier AMD RDNA2 pass was on \70eb0a5).

@piyonchu
piyonchu force-pushed the tests/gpu-valu-bitops-packed branch from 693e0a9 to bc24ac3 Compare November 25, 2026 02:34
@piyonchu

Copy link
Copy Markdown
Contributor Author

Rebased onto main (cbc296a, with #1617 merged) at bc24ac3 and re-ran the full GPU/workspace test suite on RTX 4060 Laptop GPU (1156 passed, 0 failed, 46 ignored, both new tests passing in 0.31s/0.30s).

Updated the PR description with the new head and counts. I do not have AMD GPU hardware locally, so native-wave64 AMD validation on bc24ac3 remains untested on my end.

@JJAutoCompare

Copy link
Copy Markdown

Intel Arc A770 verification for XCL PR #1576

Tested clean PR head bc24ac30f82c8e409b46bacee578dd8889a8a19b on 2026-11-25. The PR was open at that SHA before and after execution. The PR description has NVIDIA results for this SHA, and the discussion has AMD results for an earlier SHA. The final dedup check found no Arc report for this head in the PR discussion, reviews, or issue #42. PR #1576

Tested

Windows 11 Enterprise Evaluation 25H2 (26200.9974), Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), unoptimized Cargo test profile with debug info disabled. The run loaded DXC and DXIL 1.9.2609.5 from the configured DXC directory.

Both fixtures compiled HLSL to cs_6_6 with DXC and dispatched one logical wave64 each on the Arc. The runner selects the split kernel with two 32-lane hardware waves. The same host's existing D3D12 capability probe recorded wave lane minimum/maximum 8/32. Both fixtures checked the results for every logical lane, 0–63.

Libtest test Cases checked per logical lane Result
gpu_bitops_min3_max3_med3_and_sad 27 instruction cases covering bit operations, signed and unsigned 16/32-bit min3/max3/med3, SAD/MSAD, and LERP Pass, 1,728 lane/result comparisons
gpu_packed_16bit_shifts_minmax_mul_and_fma 12 packed instruction cases across 11 opcodes, including two FMA forms and checks of both 16-bit halves Pass, 768 lane/result comparisons

Libtest reported 2 passed, 0 failed, 0 ignored, 0 skipped, with 1,124 filtered out and a 0.61 s harness time. The 39 instruction cases are within the two test functions. The GPU process exited 0 after 39.55 s including the shared-lock wait. The prebuild exited 0 after 54.61 s outside the lock.

Commands

Process-local settings and the prebuild command, with log redirection omitted:

$env:TEMP = 'L:/XclTooling/pr1576'
$env:TMP = 'L:/XclTooling/pr1576'
$env:CARGO_TARGET_DIR = 'L:/XclTooling/pr1512-tiling-edges-fddfa267/target'
$env:CARGO_INCREMENTAL = '0'
$env:CARGO_PROFILE_DEV_DEBUG = '0'
$env:CARGO_PROFILE_TEST_DEBUG = '0'
$env:XCL_ADAPTER = 'A770'
$env:XCL_DXC_DIR = "$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64"

& "$env:USERPROFILE/.cargo/bin/cargo.exe" test --locked -p xcl --lib --no-run -j 2 --message-format json
& powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -File L:/XclTooling/pr1576/arc-20261125-034534-728.ps1

The child script ran the Cargo-reported executable under the shared Arc lock. XCL_DIRECT_DXIL was unset.

$bin = 'L:/XclTooling/pr1512-tiling-edges-fddfa267/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
    & $bin 'gpu::recomp::tests::gpu_bitops_min3_max3_med3_and_sad' 'gpu::recomp::tests::gpu_packed_16bit_shifts_minmax_mul_and_fma' --exact --nocapture --test-threads=1
}

Logs in L:/XclTooling/pr1576 are prebuild-20261125-034421-736.jsonl, prebuild-20261125-034421-736.stderr.log, arc-20261125-034534-728.stdout.log, and arc-20261125-034534-728.stderr.log.

Not tested

Native wave64 (including AMD), direct DXIL, other adapters, release builds, the rest of the test suite, retail smoke runs, and performance.

AI use

T3 Code / Codex (gpt-6.2-sol) verified the exact PR head, ran the two tests, and wrote this report from their outputs.

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.

7 participants