Skip to content

Tests: cover SOPK, scalar bit reverse/ff0, f32 unary math, and f16 integer cvt on GPU - #1672

Open
piyonchu wants to merge 2 commits into
xcl-dev:mainfrom
piyonchu:tests/gpu-sopk-f32-unary-cvt16
Open

piyonchu wants to merge 2 commits into
xcl-dev:mainfrom
piyonchu:tests/gpu-sopk-f32-unary-cvt16

Conversation

@piyonchu

@piyonchu piyonchu commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Tests only — adds GPU execution coverage in crates/xcl/src/gpu/recomp/tests.rs for previously untested RDNA2 SOPK, scalar bit-manipulation, f32 unary math/rounding, and f16 integer conversion instructions (364b464, 06649f0, rebased onto main cbc296a).

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs (364b464): adds gpu_sopk_and_scalar_bit_reverse_zero_scan (S_ADDK_I32, S_MULK_I32, all 12 S_CMPK_{EQ,LG,LT,LE,GT,GE}_{I32,U32}, S_BREV_B32, S_BREV_B64, S_FF0_I32_B32, S_FF0_I32_B64, S_FLBIT_I32_B32, S_BFM_B32, S_BITSET0_B32) and gpu_f32_unary_and_cvt_f16_int_ops (V_FLOOR_F32, V_CEIL_F32, V_TRUNC_F32, V_RNDNE_F32, V_RCP_F32, V_RSQ_F32, V_SQRT_F32, V_LOG_F32, V_EXP_F32, V_SIN_F32, V_COS_F32, V_CVT_{F16_U16,F16_I16,U16_F16,I16_F16}).
  • crates/xcl/src/gpu/recomp/tests.rs (06649f0): adds high-bit (0x8000_0000 vs 1) and zero-extended 0xFFFF (65535) immediate cases across S_CMPK_*_U32.

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 06649f040fe082ec94b005fe649ee6f1e52c8fa0:
  • cargo test -p xcl --lib gpu_sopk_and_scalar_bit_reverse_zero_scan: 1 passed, 0 failed (0.28s).
  • cargo test -p xcl --lib gpu_f32_unary_and_cvt_f16_int_ops: 1 passed, 0 failed (0.26s).
  • 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.

Not tested

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

AI use

  • Antigravity (Claude) authored the tests, rebased onto main, ran the local workspace GPU suite, and drafted this PR description.

@mantavisual

Copy link
Copy Markdown

Test report for ced583d4b8a9450395c871f464c965b4d7bfdbf4.

Tested

  • RTX 4060 8 GB (driver 616.92, wave32), i5-13600K, 32 GB, Windows 11 Pro 22631, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (SDK 10.0.26100), debug.
  • cargo test -p xcl --lib --locked <name>: both new tests pass.

Do the tests notice a broken translator? One break is not noticed:

  • The unsigned S_CMPK compares done as signed. The U32 cases use s23 = 500 and immediates 499 to 501, where both agree. Adding S_CMPK_EQ_U32 with 65535 / 0xFFFF and S_CMPK_GT_U32 with 0x80000000 / 1 (both expect 1) passes normally and fails with the break.

Four other breaks were caught.

Not tested: the whole suite, AMD, native wave64, retail title.

AI use: Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me.

@piyonchu

Copy link
Copy Markdown
Contributor Author

Thanks for the mutation check on RTX 4060, @mantavisual! Added high-bit (0x8000_0000 vs 1) and zero-extended 0xFFFF (65535) cases across all six S_CMPK_*_U32 operations (EQ/LG/LT/LE/GT/GE) in gpu_sopk_and_scalar_bit_reverse_zero_scan so signed comparison or sign-extending SIMM16 cannot pass. Re-verified gpu_sopk_and_scalar_bit_reverse_zero_scan (1 passed; 0 failed) and gpu_f32_unary_and_cvt_f16_int_ops (1 passed; 0 failed) on RTX 4060.

@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.

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-sopk-f32-unary-cvt16 branch from abdd27c to f235a39 Compare November 25, 2026 01:36
@raylitebull

Copy link
Copy Markdown
Member

CI \Build and test\ and \PR description\ passed on \ 235a39. With #1617\ now merged at the end of
ecomp/tests.rs, please rebase onto \main\ and obtain an AMD GPU pass on the rebased head.

@piyonchu
piyonchu force-pushed the tests/gpu-sopk-f32-unary-cvt16 branch from f235a39 to 06649f0 Compare November 25, 2026 02:29
@piyonchu

Copy link
Copy Markdown
Contributor Author

Rebased onto main (cbc296a, with #1617 merged) at 06649f0 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.28s/0.26s).

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

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.

5 participants