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

Open
github-bot wants to merge 1 commit from github-bot/gh-668 into main AGit
Owner

@⁠lemosss on GitHub · 2026-11-24 03:10 UTC · original
lemosss:tests/gpu-cube-face-ops → main · +98 −0 · 1 files · 1 commits · open

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.
**@⁠lemosss** on GitHub · 2026-11-24 03:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/668) `lemosss:tests/gpu-cube-face-ops` → `main` · +98 −0 · 1 files · 1 commits · open `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.
v_cubeid_f32, v_cubesc_f32, v_cubetc_f32 and v_cubema_f32 had no test
of their own: only v_cubeid ran, in gpu_sdwa_dpp_and_cross_lane, on
three directions with one dominant axis (faces -x, +y, -z) and no
ties. The 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.

gpu_cube_face_ops_random runs the four ops against the ISA's pseudocode
on random directions, bit for bit, as wave64 and as wave32: half of the
lanes tie two or three magnitudes (z wins over y, y over x), some
components are +-0 or +-inf, and VOP3 NEG on SRC0 and ABS on SRC2 are
applied before the axis is picked. No NaNs and no denormals.

Measured on an RTX 4060 (wave32 only): 1600 lanes, 903 with a tie, all
six faces picked, 0 failures. With the z-tie in cube_sc changed from
>= to > the test reports 376 distinct failures.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:28:54 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 03:18 UTC · original

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.

**@⁠MesshM** on GitHub · 2026-11-24 03:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/668#issuecomment-7120963459) 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.
Author
Owner

@⁠lordon1a on GitHub · 2026-11-24 03:26 UTC · original

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.
**@⁠lordon1a** on GitHub · 2026-11-24 03:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/668#issuecomment-7121097349) 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.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:24 UTC · original

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.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/668#issuecomment-7154763098) ### 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 12:21 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-25 12:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/668#issuecomment-7162254468) 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!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/668/head:github-bot/gh-668'
git switch 'github-bot/gh-668'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-668'
git switch 'github-bot/gh-668'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-668'
git switch 'github-bot/gh-668'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-668'
git switch 'main'
git merge --squash 'github-bot/gh-668'
git switch 'main'
git merge --ff-only 'github-bot/gh-668'
git switch 'main'
git merge 'github-bot/gh-668'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.