Recompiler: image_get_resinfo on a 1D array gives the layers in y #1256

Merged
emirduran707 merged 1 commit from upstream-pr/1266 into main 2026-11-25 01:05:06 +00:00
emirduran707 commented 2026-11-24 13:59:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T13:59:19Z.


image_get_resinfo on a 1D array (DIM 4) returned (width, 1, layers, mips): the layer count went to z and y was 1. On RDNA the layer count of a 1D array is in y. Mesa's AMD driver code shows it: visit_image_size in ac_nir_to_llvm.c moves z into y only for GFX9 (chip_class == GFX9 && dim == 1D && is_array). GFX9 is the one chip that maps 1D arrays to ac_image_2darray (ac_get_sampler_dim in ac_shader_util.c). From GFX10 on, the dim is ac_image_1darray and the hardware's x and y are used as they are. Read in Mesa 21.3.9. So a shader reading the element count of a Texture1DArray got 1.

The layer count now goes to y. z keeps the value it had (the layer count), since no source says what z holds for a 1D array, so only y changes.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: the DIM 4 arm of image_get_resinfo.
  • crates/xcl/src/gpu/recomp/tests.rs:
    • image_get_resinfo_1d_array_layers_in_y, which needs no GPU and checks that the element count is written into y;
    • gpu_image_get_resinfo_1d_array, with a 4-wide, 3-layer 1D array: x 4, y 3, mips 1.
  • crates/xcl/src/gpu/recomp/runner.rs: TexDim::D1Array for that GPU test (a TEXTURE1D resource with TEXTURE1DARRAY views).

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on cafda82: 743 passed, 0 failed, 41 ignored; no SKIPPED GPU tests (the new GPU test ran and passed on this adapter)
  • the translation test without the change fails (GetDimensions(v3, t1_w, t1_d, t1_n) must write the elements into _h); with it it passes
  • the GPU test was run only with the change

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19650 MB

this PR:

xcl-smoke v1
commit: cafda82ea1029f4f5aade5de7ca0a9da2a95a340
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1481 (PresentX 1482)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19735 MB

Not tested

  • What z holds for a 1D array on the console.
  • NVIDIA and Intel GPUs, and wave32-only adapters.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the tests and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6583466100 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1266). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T13:59:19Z. --- `image_get_resinfo` on a 1D array (DIM 4) returned (width, 1, layers, mips): the layer count went to z and y was 1. On RDNA the layer count of a 1D array is in y. Mesa's AMD driver code shows it: `visit_image_size` in `ac_nir_to_llvm.c` moves z into y only for GFX9 (`chip_class == GFX9 && dim == 1D && is_array`). GFX9 is the one chip that maps 1D arrays to `ac_image_2darray` (`ac_get_sampler_dim` in `ac_shader_util.c`). From GFX10 on, the dim is `ac_image_1darray` and the hardware's x and y are used as they are. Read in Mesa 21.3.9. So a shader reading the element count of a `Texture1DArray` got 1. The layer count now goes to y. z keeps the value it had (the layer count), since no source says what z holds for a 1D array, so only y changes. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: the DIM 4 arm of `image_get_resinfo`. - `crates/xcl/src/gpu/recomp/tests.rs`: - `image_get_resinfo_1d_array_layers_in_y`, which needs no GPU and checks that the element count is written into y; - `gpu_image_get_resinfo_1d_array`, with a 4-wide, 3-layer 1D array: x 4, y 3, mips 1. - `crates/xcl/src/gpu/recomp/runner.rs`: `TexDim::D1Array` for that GPU test (a TEXTURE1D resource with TEXTURE1DARRAY views). **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on cafda82: 743 passed, 0 failed, 41 ignored; no SKIPPED GPU tests (the new GPU test ran and passed on this adapter) - the translation test without the change fails (`GetDimensions(v3, t1_w, t1_d, t1_n) must write the elements into _h`); with it it passes - the GPU test was run only with the change **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1541 (PresentX 1541) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19650 MB ``` this PR: ``` xcl-smoke v1 commit: cafda82ea1029f4f5aade5de7ca0a9da2a95a340 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1481 (PresentX 1482) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19735 MB ``` **Not tested** - What z holds for a 1D array on the console. - NVIDIA and Intel GPUs, and wave32-only adapters. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the tests and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DavidM1911 commented 2026-11-24 14:06:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:05:30Z.


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

  • cargo test -p xcl lib recomp: 191 passed, 18 ignored, 0 failed.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7133825270 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1266#issuecomment-7133825270). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T14:05:30Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl lib recomp: 191 passed, 18 ignored, 0 failed. Thanks!
thehollowedone commented 2026-11-24 15:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T14:06:51Z.


Independent RTX 3080 Ti check on cafda82, Windows 11 build 26300, driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug.

I ran image_get_resinfo on a synthetic 16-wide, seven-layer 1D array with three partial component masks. On the PR, the layer-only mask (0x2) returned 7, mip-only (0x8) returned 1, and width/layers/mips (0xb) returned packed (16, 7, 1). All 64 lanes matched in each case, including registers seeded to detect unintended writes. Restoring only the parent emitter returned 1 instead of 7 on all 64 lanes for both masks that ask for layers. The mip-only control still passed.

Both stock 1D array tests and the added GPU check passed on the PR with no skips. Synthetic workload only. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7133860131 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1266#issuecomment-7133860131). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-24T14:06:51Z. --- Independent RTX 3080 Ti check on [`cafda82`](https://github.com/ivall/xcl/commit/cafda82ea1029f4f5aade5de7ca0a9da2a95a340), Windows 11 build 26300, driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug. I ran `image_get_resinfo` on a synthetic 16-wide, seven-layer 1D array with three partial component masks. On the PR, the layer-only mask (`0x2`) returned 7, mip-only (`0x8`) returned 1, and width/layers/mips (`0xb`) returned packed `(16, 7, 1)`. All 64 lanes matched in each case, including registers seeded to detect unintended writes. Restoring only the parent emitter returned 1 instead of 7 on all 64 lanes for both masks that ask for layers. The mip-only control still passed. Both stock 1D array tests and the added GPU check passed on the PR with no skips. Synthetic workload only. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixture and drafted this report.
upstream-sync closed this pull request 2026-11-25 01:08:59 +00:00
DavidM1911 commented 2026-11-26 05:05:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:40:53Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7182808367 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1266#issuecomment-7182808367). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T04:40:53Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
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!1256
No description provided.