Tests: check the cube face ops on the GPU against the ISA #663

Closed
lemosss wants to merge 1 commit from upstream-pr/668 into main
lemosss commented 2026-11-24 03:10:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lemosss on 2026-11-24T03:10:42Z.


v_cubeid_f32, v_cubesc_f32, v_cubetc_f32 and v_cubema_f32 had no test of their own: only v_cubeid runs, inside gpu_sdwa_dpp_and_cross_lane, on three directions with one dominant axis (faces −x, +y, −z) and no ties. Their translation (cube_id / cube_sc / cube_tc / cube_ma in emit.rs) picks the major axis by hand, and a wrong tie rule or sign there changes which face and texel a cube sample reads. This adds a GPU test that checks all four against the ISA's pseudocode, bit for bit. Test only: no runtime change. I found no issue or open PR for these ops (searched for cube, v_cube, and the open "GPU checks" test PRs).

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_cube_face_ops_random and its CPU reference cube_ref (the ISA pseudocode: z is the major axis when |z| ≥ |x| and |z| ≥ |y|, else y when |y| ≥ |x|, else x). Random directions, one wave per dispatch in 50 dispatches (XCL_FUZZ_ITERS=n for more), as wave64 where the GPU has it and as wave32:
    • half of the lanes tie two or three magnitudes, with random signs (ties go to z, then y);
    • components ±0, ±inf, small values on 1/8 steps and normal floats with |v| in [2⁻²⁰, 2²⁰);
    • VOP3 NEG on SRC0 and ABS on SRC2, applied before the axis is picked;
    • no NaNs and no denormals: the shader's f32 denormal mode is not what this checks;
    • the test also asserts that all six faces were picked.

Tested

  • NVIDIA GeForce RTX 4060 8 GB (32-lane waves only), driver 610.88 (32.0.16.1088); Intel Core i7-10700K, 16 GB; Windows 11 Pro 26H2, build 26300.9974
  • Rust 1.100.0 stable-x86_64-pc-windows-msvc, VS 2022 Build Tools (MSVC 14.44), DXC 1.9.2609.5 (GitHub release, XCL_DXC_DIR); debug build
  • cargo test -p xcl --lib gpu_cube_face_ops_random -- --nocapture: passed, wave32: lanes 1600, with a tie 903, faces +x/-x/+y/-y/+z/-z [157, 176, 207, 242, 422, 396], 0 distinct failures
  • Negative control (not committed): with the z-tie in cube_sc changed from >= to >, the test reports 376 distinct failures, e.g. cubesc(-1.25e0, -1.25e0, -1.25e0) = -1.25e0, want 1.25e0
  • cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4 on this branch (main dd2ae9a + this commit): 691 passed, 0 failed, 41 ignored
  • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware

Regression run

  • not needed: the PR changes only tests.rs, no runtime file

Not tested

  • wave64 / AMD hardware: this adapter has 32-lane waves only, so the wave64 pass did not run
  • NaN inputs and denormals (left out on purpose, see above)
  • the full suite on main dd2ae9a without this commit (not run separately)
  • release build

AI use

  • Claude Code with Claude Opus 5.5: chose the untested ops, wrote the test and the CPU reference, ran the test, the negative control and the full suite, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5465362946 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/668). Originally posted by [lemosss](https://github.com/lemosss) on 2026-11-24T03:10:42Z. --- `v_cubeid_f32`, `v_cubesc_f32`, `v_cubetc_f32` and `v_cubema_f32` had no test of their own: only `v_cubeid` runs, inside `gpu_sdwa_dpp_and_cross_lane`, on three directions with one dominant axis (faces −x, +y, −z) and no ties. Their translation (`cube_id` / `cube_sc` / `cube_tc` / `cube_ma` in `emit.rs`) picks the major axis by hand, and a wrong tie rule or sign there changes which face and texel a cube sample reads. This adds a GPU test that checks all four against the ISA's pseudocode, bit for bit. Test only: no runtime change. I found no issue or open PR for these ops (searched for `cube`, `v_cube`, and the open "GPU checks" test PRs). **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_cube_face_ops_random` and its CPU reference `cube_ref` (the ISA pseudocode: z is the major axis when |z| ≥ |x| and |z| ≥ |y|, else y when |y| ≥ |x|, else x). Random directions, one wave per dispatch in 50 dispatches (`XCL_FUZZ_ITERS=n` for more), as wave64 where the GPU has it and as wave32: - half of the lanes tie two or three magnitudes, with random signs (ties go to z, then y); - components ±0, ±inf, small values on 1/8 steps and normal floats with |v| in [2⁻²⁰, 2²⁰); - VOP3 `NEG` on SRC0 and `ABS` on SRC2, applied before the axis is picked; - no NaNs and no denormals: the shader's f32 denormal mode is not what this checks; - the test also asserts that all six faces were picked. **Tested** - NVIDIA GeForce RTX 4060 8 GB (32-lane waves only), driver 610.88 (32.0.16.1088); Intel Core i7-10700K, 16 GB; Windows 11 Pro 26H2, build 26300.9974 - Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, VS 2022 Build Tools (MSVC 14.44), DXC 1.9.2609.5 (GitHub release, `XCL_DXC_DIR`); debug build - `cargo test -p xcl --lib gpu_cube_face_ops_random -- --nocapture`: passed, `wave32: lanes 1600, with a tie 903, faces +x/-x/+y/-y/+z/-z [157, 176, 207, 242, 422, 396]`, 0 distinct failures - Negative control (not committed): with the z-tie in `cube_sc` changed from `>=` to `>`, the test reports 376 distinct failures, e.g. `cubesc(-1.25e0, -1.25e0, -1.25e0) = -1.25e0, want 1.25e0` - `cargo build --workspace` + `cargo test --workspace --no-fail-fast -- --test-threads=4` on this branch (`main` `dd2ae9a` + this commit): **691 passed, 0 failed, 41 ignored** - `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` **Regression run** - not needed: the PR changes only `tests.rs`, no runtime file **Not tested** - wave64 / AMD hardware: this adapter has 32-lane waves only, so the wave64 pass did not run - NaN inputs and denormals (left out on purpose, see above) - the full suite on `main` `dd2ae9a` without this commit (not run separately) - release build **AI use** - Claude Code with Claude Opus 5.5: chose the untested ops, wrote the test and the CPU reference, ran the test, the negative control and the full suite, and drafted this description.
towiice commented 2026-11-24 03:47:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T03:47:24Z.

Review: COMMENTED


Tested:

  • Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, 32-wide subgroups / wave32, driver 610.88), Windows 11 x64 (26H2 / 10.0.26300), DXC v1.9.2609 (01b62ad4), toolchain stable-x86_64-pc-windows-gnullvm (llvm-mingw 23.1.6).
  • Test command: cargo test -p xcl --lib cube -- --nocapture
  • Result: 6 passed, 0 failed (0.85 s):
    • gpu_cube_face_ops_random verified across 1600 wave32 lanes across all 6 cube faces (+x/-x/+y/-y/+z/-z [157, 176, 207, 242, 422, 396]) with 0 distinct failures.
    • gpu_cube_array_slices
    • gpu_retail_vs_blit_gen_amb_cube
      Cube face operations match ISA expectations cleanly on Turing hardware.
<!-- greyfinch-sync:ivall/xcl:review:6033355029 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/668#pullrequestreview-6033355029). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T03:47:24Z. **Review:** COMMENTED --- **Tested:** - Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, 32-wide subgroups / wave32, driver 610.88), Windows 11 x64 (26H2 / 10.0.26300), DXC v1.9.2609 (`01b62ad4`), toolchain `stable-x86_64-pc-windows-gnullvm` (llvm-mingw 23.1.6). - Test command: `cargo test -p xcl --lib cube -- --nocapture` - Result: **6 passed, 0 failed** (0.85 s): - `gpu_cube_face_ops_random` verified across 1600 wave32 lanes across all 6 cube faces (+x/-x/+y/-y/+z/-z [157, 176, 207, 242, 422, 396]) with 0 distinct failures. - `gpu_cube_array_slices` - `gpu_retail_vs_blit_gen_amb_cube` Cube face operations match ISA expectations cleanly on Turing hardware.
MesshM commented 2026-11-24 07:05:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T03:18:17Z.


Test run of be9f1e5cb9a6dc2f3ad731d3accd06b9be3ecfb6 on AMD RDNA4 (native wave64). I merged it onto current main 63cdc25 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 693 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 653 passed, 0 failed, 21 ignored
  • 0 SKIPPED; gpu_cube_face_ops_random passes.

Review: The reference picks the major axis as the ISA does (z when |z| ≥ |x| and |z| ≥ |y|, else y when |y| ≥ |x|, else x), so ties resolve the hardware's way, and the NEG / ABS variants check that the source modifiers are applied before the face is chosen. I found nothing to change.

Not tested: no retail title (not needed for a test-only change), release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

<!-- greyfinch-sync:ivall/xcl:comment:7120963459 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/668#issuecomment-7120963459). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T03:18:17Z. --- Test run of `be9f1e5cb9a6dc2f3ad731d3accd06b9be3ecfb6` on AMD RDNA4 (native wave64). I merged it onto current `main` `63cdc25` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **693 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 653 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `gpu_cube_face_ops_random` passes. **Review:** The reference picks the major axis as the ISA does (z when |z| ≥ |x| and |z| ≥ |y|, else y when |y| ≥ |x|, else x), so ties resolve the hardware's way, and the NEG / ABS variants check that the source modifiers are applied before the face is chosen. I found nothing to change. **Not tested:** no retail title (not needed for a test-only change), release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
lordon1a commented 2026-11-24 07:05:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lordon1a on 2026-11-24T03:26:50Z.


Independent GPU test report on be9f1e5:

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build, DXC 1.9.2609.5 (01b62ad4)
  • Command: cargo test -p xcl --lib cube -- --nocapture
  • Result: 6 passed, 0 failed, 0 ignored in 0.84s
    • gpu::recomp::tests::gpu_cube_face_ops_random: wave32: lanes 1600, with a tie 903, faces +x/-x/+y/-y/+z/-z [157, 176, 207, 242, 422, 396], 0 distinct failures — ok

Not tested

  • AMD / wave64, Intel GPU, retail title

AI use

  • Antigravity (Google DeepMind agent) — fetched be9f1e5 in a detached worktree, audited the diff, ran the GPU test, and posted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7121097349 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/668#issuecomment-7121097349). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T03:26:50Z. --- Independent GPU test report on `be9f1e5`: **Tested** - Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver `616.64`, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`), debug build, DXC `1.9.2609.5` (`01b62ad4`) - Command: `cargo test -p xcl --lib cube -- --nocapture` - Result: **6 passed, 0 failed, 0 ignored** in `0.84s` - `gpu::recomp::tests::gpu_cube_face_ops_random`: `wave32: lanes 1600, with a tie 903, faces +x/-x/+y/-y/+z/-z [157, 176, 207, 242, 422, 396]`, `0 distinct failures` — **ok** **Not tested** - AMD / wave64, Intel GPU, retail title **AI use** - Antigravity (Google DeepMind agent) — fetched `be9f1e5` in a detached worktree, audited the diff, ran the GPU test, and posted this report.
JJAutoCompare commented 2026-11-25 07:05:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:24:44Z.


Empirical test report (be9f1e5c)

Hardware / environment

  • Commit: be9f1e5cb9a6dc2f3ad731d3accd06b9be3ecfb6 (detached checkout of PR #668).
  • Intel Arc A770 Graphics, driver 32.0.101.9175. AMD Ryzen 7 3800X 8-Core Processor.
  • Windows 11 Enterprise Evaluation, build 10.0.26200.9974. Rust 1.100.0 (0ef1bc386 2026-11-09), host x86_64-pc-windows-msvc.
  • DXC: dxcompiler 1.9.2609.5 (01b62ad4), dxil 1.9.2609.5. Unoptimized test profile with debug info and incremental compilation disabled.

Commands and results

  • cargo test -p xcl --lib --no-run exited 0 outside the Arc lock. This compiled the library test executable without running tests.
  • With XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1, ran the following inside Invoke-ArcTest.ps1. In the command, $testExe is the library test executable emitted by Cargo.
& $testExe gpu::recomp::tests::gpu_cube_face_ops_random --exact --nocapture --test-threads=1
  • Focused exit code 0. The libtest summary recorded 1 passed, 0 failed, 0 ignored, and 671 filtered out in 0.34 s. There were 0 case-sensitive lines beginning with SKIPPED in the UTF-8 log.

Observed behavior

The test compared the four cube-face instructions and selected VOP3 NEG and ABS cases against its ISA-derived CPU reference, bit for bit. The Wave32 run checked 1,600 lanes, including 903 with tied component magnitudes. The face counts in +X, −X, +Y, −Y, +Z, −Z order were 157, 176, 207, 242, 422, and 396. The test reported zero distinct failures.

Not tested

The full GPU workspace suite, game smoke runs, and native Wave64 execution were omitted.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr668-focused.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7154763098 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/668#issuecomment-7154763098). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T06:24:44Z. --- ### Empirical test report (be9f1e5c) **Hardware / environment** - Commit: `be9f1e5cb9a6dc2f3ad731d3accd06b9be3ecfb6` (detached checkout of PR #668). - Intel Arc A770 Graphics, driver `32.0.101.9175`. AMD Ryzen 7 3800X 8-Core Processor. - Windows 11 Enterprise Evaluation, build `10.0.26200.9974`. Rust `1.100.0 (0ef1bc386 2026-11-09)`, host `x86_64-pc-windows-msvc`. - DXC: `dxcompiler 1.9.2609.5 (01b62ad4)`, `dxil 1.9.2609.5`. Unoptimized test profile with debug info and incremental compilation disabled. **Commands and results** - `cargo test -p xcl --lib --no-run` exited 0 outside the Arc lock. This compiled the library test executable without running tests. - With `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`, ran the following inside `Invoke-ArcTest.ps1`. In the command, `$testExe` is the library test executable emitted by Cargo. ```powershell & $testExe gpu::recomp::tests::gpu_cube_face_ops_random --exact --nocapture --test-threads=1 ``` - Focused exit code 0. The libtest summary recorded 1 passed, 0 failed, 0 ignored, and 671 filtered out in 0.34 s. There were 0 case-sensitive lines beginning with `SKIPPED ` in the UTF-8 log. **Observed behavior** The test compared the four cube-face instructions and selected VOP3 NEG and ABS cases against its ISA-derived CPU reference, bit for bit. The Wave32 run checked 1,600 lanes, including 903 with tied component magnitudes. The face counts in +X, −X, +Y, −Y, +Z, −Z order were 157, 176, 207, 242, 422, and 396. The test reported zero distinct failures. **Not tested** The full GPU workspace suite, game smoke runs, and native Wave64 execution were omitted. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr668-focused.log and published.
DavidM1911 commented 2026-11-25 13:05:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:21:01Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7162254468 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/668#issuecomment-7162254468). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T12:21:01Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!

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!663
No description provided.