Recompiler: VGPR tracking misses non-sequential MIMG address registers #885

Open
opened 2026-11-26 04:35:38 +00:00 by github-bot · 0 comments
Owner

@⁠nova-aryan on GitHub · 2026-11-24 07:27 UTC · original

On main 1ec4c98, rdna2::vgpr_uses treats an MIMG VADDR operand as a consecutive register range even when NSA is nonzero. The emitter's mimg path instead uses MIMG_NSA1/2/3 and reads VADDRA, VADDRB, etc. from the extension words.

A synthetic IMAGE_SAMPLE with VADDR=v4 and extension address v100 is therefore reported as reading v4/v5/v6, omitting v100. translate uses vgpr_uses to compute max_vgpr, which bounds the switches generated for relative VGPR moves and swaps.

Plan: use the existing NSA encoding fields to conservatively include every encoded address register. Keep sequential behavior for NSA=0 and leave data-register tracking unchanged. Include regressions for all three extension lengths and a sequential control. Encoded padding slots will conservatively count as reads; deriving an exact address count from every image opcode/DIM/A16 combination is outside this fix.

A standalone harness importing the real decoder/spec modules under WSL Rust 1.100.0 reproduces one failed NSA test and one passing sequential control. Windows workspace, GPU and retail smoke validation are pending.

AI use: Codex with GPT-6.1-sol investigated the issue and wrote the proposed tests and fix.

**@⁠nova-aryan** on GitHub · 2026-11-24 07:27 UTC · [original](https://github.com/xcl-dev/xcl/issues/885) On main 1ec4c98, rdna2::vgpr_uses treats an MIMG VADDR operand as a consecutive register range even when NSA is nonzero. The emitter's mimg path instead uses MIMG_NSA1/2/3 and reads VADDRA, VADDRB, etc. from the extension words. A synthetic IMAGE_SAMPLE with VADDR=v4 and extension address v100 is therefore reported as reading v4/v5/v6, omitting v100. translate uses vgpr_uses to compute max_vgpr, which bounds the switches generated for relative VGPR moves and swaps. Plan: use the existing NSA encoding fields to conservatively include every encoded address register. Keep sequential behavior for NSA=0 and leave data-register tracking unchanged. Include regressions for all three extension lengths and a sequential control. Encoded padding slots will conservatively count as reads; deriving an exact address count from every image opcode/DIM/A16 combination is outside this fix. A standalone harness importing the real decoder/spec modules under WSL Rust 1.100.0 reproduces one failed NSA test and one passing sequential control. Windows workspace, GPU and retail smoke validation are pending. AI use: Codex with GPT-6.1-sol investigated the issue and wrote the proposed tests and fix.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:35:38 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.