Tests: check MIMG gather4, image_load_mip, and image_get_lod on the GPU #1552

Open
thiagocalile wants to merge 1 commit from upstream-pr/1562 into main
thiagocalile commented 2026-11-24 17:41:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-24T17:41:28Z.


Add GPU and translation-refusal tests for MIMG image_gather4 variants, image_load_mip, and image_get_lod. None of these had a GPU test; image_gather4_lz was only checked on the red channel.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: mimg_gather_lod_and_mip_refusals checks the translator's refusals for a multi/zero-channel gather4 DMASK, image_get_lod outside PS, image_store_mip, cube image_load_mip, and cube image_gather4_lz_o
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_image_gather4_channels_offsets_and_cmp covers image_gather4_lz on all 4 DMASK channels and with D16, image_gather4 border clamping, image_gather4_lz_o signed 6-bit offsets, image_gather4_c_lz / image_gather4_c_lz_o comparison gathers (on R32_FLOAT; D3D12 has no comparison gather on R32G32B32A32_FLOAT), and EXEC masking, as wave64 and wave32 programs
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_ps_image_load_mip_and_get_lod covers image_load_mip on a 4-mip 2D texture (32-bit and A16 coordinates, mips 0..3, out-of-bounds texels and mip 4 reading 0, DMASK subsets) and image_get_lod in a pixel shader (clamped vs unclamped LOD when magnified and minified, MinLOD/MaxLOD, MipLODBias, DMASK 0x2)

Tested

  • Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, driver 32.0.21045.29003; XCL_ADAPTER=radeon, native wave64 + wave32), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11, debug build
  • XCL_ADAPTER=radeon cargo test -p xcl --lib mimg_gather_lod_and_mip_refusals: 1 passed, 0 failed
  • XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_image_gather4_channels_offsets_and_cmp: 1 passed, 0 failed
  • XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_ps_image_load_mip_and_get_lod: 1 passed, 0 failed
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4 on this branch (rebased on main 9e3831e): 776 passed, 3 failed, 41 ignored. The 3 failures are pre-existing on main on this RX 6600 (placed_title_textures_share_vram_and_preserve_pixels and 2 mutex-poison cascades; #1028 fixes them). 1 GPU test skipped inside the passing count: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)

Not tested

  • NVIDIA / Intel / WARP adapters, D3D12 debug layer, Linux / Wine.

AI use

  • Antigravity with Gemini 4 Neon wrote the tests and ran them on my RX 6600; Antigravity with Claude Opus 5.5 rebased the branch onto current main, re-ran the suite and drafted this description. I reviewed the diff and the test output.
<!-- greyfinch-sync:ivall/xcl:issue:5477300473 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1562). Originally posted by [thiagocalile](https://github.com/thiagocalile) on 2026-11-24T17:41:28Z. --- Add GPU and translation-refusal tests for MIMG `image_gather4` variants, `image_load_mip`, and `image_get_lod`. None of these had a GPU test; `image_gather4_lz` was only checked on the red channel. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `mimg_gather_lod_and_mip_refusals` checks the translator's refusals for a multi/zero-channel `gather4` DMASK, `image_get_lod` outside PS, `image_store_mip`, cube `image_load_mip`, and cube `image_gather4_lz_o` - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_image_gather4_channels_offsets_and_cmp` covers `image_gather4_lz` on all 4 `DMASK` channels and with `D16`, `image_gather4` border clamping, `image_gather4_lz_o` signed 6-bit offsets, `image_gather4_c_lz` / `image_gather4_c_lz_o` comparison gathers (on `R32_FLOAT`; D3D12 has no comparison gather on `R32G32B32A32_FLOAT`), and EXEC masking, as wave64 and wave32 programs - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_ps_image_load_mip_and_get_lod` covers `image_load_mip` on a 4-mip 2D texture (32-bit and `A16` coordinates, mips 0..3, out-of-bounds texels and mip 4 reading 0, `DMASK` subsets) and `image_get_lod` in a pixel shader (clamped vs unclamped LOD when magnified and minified, `MinLOD`/`MaxLOD`, `MipLODBias`, `DMASK` 0x2) **Tested** - Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, driver 32.0.21045.29003; `XCL_ADAPTER=radeon`, native wave64 + wave32), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (26200), Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.8.2502.11, debug build - `XCL_ADAPTER=radeon cargo test -p xcl --lib mimg_gather_lod_and_mip_refusals`: 1 passed, 0 failed - `XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_image_gather4_channels_offsets_and_cmp`: 1 passed, 0 failed - `XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_ps_image_load_mip_and_get_lod`: 1 passed, 0 failed - `XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4` on this branch (rebased on `main` `9e3831e`): 776 passed, 3 failed, 41 ignored. The 3 failures are pre-existing on `main` on this RX 6600 (`placed_title_textures_share_vram_and_preserve_pixels` and 2 mutex-poison cascades; #1028 fixes them). 1 GPU test skipped inside the passing count: `heap_window_out_of_memory_falls_back_to_the_switch_form` (`no heap windows`) **Not tested** - NVIDIA / Intel / WARP adapters, D3D12 debug layer, Linux / Wine. **AI use** - Antigravity with Gemini 4 Neon wrote the tests and ran them on my RX 6600; Antigravity with Claude Opus 5.5 rebased the branch onto current `main`, re-ran the suite and drafted this description. I reviewed the diff and the test output.
coenflict commented 2026-11-24 18:09:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by coenflict on 2026-11-24T17:56:50Z.


Tested

  • Head 6995bcbb82f8ab2dff64ffc82d1e2cb01201bdf0, Windows 11 build 26340, Ryzen 7 9800X3D, RTX 5090 driver 32.0.16.2140, Rust 1.97.1 MSVC, DXC and DXIL 1.9.2602.17, debug build. Set XCL_ADAPTER=nvidia.
  • cargo test -p xcl --lib -- --nocapture mimg_gather_lod_and_mip_refusals gpu_image_gather4_channels_offsets_and_cmp gpu_ps_image_load_mip_and_get_lod reported 3 passed, 0 failed, 0 ignored, 0 skips. Both GPU tests executed.

Not tested

  • Whole workspace at this PR head, retail titles, and the D3D12 debug layer.

AI use

  • Codex (gpt-6.2-sol) ran the tests and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7139933770 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1562#issuecomment-7139933770). Originally posted by [coenflict](https://github.com/coenflict) on 2026-11-24T17:56:50Z. --- **Tested** - Head `6995bcbb82f8ab2dff64ffc82d1e2cb01201bdf0`, Windows 11 build 26340, Ryzen 7 9800X3D, RTX 5090 driver `32.0.16.2140`, Rust 1.97.1 MSVC, DXC and DXIL 1.9.2602.17, debug build. Set `XCL_ADAPTER=nvidia`. - `cargo test -p xcl --lib -- --nocapture mimg_gather_lod_and_mip_refusals gpu_image_gather4_channels_offsets_and_cmp gpu_ps_image_load_mip_and_get_lod` reported 3 passed, 0 failed, 0 ignored, 0 skips. Both GPU tests executed. **Not tested** - Whole workspace at this PR head, retail titles, and the D3D12 debug layer. **AI use** - Codex (`gpt-6.2-sol`) ran the tests and wrote this report.
DavidM1911 commented 2026-11-24 21:08:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:32:34Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7142246674 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1562#issuecomment-7142246674). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T19:32:34Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
JJAutoCompare commented 2026-11-25 08:08:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T07:41:12Z.


Tested

Independent native Windows run at clean detached PR #1562 head 6995bcbb82f8ab2dff64ffc82d1e2cb01201bdf0. STOR-WINLAB, Windows 11 Enterprise Evaluation x64 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5. Unoptimized test profile, incremental compilation and debug info disabled.

cargo test --locked -p xcl --lib --no-run -j 2 --message-format=json exited 0 outside the Arc mutex. Used XCL_ADAPTER=A770, XCL_DIRECT_DXIL=0 and XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64. Under the shared Invoke-ArcTest.ps1 lock:

$exe = 'L:/XclTooling/verify-pr1523-1362129-t3-cf2e05e7/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe'
& $exe --exact gpu::recomp::tests::gpu_image_gather4_channels_offsets_and_cmp --nocapture --test-threads=1
& $exe --exact gpu::recomp::tests::gpu_ps_image_load_mip_and_get_lod --nocapture --test-threads=1

2 passed, 0 failed, 0 ignored, 0 GPU skips. Each exact invocation filtered out 750 other tests and exited 0 (0.54 s and 0.53 s). The mutex wrapper exited 0. The executable digest matched before waiting, after lock acquisition, and after both fixtures.

The HLSL/DXC gather fixture checked wave32 channel selection, D16, signed offsets, comparison gather, and EXEC masking. The pixel fixture checked 2D mip loads (including A16 coordinates and out-of-bounds results) and clamped/unclamped LOD readback. On the A770 the stock gather loop omits native wave64.

Not tested

Native wave64 or split-wave64 gather, standalone translation-refusal fixture, direct DXIL, other GPUs, the full workspace suite, and title smoke runs.

AI use

T3 Code / Codex (gpt-6.2-sol) verified the revision, ran the checked-in tests, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7156138241 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1562#issuecomment-7156138241). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T07:41:12Z. --- **Tested** Independent native Windows run at clean detached PR #1562 head `6995bcbb82f8ab2dff64ffc82d1e2cb01201bdf0`. STOR-WINLAB, Windows 11 Enterprise Evaluation x64 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5. Unoptimized test profile, incremental compilation and debug info disabled. `cargo test --locked -p xcl --lib --no-run -j 2 --message-format=json` exited 0 outside the Arc mutex. Used `XCL_ADAPTER=A770`, `XCL_DIRECT_DXIL=0` and `XCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64`. Under the shared `Invoke-ArcTest.ps1` lock: ```powershell $exe = 'L:/XclTooling/verify-pr1523-1362129-t3-cf2e05e7/target/debug/build/xcl/77aca8ccb20e299f/out/xcl-77aca8ccb20e299f.exe' & $exe --exact gpu::recomp::tests::gpu_image_gather4_channels_offsets_and_cmp --nocapture --test-threads=1 & $exe --exact gpu::recomp::tests::gpu_ps_image_load_mip_and_get_lod --nocapture --test-threads=1 ``` **2 passed, 0 failed, 0 ignored, 0 GPU skips**. Each exact invocation filtered out 750 other tests and exited 0 (0.54 s and 0.53 s). The mutex wrapper exited 0. The executable digest matched before waiting, after lock acquisition, and after both fixtures. The HLSL/DXC gather fixture checked wave32 channel selection, D16, signed offsets, comparison gather, and EXEC masking. The pixel fixture checked 2D mip loads (including A16 coordinates and out-of-bounds results) and clamped/unclamped LOD readback. On the A770 the stock gather loop omits native wave64. **Not tested** Native wave64 or split-wave64 gather, standalone translation-refusal fixture, direct DXIL, other GPUs, the full workspace suite, and title smoke runs. **AI use** T3 Code / Codex (gpt-6.2-sol) verified the revision, ran the checked-in tests, and wrote this report.
github-actions[bot] commented 2026-11-28 20:19:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:19:04Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7245197238 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1562#issuecomment-7245197238). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T20:19:04Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:07:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:07:42Z.


Triage (#1607) – head 6995bcb

No open PR adds the same tests. #1861 tests image_get_lod only through static samplers, #1812 / #3240 change gather4 code, and #1712 covers image_atomic_*.
The refusal strings asserted in mimg_gather_lod_and_mip_refusals all exist in main's emit.rs. The gather footprints (D3D order (x0,y1) (x1,y1) (x1,y0) (x0,y0)), the offset / border clamping and the LESS comparisons are correct for the 4x4 textures used. No problems found in the diff.
The branch conflicts with main (tests.rs tail) and needs a rebase.
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:7302511180 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1562#issuecomment-7302511180). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:07:42Z. --- **Triage (#1607)** – head 6995bcb No open PR adds the same tests. #1861 tests `image_get_lod` only through static samplers, #1812 / #3240 change gather4 code, and #1712 covers `image_atomic_*`. The refusal strings asserted in `mimg_gather_lod_and_mip_refusals` all exist in main's `emit.rs`. The gather footprints (D3D order (x0,y1) (x1,y1) (x1,y0) (x0,y0)), the offset / border clamping and the LESS comparisons are correct for the 4x4 textures used. No problems found in the diff. The branch conflicts with main (tests.rs tail) and needs a rebase. 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/1562:upstream-pr/1562'
git switch 'upstream-pr/1562'

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