Recompiler: track four image resource SGPRs with R128 set #2000

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

@⁠MiguelMachado-dev on GitHub · 2026-11-25 00:35 UTC · original
MiguelMachado-dev:sgpr-fix → main · +64 −3 · 4 files · 1 commits · open

Part of #1269. With R128=1, MIMG.SRSRC names four SGPRs. Counting eight made the per-lane backend refuse IMAGE_LOAD when the next SGPR held a lane mask.

What is in it

  • Share the descriptor width rule between rdna2::sgpr_uses and x64_masks::uses. With R128=0, use the table width, including the four-SGPR BVH entries.
  • Check both trackers and exercise the IMAGE_LOAD wave32 case through lower_dxil::compute_code. The shader is accepted with R128=1. With R128=0, s8 is part of the descriptor and the mask read is refused.

Tested

  • Commit 263a5e0, Windows 11 build 26300.9974, i7-14700KF, RTX 5080 (driver 621.24), Rust 1.97.1 and DXC 1.8.2502.11. Cargo tests ran in debug.
  • cargo test -p xcl --lib mimg_r128 -- --test-threads=4 reported 2 passed, 0 failed, 0 ignored and 0 SKIPPED. Both regressions failed before the fix.
  • cargo build --workspace passed. cargo test --workspace --no-fail-fast -- --test-threads=4 reported 993 passed, 4 failed and 45 ignored. The four fuzz_validate_and_gpu_* tests also failed on clean main at 8c4a46a with 0x8007000E in CreateComputePipelineState at the same seeds (70, 545, 1019 and 1507).
  • 24 SKIPPED reports. 19 had no wave64, 3 were f16 lowering refusals, 1 could not disable the driver cache, and 1 had no heap windows.

Regression run

scripts/smoke.ps1 ran release builds on the same title for 60 seconds with the default backend.

xcl-smoke v1
commit: 8c4a46a3c2d50498691cbda79cbbf4fadb45fbe8
gpu: NVIDIA GeForce RTX 5080
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 610 (PresentX 610)
presents per 2 s (last 3): 23 23 23
device removals: 0
crashes: 0
peak commit: 15454 MB
xcl-smoke v1
commit: 263a5e011d80270ebc8a3617badedc09d0a1e2bd
gpu: NVIDIA GeForce RTX 5080
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 765 (PresentX 765)
presents per 2 s (last 3): 36 37 33
device removals: 0
crashes: 0
peak commit: 15270 MB

Not tested

  • The per-lane backend on a retail shader pack, shader compile time, native wave64 and the optional XCL_SAMPLE_* fixtures.

AI use

  • Codex (GPT-6.2 Sol xhigh fast) wrote the fix and regression tests, ran the checks and drafted this report.
**@⁠MiguelMachado-dev** on GitHub · 2026-11-25 00:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2000) `MiguelMachado-dev:sgpr-fix` → `main` · +64 −3 · 4 files · 1 commits · open Part of #1269. With `R128=1`, `MIMG.SRSRC` names four SGPRs. Counting eight made the per-lane backend refuse `IMAGE_LOAD` when the next SGPR held a lane mask. **What is in it** - Share the descriptor width rule between `rdna2::sgpr_uses` and `x64_masks::uses`. With `R128=0`, use the table width, including the four-SGPR BVH entries. - Check both trackers and exercise the `IMAGE_LOAD` wave32 case through `lower_dxil::compute_code`. The shader is accepted with `R128=1`. With `R128=0`, `s8` is part of the descriptor and the mask read is refused. **Tested** - Commit `263a5e0`, Windows 11 build 26300.9974, i7-14700KF, RTX 5080 (driver 621.24), Rust 1.97.1 and DXC 1.8.2502.11. Cargo tests ran in debug. - `cargo test -p xcl --lib mimg_r128 -- --test-threads=4` reported 2 passed, 0 failed, 0 ignored and 0 `SKIPPED`. Both regressions failed before the fix. - `cargo build --workspace` passed. `cargo test --workspace --no-fail-fast -- --test-threads=4` reported 993 passed, 4 failed and 45 ignored. The four `fuzz_validate_and_gpu_*` tests also failed on clean `main` at `8c4a46a` with `0x8007000E` in `CreateComputePipelineState` at the same seeds (70, 545, 1019 and 1507). - 24 `SKIPPED` reports. 19 had no wave64, 3 were f16 lowering refusals, 1 could not disable the driver cache, and 1 had no heap windows. **Regression run** `scripts/smoke.ps1` ran release builds on the same title for 60 seconds with the default backend. ``` xcl-smoke v1 commit: 8c4a46a3c2d50498691cbda79cbbf4fadb45fbe8 gpu: NVIDIA GeForce RTX 5080 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 610 (PresentX 610) presents per 2 s (last 3): 23 23 23 device removals: 0 crashes: 0 peak commit: 15454 MB ``` ``` xcl-smoke v1 commit: 263a5e011d80270ebc8a3617badedc09d0a1e2bd gpu: NVIDIA GeForce RTX 5080 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 765 (PresentX 765) presents per 2 s (last 3): 36 37 33 device removals: 0 crashes: 0 peak commit: 15270 MB ``` **Not tested** - The per-lane backend on a retail shader pack, shader compile time, native wave64 and the optional `XCL_SAMPLE_*` fixtures. **AI use** - Codex (GPT-6.2 Sol xhigh fast) wrote the fix and regression tests, ran the checks and drafted this report.
MIMG.SRSRC uses four SGPRs with R128 set. Share that width rule
between both trackers so an unrelated lane mask in the next SGPR
does not make the per-lane bridge refuse IMAGE_LOAD. Keep table
widths when R128 is clear, including the four-register BVH entries.

The wave32 regression checks both register ranges and confirms
that only the eight-register descriptor reads the mask in s8.

Part of #1269.

Assisted-by: Codex (GPT-6, exact variant not provided)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:01 +00:00
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:34 UTC · original

Diff audit passed (rdna2::sgpr_operand_dwords checking MIMG R128 == 1 -> 4 SGPRs shared across rdna2::sgpr_uses and x64_masks::uses, plus mimg_r128_leaves_the_mask_outside_the_descriptor). Build and test (Windows, no GPU) and PR description are both green on 263a5e0, and RTX 5080 passed.

Remaining before merge: one independent AMD GPU verification pass on 263a5e0.

**@⁠raylitebull** on GitHub · 2026-11-25 01:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/2000#issuecomment-7149708446) Diff audit passed (`rdna2::sgpr_operand_dwords` checking `MIMG` `R128 == 1` -> 4 SGPRs shared across `rdna2::sgpr_uses` and `x64_masks::uses`, plus `mimg_r128_leaves_the_mask_outside_the_descriptor`). `Build and test (Windows, no GPU)` and `PR description` are both green on `263a5e0`, and RTX 5080 passed. **Remaining before merge:** one independent **AMD** GPU verification pass on `263a5e0`.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 03:21 UTC · original

Tested

PR #2000 at 263a5e011d80270ebc8a3617badedc09d0a1e2bd, in a clean detached checkout. STOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on a Ryzen 7 3800X, with an Intel Arc A770 (driver 32.0.101.9175) installed. The CPU-only run used Rust and Cargo 1.100.0 (x86_64-pc-windows-msvc), the unoptimized test profile, and DXC/DXIL 1.9.2609.5 for DXIL validation.

cargo test -p xcl --locked --lib mimg_r128 -- --nocapture --test-threads=1 selected exactly two tests. Both passed, with 0 failed, 0 ignored, 0 explicit skips, and 971 filtered out. The harness reported 0.02 seconds.

  • gpu::recomp::x64_masks::tests::mimg_r128_descriptor_reads checked both SGPR trackers. For IMAGE_LOAD, they tracked reads of s4–s7 with R128=1 and s4–s11 with R128=0. Both BVH opcodes retained four SGPR reads with R128=0. All four cases had zero SGPR writes.
  • gpu::recomp::lower_dxil::tests::mimg_r128_leaves_the_mask_outside_the_descriptor checked per-lane wave32 IMAGE_LOAD translation through compute_code. With R128=1, the fixture kept the lane mask in s8 outside the descriptor and produced DXIL that passed validation. With R128=0, it returned the expected refusal for reading that mask as a number.

Not tested

GPU execution on any adapter, fuzzing, retail titles, and the full workspace suite.

AI use

T3 Code / Codex gpt-6.2-sol verified the checkout, ran the two checked-in fixtures, and wrote this report.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 03:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2000#issuecomment-7151835015) **Tested** [PR #2000](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2000) at `263a5e011d80270ebc8a3617badedc09d0a1e2bd`, in a clean detached checkout. STOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on a Ryzen 7 3800X, with an Intel Arc A770 (driver 32.0.101.9175) installed. The CPU-only run used Rust and Cargo 1.100.0 (x86_64-pc-windows-msvc), the unoptimized test profile, and DXC/DXIL 1.9.2609.5 for DXIL validation. `cargo test -p xcl --locked --lib mimg_r128 -- --nocapture --test-threads=1` selected exactly two tests. Both passed, with 0 failed, 0 ignored, 0 explicit skips, and 971 filtered out. The harness reported 0.02 seconds. - `gpu::recomp::x64_masks::tests::mimg_r128_descriptor_reads` checked both SGPR trackers. For `IMAGE_LOAD`, they tracked reads of `s4–s7` with `R128=1` and `s4–s11` with `R128=0`. Both BVH opcodes retained four SGPR reads with `R128=0`. All four cases had zero SGPR writes. - `gpu::recomp::lower_dxil::tests::mimg_r128_leaves_the_mask_outside_the_descriptor` checked per-lane wave32 `IMAGE_LOAD` translation through `compute_code`. With `R128=1`, the fixture kept the lane mask in `s8` outside the descriptor and produced DXIL that passed validation. With `R128=0`, it returned the expected refusal for reading that mask as a number. **Not tested** GPU execution on any adapter, fuzzing, retail titles, and the full workspace suite. **AI use** T3 Code / Codex gpt-6.2-sol verified the checkout, ran the two checked-in fixtures, and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:43 UTC · original

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

  • cargo test -p xcl --lib: 3 real failures, deterministic (also fail --test-threads=1, 1038/3):
gpu::recomp::lower_dxil::tests::mimg_r128_leaves_the_mask_outside_the_descriptor
  -> Err("unsupported IMAGE_LOAD (s8: a mask read as a number)")
gpu::recomp::x64_masks::tests::mimg_r128_descriptor_reads
  assertion failed: IMAGE_LOAD R128=1 — left [4,5,6,7,8,9,10,11], right [4,5,6,7]
gpu::recomp::x64_masks::tests::use_plan_matches_fallback_across_all_rdna2_instructions
  assertion failed: IMAGE_LOAD (ENC_MIMG, Plain) — left (1044480, 0), right (61440, 0)

Looks like the R128/mask handling for IMAGE_LOAD regressed (the mask is being folded into the descriptor operand instead of staying outside it). Needs a fix before merge.

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-25 03:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/2000#issuecomment-7152185402) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: **3 real failures**, deterministic (also fail `--test-threads=1`, 1038/3): ``` gpu::recomp::lower_dxil::tests::mimg_r128_leaves_the_mask_outside_the_descriptor -> Err("unsupported IMAGE_LOAD (s8: a mask read as a number)") gpu::recomp::x64_masks::tests::mimg_r128_descriptor_reads assertion failed: IMAGE_LOAD R128=1 — left [4,5,6,7,8,9,10,11], right [4,5,6,7] gpu::recomp::x64_masks::tests::use_plan_matches_fallback_across_all_rdna2_instructions assertion failed: IMAGE_LOAD (ENC_MIMG, Plain) — left (1044480, 0), right (61440, 0) ``` Looks like the R128/mask handling for IMAGE_LOAD regressed (the mask is being folded into the descriptor operand instead of staying outside it). Needs a fix before merge. — Devin
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-25 14:02 UTC · original

Independent integration recheck of 263a5e0 on main 06c9f55. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11.

The clean local merge reproduced all three failures from DavidM1911’s run. The two register-use trackers disagreed for IMAGE_LOAD R128=1, and the per-lane translator rejected the read of s8.

For a local control, I made the precomputed operand plan use the same R128 descriptor-width rule as the fallback tracker. With that change, the same three tests passed, including the stock comparison across all RDNA2 instructions. The offline workspace build passed, and the patched workspace suite finished with 1,267 passed, 0 failed, 46 ignored, including 26 runtime skips in the pass count.

Focused command: cargo test --offline --locked -p xcl --lib -j 6 -- --test-threads=1 --nocapture mimg_r128 use_plan_matches_fallback_across_all_rdna2_instructions. Workspace command: cargo test --offline --locked --workspace --no-fail-fast -j 6 -- --test-threads=4 --nocapture.

Synthetic tests only. The patched result is local. AMD GPU verification remains open.

AI-assisted. Codex (GPT-6, exact variant unavailable) ran the reproduction, wrote the local control, and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-25 14:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2000#issuecomment-7164658292) Independent integration recheck of [263a5e0](https://github.com/xcl-dev/xcl/commit/263a5e011d80270ebc8a3617badedc09d0a1e2bd) on [main 06c9f55](https://github.com/xcl-dev/xcl/commit/06c9f5505f63f10c5ec49ef932d75b2c28177324). Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11. The clean local merge reproduced all three failures from [DavidM1911’s run](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2000). The two register-use trackers disagreed for `IMAGE_LOAD R128=1`, and the per-lane translator rejected the read of `s8`. For a local control, I made the precomputed operand plan use the same R128 descriptor-width rule as the fallback tracker. With that change, the same three tests passed, including the stock comparison across all RDNA2 instructions. The offline workspace build passed, and the patched workspace suite finished with **1,267 passed, 0 failed, 46 ignored**, including 26 runtime skips in the pass count. Focused command: `cargo test --offline --locked -p xcl --lib -j 6 -- --test-threads=1 --nocapture mimg_r128 use_plan_matches_fallback_across_all_rdna2_instructions`. Workspace command: `cargo test --offline --locked --workspace --no-fail-fast -j 6 -- --test-threads=4 --nocapture`. Synthetic tests only. The patched result is local. AMD GPU verification remains open. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the reproduction, wrote the local control, and drafted this report.
Author
Owner

@⁠ClosetPie107 on GitHub · 2026-11-26 06:49 UTC · original

Tested head 263a5e01 merged onto current main (b49be183) on AMD RDNA4 / Linux (Proton Experimental): 3 unit tests fail after merging with main.

Hardware & environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS Linux
  • Proton Experimental (experimental-11.0-20261112), DXC 1.9.2609.5, Rust x86_64-pc-windows-gnu (debug)

Targeted unit tests (main b49be183 + #2000 263a5e01, --test-threads=1):

  • xcl.exe gpu::rdna2:: -- --test-threads=1: 18 passed, 0 failed, 0 ignored (0 skipped).
  • xcl.exe gpu::recomp::x64_masks:: -- --test-threads=1: 18 passed, 2 failed, 1 ignored (mimg_r128_descriptor_reads and use_plan_matches_fallback_across_all_rdna2_instructions).
  • xcl.exe r128 -- --test-threads=1: 0 passed, 2 failed, 0 ignored:
    • gpu::recomp::x64_masks::tests::mimg_r128_descriptor_reads (x64_masks.rs:794): assertion left == right failed: IMAGE_LOAD R128=1: left: [4, 5, 6, 7, 8, 9, 10, 11], right: [4, 5, 6, 7]
    • gpu::recomp::lower_dxil::tests::mimg_r128_leaves_the_mask_outside_the_descriptor (lower_dxil.rs:482): called Result::unwrap() on an Err value: "unsupported IMAGE_LOAD (s8: a mask read as a number)"

Looks like #2000 needs a rebase onto current main (it auto-merged without git conflicts, but the R128 descriptor width isn't taking effect against main's current rdna2.rs / x64_masks.rs).

Not tested

  • Native Windows, 263a5e01 on its original base without merging main, or retail title run (excluded due to the unit test failures).

AI use

  • T3 Code / Antigravity (Gemini 4 Neon) merged #2000 onto main, ran the Proton unit tests on this machine, and drafted this report.
**@⁠ClosetPie107** on GitHub · 2026-11-26 06:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2000#issuecomment-7184815745) Tested head `263a5e01` merged onto current `main` (`b49be183`) on AMD RDNA4 / Linux (Proton Experimental): **3 unit tests fail after merging with `main`**. **Hardware & environment** - AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS Linux - Proton Experimental (`experimental-11.0-20261112`), DXC `1.9.2609.5`, Rust `x86_64-pc-windows-gnu` (debug) **Targeted unit tests** (`main` `b49be183` + #2000 `263a5e01`, `--test-threads=1`): - `xcl.exe gpu::rdna2:: -- --test-threads=1`: **18 passed, 0 failed, 0 ignored** (0 skipped). - `xcl.exe gpu::recomp::x64_masks:: -- --test-threads=1`: **18 passed, 2 failed, 1 ignored** (`mimg_r128_descriptor_reads` and `use_plan_matches_fallback_across_all_rdna2_instructions`). - `xcl.exe r128 -- --test-threads=1`: **0 passed, 2 failed, 0 ignored**: - `gpu::recomp::x64_masks::tests::mimg_r128_descriptor_reads` (`x64_masks.rs:794`): `assertion left == right failed: IMAGE_LOAD R128=1: left: [4, 5, 6, 7, 8, 9, 10, 11], right: [4, 5, 6, 7]` - `gpu::recomp::lower_dxil::tests::mimg_r128_leaves_the_mask_outside_the_descriptor` (`lower_dxil.rs:482`): `called Result::unwrap() on an Err value: "unsupported IMAGE_LOAD (s8: a mask read as a number)"` Looks like #2000 needs a rebase onto current `main` (it auto-merged without git conflicts, but the `R128` descriptor width isn't taking effect against `main`'s current `rdna2.rs` / `x64_masks.rs`). **Not tested** - Native Windows, `263a5e01` on its original base without merging `main`, or retail title run (excluded due to the unit test failures). **AI use** - T3 Code / Antigravity (Gemini 4 Neon) merged #2000 onto `main`, ran the Proton unit tests on this machine, and drafted this report.
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/2000/head:github-bot/gh-2000'
git switch 'github-bot/gh-2000'

Merge

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