Recompiler tests: cover v_cubeid/sc/tc/ma_f32 and cubemap sample roundtrip on the GPU #1092

Open
certified-retart wants to merge 1 commit from upstream-pr/1101 into main
certified-retart commented 2026-11-24 11:35:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by certified-retart on 2026-11-24T11:35:15Z.


What is in it
Adds two GPU recompiler tests in crates/xcl/src/gpu/recomp/tests.rs covering the RDNA2 cubemap coordinate instructions (v_cubeid_f32, v_cubesc_f32, v_cubetc_f32, v_cubema_f32), which previously had no non-retail test coverage:

  • gpu_cube_coords: verifies all four instructions against the AMD RDNA2 ISA specification in both wave64 and wave32 across all 6 faces with asymmetric magnitudes/signs, all tie-breaking boundaries (|z| >= |x|, |y|, then |y| >= |x|, else x), signed-zero inputs, and VOP3 NEG, ABS, OMOD (/2), and CLAMP modifiers.
  • gpu_cube_coords_sample_roundtrip: runs the full RDNA2 cubemap projection sequence (v_cubeid/sc/tc/ma_f32 -> v_rcp_f32(|ma|) -> v_fma_f32(..., 1.5) -> image_sample_lz) against a 2x2x6 TexDim::Cube texture with 24 unique [face, tx, ty, 1.0] texels across all 24 off-center face/quadrant directions at multiple scales, verifying that cube_id/cube_sc/cube_tc/cube_ma and cube_dir agree on every face and both S/T orientations on D3D12 hardware.

Tests-only change (crates/xcl/src/gpu/recomp/tests.rs, +148 lines).

Tested

  • Hardware: Ryzen 7 9800X3D, Windows 10 Pro (build 19045), rustc 1.100.0 (0ef1bc386 2026-11-09), debug build, Agility SDK v614 (XCL_D3D12_DIR).
  • cargo test -p xcl --lib gpu_cube -- --nocapture with XCL_REQUIRE_GPU=wave64:
    • NVIDIA GeForce RTX 5070 (driver 32.0.16.1074, XCL_ADAPTER=0, split wave64 + wave32): 3 passed, 0 failed.
    • AMD Radeon(TM) Graphics RDNA2 gfx1036 (driver 32.0.21030.2001, XCL_ADAPTER=1, native wave64 + wave32): 3 passed, 0 failed.
  • XCL_ADAPTER=warp: skips cleanly via gpu_ready() (WARP lacks SM 6.6).
  • cargo test --workspace -- --test-threads=4 on RTX 5070: 742 passed, 0 failed, 41 ignored.

Not tested

  • Retail titles (scripts/smoke.ps1; no retail game files on this machine, tests-only change).
  • D3D12 debug layer (XCL_D3D12_DEBUG=1; Windows Graphics Tools optional feature not installed on this host).

AI use
Written and audited with Antigravity (gemini-4-neon orchestrating and reviewing gemini-4-hydrogen), verified on local NVIDIA RTX 5070 and AMD RDNA2 gfx1036 hardware.

<!-- greyfinch-sync:ivall/xcl:issue:5471359314 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1101). Originally posted by [certified-retart](https://github.com/certified-retart) on 2026-11-24T11:35:15Z. --- **What is in it** Adds two GPU recompiler tests in `crates/xcl/src/gpu/recomp/tests.rs` covering the RDNA2 cubemap coordinate instructions (`v_cubeid_f32`, `v_cubesc_f32`, `v_cubetc_f32`, `v_cubema_f32`), which previously had no non-retail test coverage: - `gpu_cube_coords`: verifies all four instructions against the AMD RDNA2 ISA specification in both wave64 and wave32 across all 6 faces with asymmetric magnitudes/signs, all tie-breaking boundaries (`|z| >= |x|, |y|`, then `|y| >= |x|`, else `x`), signed-zero inputs, and VOP3 `NEG`, `ABS`, `OMOD` (`/2`), and `CLAMP` modifiers. - `gpu_cube_coords_sample_roundtrip`: runs the full RDNA2 cubemap projection sequence (`v_cubeid/sc/tc/ma_f32` -> `v_rcp_f32(|ma|)` -> `v_fma_f32(..., 1.5)` -> `image_sample_lz`) against a 2x2x6 `TexDim::Cube` texture with 24 unique `[face, tx, ty, 1.0]` texels across all 24 off-center face/quadrant directions at multiple scales, verifying that `cube_id`/`cube_sc`/`cube_tc`/`cube_ma` and `cube_dir` agree on every face and both S/T orientations on D3D12 hardware. Tests-only change (`crates/xcl/src/gpu/recomp/tests.rs`, +148 lines). **Tested** - Hardware: Ryzen 7 9800X3D, Windows 10 Pro (build 19045), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug build, Agility SDK v614 (`XCL_D3D12_DIR`). - `cargo test -p xcl --lib gpu_cube -- --nocapture` with `XCL_REQUIRE_GPU=wave64`: - NVIDIA GeForce RTX 5070 (driver `32.0.16.1074`, `XCL_ADAPTER=0`, split wave64 + wave32): 3 passed, 0 failed. - AMD Radeon(TM) Graphics RDNA2 `gfx1036` (driver `32.0.21030.2001`, `XCL_ADAPTER=1`, native wave64 + wave32): 3 passed, 0 failed. - `XCL_ADAPTER=warp`: skips cleanly via `gpu_ready()` (WARP lacks SM 6.6). - `cargo test --workspace -- --test-threads=4` on RTX 5070: 742 passed, 0 failed, 41 ignored. **Not tested** - Retail titles (`scripts/smoke.ps1`; no retail game files on this machine, tests-only change). - D3D12 debug layer (`XCL_D3D12_DEBUG=1`; Windows Graphics Tools optional feature not installed on this host). **AI use** Written and audited with Antigravity (`gemini-4-neon` orchestrating and reviewing `gemini-4-hydrogen`), verified on local NVIDIA RTX 5070 and AMD RDNA2 `gfx1036` hardware.
towiice commented 2026-11-24 11:44:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T11:44:38Z.

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 gpu_cube -- --nocapture
  • Result: 3 passed, 0 failed (0.99 s):
    • gpu_cube_coords: all four cubemap coordinate instructions (v_cubeid_f32, v_cubesc_f32, v_cubetc_f32, v_cubema_f32) verify tie-breaking, signed-zero inputs, and modifiers on hardware.
    • gpu_cube_coords_sample_roundtrip: full cubemap projection sequence and image_sample_lz roundtrip pass across all 24 directions.
    • gpu_cube_array_slices
      Clean test coverage passing on NVIDIA Turing wave32 hardware without regressions.
<!-- greyfinch-sync:ivall/xcl:review:6038589833 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1101#pullrequestreview-6038589833). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T11:44:38Z. **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 gpu_cube -- --nocapture` - Result: **3 passed, 0 failed** (0.99 s): - `gpu_cube_coords`: all four cubemap coordinate instructions (`v_cubeid_f32`, `v_cubesc_f32`, `v_cubetc_f32`, `v_cubema_f32`) verify tie-breaking, signed-zero inputs, and modifiers on hardware. - `gpu_cube_coords_sample_roundtrip`: full cubemap projection sequence and `image_sample_lz` roundtrip pass across all 24 directions. - `gpu_cube_array_slices` Clean test coverage passing on NVIDIA Turing wave32 hardware without regressions.
Aniseto commented 2026-11-24 12:05:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-24T11:42:05Z.


Ran the new cubemap tests on an NVIDIA Blackwell part at 8c11748:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu_cube
gpu_cube_coords ... ok
gpu_cube_coords_sample_roundtrip ... ok
gpu_cube_array_slices ... ok
3 passed; 0 failed; 0 ignored      (exit 0)

The two new tests (gpu_cube_coords, gpu_cube_coords_sample_roundtrip) and the existing gpu_cube_array_slices pass here in the wave32 + split-wave64 form (no native wave64 on this adapter). This adds a second Blackwell part and driver line next to the author's RTX 5070 run.

Not tested: native wave64, RDNA2/RDNA4 and Intel GPUs, Wine, release profile, optional XCL_SAMPLE_* retail-data tests.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified.

<!-- greyfinch-sync:ivall/xcl:comment:7130434927 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1101#issuecomment-7130434927). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-24T11:42:05Z. --- Ran the new cubemap tests on an NVIDIA Blackwell part at `8c11748`: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu_cube gpu_cube_coords ... ok gpu_cube_coords_sample_roundtrip ... ok gpu_cube_array_slices ... ok 3 passed; 0 failed; 0 ignored (exit 0) ``` The two new tests (`gpu_cube_coords`, `gpu_cube_coords_sample_roundtrip`) and the existing `gpu_cube_array_slices` pass here in the wave32 + split-wave64 form (no native wave64 on this adapter). This adds a second Blackwell part and driver line next to the author's RTX 5070 run. Not tested: native wave64, RDNA2/RDNA4 and Intel GPUs, Wine, release profile, optional `XCL_SAMPLE_*` retail-data tests. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified.
thehollowedone commented 2026-11-24 12:05:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T11:42:29Z.


D3D12 debug-layer check at 8c11748 on Windows 11, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. The offline workspace build and all three stock gpu_cube tests passed with zero skips.

I repeated them after enabling Graphics Tools before device creation in the scratch shader runner. The adapter reported native wave32 and no native wave64, so wave64 used XCL’s split path. All four kernel dispatches left the D3D12 info queue empty. The two new tests checked cubemap coordinates and read back samples from all six faces.

AI-assisted. Codex (GPT-6) enabled debug validation in the scratch runner and ran the tests.

<!-- greyfinch-sync:ivall/xcl:comment:7130443115 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1101#issuecomment-7130443115). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-24T11:42:29Z. --- D3D12 debug-layer check at [8c11748](https://github.com/ivall/xcl/commit/8c11748063c9f75f483356745bb128ada7f123d6) on Windows 11, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. The offline workspace build and all three stock `gpu_cube` tests passed with zero skips. I repeated them after enabling Graphics Tools before device creation in the scratch shader runner. The adapter reported native wave32 and no native wave64, so wave64 used XCL’s split path. All four kernel dispatches left the D3D12 info queue empty. The two new tests checked cubemap coordinates and read back samples from all six faces. AI-assisted. Codex (GPT-6) enabled debug validation in the scratch runner and ran the tests.
mynzjerko commented 2026-11-24 12:05:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mynzjerko on 2026-11-24T11:53:57Z.


Tested on native Windows + AMD RDNA4 (both wave64 and wave32 paths): both new cubemap tests and the full workspace suite passed with 0 skips.

Tested

  • Commit: 8c11748063c9f75f483356745bb128ada7f123d6
  • Hardware / OS: AMD Radeon RX 9070 (RDNA4, native wave64, driver 32.0.32029.2010), AMD Ryzen 5 7500F, Windows 11 Pro 10.0.26300, rustc 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17, debug build
  • cargo build --workspace: ok
  • cargo test -p xcl --lib -- gpu_cube_coords gpu_cube_coords_sample_roundtrip --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored (0 SKIPPED)
  • cargo test --workspace -- --test-threads=4: 743 passed, 0 failed, 41 ignored (xcl --lib: 700 passed, 0 failed, 21 ignored; SKIPPED GPU tests: 0)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine, release build, retail titles (scripts/smoke.ps1)

AI use

  • Google Antigravity (Gemini 4 Neon) checked out the PR, ran the builds and tests locally, and drafted this report; I verified the results before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7130693597 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1101#issuecomment-7130693597). Originally posted by [mynzjerko](https://github.com/mynzjerko) on 2026-11-24T11:53:57Z. --- Tested on native Windows + AMD RDNA4 (both `wave64` and `wave32` paths): both new cubemap tests and the full workspace suite passed with 0 skips. **Tested** - Commit: `8c11748063c9f75f483356745bb128ada7f123d6` - Hardware / OS: AMD Radeon RX 9070 (RDNA4, native wave64, driver `32.0.32029.2010`), AMD Ryzen 5 7500F, Windows 11 Pro 10.0.26300, `rustc 1.100.0` (`stable-x86_64-pc-windows-msvc`), DXC `1.9.2602.17`, debug build - `cargo build --workspace`: ok - `cargo test -p xcl --lib -- gpu_cube_coords gpu_cube_coords_sample_roundtrip --nocapture --test-threads=1`: 2 passed, 0 failed, 0 ignored (`0 SKIPPED`) - `cargo test --workspace -- --test-threads=4`: 743 passed, 0 failed, 41 ignored (`xcl --lib`: 700 passed, 0 failed, 21 ignored; `SKIPPED` GPU tests: 0) **Not tested** - NVIDIA / Intel GPUs, Linux / Wine, release build, retail titles (`scripts/smoke.ps1`) **AI use** - Google Antigravity (Gemini 4 Neon) checked out the PR, ran the builds and tests locally, and drafted this report; I verified the results before posting.
DavidM1911 commented 2026-11-25 09:08:13 +00:00 (Migrated from github.com)

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


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7156935807 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1101#issuecomment-7156935807). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:21:58Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
JJAutoCompare commented 2026-11-26 22:49:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-26T22:49:14Z.


Tested

Independent run at clean PR head 8c11748063c9f75f483356745bb128ada7f123d6 on Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 x64 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug test profile.

Prebuilt with cargo test --locked -p xcl --lib --no-run --message-format=json outside the GPU mutex. Ran <test-exe> gpu::recomp::tests::gpu_cube_coords_sample_roundtrip --exact --nocapture --test-threads=1 under the Arc mutex with XCL_ADAPTER=A770.

1 passed, 0 failed, 0 ignored and 0 GPU skips (0.57 s). The stock D3D12 readback matched the expected face and texel on all 64 lanes, covering all 24 face/texel combinations.

Not tested

Standalone face-op and cube array fixtures, physical wave width, the workspace suite and retail smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the original verification and summarized the saved results.

<!-- greyfinch-sync:ivall/xcl:comment:7205012639 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1101#issuecomment-7205012639). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-26T22:49:14Z. --- **Tested** Independent run at clean PR head `8c11748063c9f75f483356745bb128ada7f123d6` on Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 x64 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug test profile. Prebuilt with `cargo test --locked -p xcl --lib --no-run --message-format=json` outside the GPU mutex. Ran `<test-exe> gpu::recomp::tests::gpu_cube_coords_sample_roundtrip --exact --nocapture --test-threads=1` under the Arc mutex with `XCL_ADAPTER=A770`. 1 passed, 0 failed, 0 ignored and 0 GPU skips (0.57 s). The stock D3D12 readback matched the expected face and texel on all 64 lanes, covering all 24 face/texel combinations. **Not tested** Standalone face-op and cube array fixtures, physical wave width, the workspace suite and retail smoke. **AI use** T3 Code / Codex (gpt-6.2-sol) ran the original verification and summarized the saved results.
Foniass commented 2026-12-01 04:49:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:49:01Z.


Triage (#1607) – head 8c11748

Partial overlap: #1639 (later, a bundle of tests) also checks V_CUBEID/SC/TC/MA_F32 on six faces. This PR goes further: tie-breaking, signed zeros, the NEG/ABS/OMOD/CLAMP modifiers and a cube-sample roundtrip. On main the cube ops are only covered by the single CUBEID check in the DPP/SDWA test. #2348 changes cube_sc/cube_tc to negate by the sign bit, and these assertions are bit-exact, so they agree with it.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301130299 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1101#issuecomment-7301130299). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:49:01Z. --- **Triage (#1607)** – head 8c11748 Partial overlap: #1639 (later, a bundle of tests) also checks V_CUBEID/SC/TC/MA_F32 on six faces. This PR goes further: tie-breaking, signed zeros, the NEG/ABS/OMOD/CLAMP modifiers and a cube-sample roundtrip. On main the cube ops are only covered by the single CUBEID check in the DPP/SDWA test. #2348 changes cube_sc/cube_tc to negate by the sign bit, and these assertions are bit-exact, so they agree with it. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1101:upstream-pr/1101'
git switch 'upstream-pr/1101'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1101'
git switch 'upstream-pr/1101'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1101'
git switch 'upstream-pr/1101'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1101'
git switch 'main'
git merge --squash 'upstream-pr/1101'
git switch 'main'
git merge --ff-only 'upstream-pr/1101'
git switch 'main'
git merge 'upstream-pr/1101'
git push origin 'main'
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!1092
No description provided.