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

Open
opened 2026-11-24 07:27:49 +00:00 by nova-aryan · 0 comments
nova-aryan commented 2026-11-24 07:27:49 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by nova-aryan on 2026-11-24T07:27:49Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:6576843591 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/885). Originally posted by [nova-aryan](https://github.com/nova-aryan) on 2026-11-24T07:27:49Z. --- 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.
Sign in to join this conversation.
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#879
No description provided.