Skip to content

Tests: cover cube coords, V_PERM_B32, legacy FMA, frexp/ldexp, and f16 unary ops - #1639

Open
piyonchu wants to merge 2 commits into
xcl-dev:mainfrom
piyonchu:tests/gpu-cube-perm-frexp-ldexp-f16
Open

piyonchu wants to merge 2 commits into
xcl-dev:mainfrom
piyonchu:tests/gpu-cube-perm-frexp-ldexp-f16

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 ALU, cube coordinate, permutation, legacy FMA, frexp/ldexp, and unary f16 instructions (1b8025f, 5384af6, rebased onto main cbc296a).

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs (1b8025f): adds gpu_cube_coords_perm_and_legacy_fma (V_CUBEID_F32, V_CUBESC_F32, V_CUBETC_F32, V_CUBEMA_F32, V_PERM_B32 selectors 0..13+, V_FMA_LEGACY_F32/V_FMAC_LEGACY_F32) and gpu_frexp_ldexp_and_unary_f16_ops (V_FREXP_MANT_F32, V_FREXP_EXP_I32_F32, V_FREXP_MANT_F16, V_FREXP_EXP_I16_F16, V_LDEXP_F16, V_FLOOR_F16, V_CEIL_F16, V_TRUNC_F16, V_RNDNE_F16, V_FRACT_F16, V_RCP_F16, V_RSQ_F16, V_SQRT_F16, V_LOG_F16, V_EXP_F16, V_SIN_F16, V_COS_F16).
  • crates/xcl/src/gpu/recomp/tests.rs (5384af6): adds V_PERM_B32 selector 10 (0x0A070502) and swapped SRC0/SRC1 zero operands for V_FMA_LEGACY_F32 / V_FMAC_LEGACY_F32.

Note: gpu_frexp_ldexp_and_unary_f16_ops scopes frexp inputs to positive normal/special values (6.0, 0.375, 0.125, 0.0, +inf, NaN) because emit.rs currently lowers frexp_mant / frexp_exp via HLSL frexp(), which strips the sign on negative values and flushes f32 subnormals under SM 6.6.

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 5384af6315b1d22fa523442d7f599dc7c92a5f7c:
  • cargo test -p xcl --lib gpu_cube_coords_perm_and_legacy_fma: 1 passed, 0 failed (0.38s).
  • cargo test -p xcl --lib gpu_frexp_ldexp_and_unary_f16_ops: 1 passed, 0 failed (0.27s).
  • 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.

@Belox17

Belox17 commented Nov 24, 2026

Copy link
Copy Markdown

Test report for 77413a91 on NVIDIA (RTX 3060 Ti): both new GPU tests pass and nothing else changes

Tested

  • NVIDIA GeForce RTX 3060 Ti 8 GB (32-lane waves), driver 32.0.16.2124; Ryzen 5 5600X; Windows 11 build 26300; rustc 1.98.1 MSVC; DXC 1.8.2502.11 (Windows SDK 10.0.26100); debug build. Head 77413a91 as is (base 9e3831e), clean tree.
  • The new tests (gpu_cube_coords_perm_and_legacy_fma, gpu_frexp_ldexp_and_unary_f16_ops) with cargo test -p xcl --lib <name>: 2 passed (the GPU part ran on this adapter, no SKIPPED).
  • cargo test --workspace -- --test-threads=4 on the head: 778 passed, 0 failed, 41 ignored; its base 9e3831e on the same machine: 776 passed, 0 failed, 41 ignored. SKIPPED on both: 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).
  • Merged into current main c160d86e (clean merge): 860 passed, 0 failed, 42 ignored; main alone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above.

Not tested

  • AMD / native wave64 hardware; any retail title (no smoke run).

AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.

@mantavisual

Copy link
Copy Markdown

Test report for 77413a910109ee7abe6ad1a9edaea89d43bd08af.

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? Two breaks are not noticed:

  • V_PERM_B32 selector 10 reading s0 bit 31 instead of bit 15. The comment lists 8..11, but selector 10 is not used. A case with selector 0x0A070502, expecting 0x00840243, passes normally and fails with the break.
  • fma_legacy ignoring a zero in the second operand. Only the first operand is ever zero. The same case with SRC0 and SRC1 swapped passes normally and fails with the break.

Three 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 both missing cases in gpu_cube_coords_perm_and_legacy_fma:

  • V_PERM_B32 with selector 0x0A_07_05_02 (exercising selector 10 = s0[bit15] -> 0x00_84_02_43).
  • V_FMA_LEGACY_F32 and V_FMAC_LEGACY_F32 with SRC0/SRC1 swapped ((+inf) * (+0.0 / -0.0) + c).

Re-verified gpu_cube_coords_perm_and_legacy_fma (1 passed; 0 failed) and gpu_frexp_ldexp_and_unary_f16_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!

@malzaharhub-ctrl

Copy link
Copy Markdown

Independent AMD GPU validation — RX 7900 XTX

Tested PR #1639 at commit 7e55a23943ae5091b80606ea86f9d06bbfcedd4d.

Hardware and environment

  • Windows 11 Pro, build 26300
  • AMD Ryzen 7 5800X
  • AMD Radeon RX 7900 XTX, 24 GB
  • AMD driver 32.0.32029.2010 (18 November 2026)
  • Rust 1.100.0
  • DXC / DXIL 1.9.2602.17

Targeted GPU tests

Both tests were run with XCL_REQUIRE_GPU=wave64.

  • gpu_cube_coords_perm_and_legacy_fma: 1 passed, 0 failed.
  • gpu_frexp_ldexp_and_unary_f16_ops: 1 passed, 0 failed.

Full GPU recompiler test group

Command:

cargo test --locked -p xcl --lib gpu::recomp -- --test-threads=1 --show-output

Result:

  • 194 passed
  • 0 failed
  • 18 ignored
  • 538 filtered out
  • Runtime: 21.66 seconds

This was run with XCL_REQUIRE_GPU=wave64.

Full workspace validation

Ran scripts/test.ps1 using PowerShell with a temporary execution-policy bypass.

Result: exit code 0.

One optional GPU test was skipped because the adapter does not support heap windows. No test failures were reported.

The repository working tree remained clean throughout testing. No source changes were made.

I have not tested any game files.

AI assistance disclosure: ChatGPT assisted with interpreting test results and drafting this report. I independently executed the commands and tests on my hardware and verified the results.

@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-cube-perm-frexp-ldexp-f16 branch from 7e55a23 to 8587f4e Compare November 25, 2026 01:33
@raylitebull

Copy link
Copy Markdown
Member

CI \Build and test\ and \PR description\ passed on \8587f4e. 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 (earlier RX 7900 XTX pass was on \7e55a23).

@piyonchu
piyonchu force-pushed the tests/gpu-cube-perm-frexp-ldexp-f16 branch from 8587f4e to 5384af6 Compare November 25, 2026 02:32
@piyonchu

Copy link
Copy Markdown
Contributor Author

Rebased onto main (cbc296a, with #1617 merged) at 5384af6 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.38s/0.27s).

Updated the PR description with the new head and counts. I do not have AMD GPU hardware locally, so native-wave64 AMD validation on 5384af6 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.

7 participants