Shaders: s_atc_probe's immediate is not a register #1021

Merged
CaravelaLabs merged 1 commit from upstream-pr/1021 into main 2026-11-25 00:21:06 +00:00
CaravelaLabs commented 2026-11-24 15:08:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by CaravelaLabs on 2026-11-24T15:08:04Z.


s_atc_probe and s_atc_probe_buffer were decoded as ordinary scalar loads, so the 7-bit immediate became a register and the buffer resource was 2 dwords instead of 4.

On main ffe310e, llvm-mc -arch=amdgcn -mcpu=gfx1030 reads 0xF4981FF4 0x0A000001 as s_atc_probe 0x7f, s[104:105], s5 offset:0x1. The printer produced s_atc_probe exec_hi, s[104:105], s5 offset:0x000001. s_atc_probe_buffer 7, s[8:11], 0x20 was printed with s[8:9].

LLVM's probe form takes an immediate in that field, a 2-dword address or a 4-dword buffer resource, and no GLC/DLC operand (those bits are ignored). Translation still rejects these two opcodes, so this is the disassembly and the decoded fields, not a miscompiled shader. Ordinary s_load / s_buffer_load text is unchanged.

The new test fails on main (s7 where the immediate is 7) and passes with this change. Shader library tests: 97 passed, 0 failed, 1 ignored. Windows clippy -D warnings on the workspace, with and without --all-features, is clean.

AI-assisted; tests run on this machine.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584893659 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1021). Originally posted by [CaravelaLabs](https://github.com/CaravelaLabs) on 2026-11-24T15:08:04Z. --- `s_atc_probe` and `s_atc_probe_buffer` were decoded as ordinary scalar loads, so the 7-bit immediate became a register and the buffer resource was 2 dwords instead of 4. On main `ffe310e`, `llvm-mc -arch=amdgcn -mcpu=gfx1030` reads `0xF4981FF4 0x0A000001` as `s_atc_probe 0x7f, s[104:105], s5 offset:0x1`. The printer produced `s_atc_probe exec_hi, s[104:105], s5 offset:0x000001`. `s_atc_probe_buffer 7, s[8:11], 0x20` was printed with `s[8:9]`. LLVM's probe form takes an immediate in that field, a 2-dword address or a 4-dword buffer resource, and no GLC/DLC operand (those bits are ignored). Translation still rejects these two opcodes, so this is the disassembly and the decoded fields, not a miscompiled shader. Ordinary `s_load` / `s_buffer_load` text is unchanged. The new test fails on main (`s7` where the immediate is `7`) and passes with this change. Shader library tests: 97 passed, 0 failed, 1 ignored. Windows clippy `-D warnings` on the workspace, with and without `--all-features`, is clean. AI-assisted; tests run on this machine.
Zipettte commented 2026-11-24 16:05:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:40:18Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 3d71ad1: cargo test -p victory-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136417109 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1021#issuecomment-7136417109). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:40:18Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 3d71ad1: `cargo test -p victory-shader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
catminou4 commented 2026-11-24 17:03:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T16:29:01Z.

Review: APPROVED


s_atc_probe/s_atc_probe_buffer decoding fix: SDATA is a 7-bit immediate (not an SGPR), buffer form resource is 4 dwords, GLC/DLC are not operands. Cases verified against llvm-mc disassembly per the comment; sp3 printer renders the immediate. Decode + print tests run on macOS. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p <crate> --locked. Shader execution tests (valu_tests/host) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. victory-shader: 97 passed, 0 failed.

<!-- greyfinch-sync:Marvisak/VIctory:review:6043263357 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1021#pullrequestreview-6043263357). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T16:29:01Z. **Review:** APPROVED --- s_atc_probe/s_atc_probe_buffer decoding fix: SDATA is a 7-bit immediate (not an SGPR), buffer form resource is 4 dwords, GLC/DLC are not operands. Cases verified against llvm-mc disassembly per the comment; sp3 printer renders the immediate. Decode + print tests run on macOS. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, `cargo test -p <crate> --locked`. Shader execution tests (valu_tests/host) are `#[cfg(all(test, windows))]`, so macOS covers lowering/decode/unit tests only. victory-shader: 97 passed, 0 failed.
upstream-sync closed this pull request 2026-11-25 01:05:18 +00:00
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
Marvisak/VIctory!1021
No description provided.