Shaders: s_atc_probe's immediate is not a register (port of VIctory#1021) #186

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

@⁠lcg007xd-c on GitHub · 2026-11-25 20:25 UTC · original
lcg007xd-c:port/vic-1021 → main · +100 −9 · 2 files · 1 commits · open

Port of Marvisak/VIctory#1021 by CaravelaLabs. It is cherry-picked with -x, so the commit keeps its author and its upstream hash. This fork's main (000ffdd) does not have it, and it is not in #142.

What it fixes

The decoder read the 7-bit immediate (SDATA) of s_atc_probe/s_atc_probe_buffer as an SGPR, gave the buffer form a 2-dword resource instead of 4, and treated GLC/DLC as operands, so the instruction showed a fake SGPR write to the dependency analysis.

Tested (Linux, Rust 1.98.1)

  • gfx10::sp3::tests::atc_probe_immediate_is_not_a_register (5 encodings; fails on main, where SDATA decodes as a register).
  • cargo test -p victory-shader --lib on this branch alone: no failures.
  • It applies to main without conflicts, and does not depend on the other open ports.

Not run here: Windows/GPU tests, since I have no Windows machine.

🤖 Generated with Claude Code

**@⁠lcg007xd-c** on GitHub · 2026-11-25 20:25 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/186) `lcg007xd-c:port/vic-1021` → `main` · +100 −9 · 2 files · 1 commits · open Port of [Marvisak/VIctory#1021](https://github.com/Marvisak/VIctory/pull/1021) by CaravelaLabs. It is cherry-picked with `-x`, so the commit keeps its author and its upstream hash. This fork's `main` (000ffdd) does not have it, and it is not in #142. ## What it fixes The decoder read the 7-bit immediate (SDATA) of `s_atc_probe`/`s_atc_probe_buffer` as an SGPR, gave the buffer form a 2-dword resource instead of 4, and treated GLC/DLC as operands, so the instruction showed a fake SGPR write to the dependency analysis. ## Tested (Linux, Rust 1.98.1) - `gfx10::sp3::tests::atc_probe_immediate_is_not_a_register` (5 encodings; fails on main, where SDATA decodes as a register). - `cargo test -p victory-shader --lib` on this branch alone: no failures. - It applies to `main` without conflicts, and does not depend on the other open ports. **Not run here:** Windows/GPU tests, since I have no Windows machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SDATA on s_atc_probe and s_atc_probe_buffer is a 7-bit immediate, the buffer resource is four dwords, and GLC/DLC are not operands of either.

(cherry picked from commit 3d71ad1a6547836ac1dbd19bfab2d759c965d307)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:31 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 05:00 UTC · original

RDNA2 data point. This PR (d4abf48) merged on main 4f62c2a, cargo test --release -p victory-shader --lib on an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1):

  • main: 275 passed, 2 failed.
  • This PR: 276 passed, 2 failed, in 2 runs out of 2. The new test passes.

The 2 failures are the same as on main: the RDNA2 wave-size tests scalar_counted_in_a_divergent_loop_read_after_it and scalar_counted_in_nested_divergent_loops, fixed by #110 and #204. No regression here. Not run in the game.

harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 05:00 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/186#issuecomment-7183093146) RDNA2 data point. This PR (`d4abf48`) merged on `main` `4f62c2a`, `cargo test --release -p victory-shader --lib` on an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1): - `main`: 275 passed, 2 failed. - This PR: 276 passed, 2 failed, in 2 runs out of 2. The new test passes. The 2 failures are the same as on `main`: the RDNA2 wave-size tests `scalar_counted_in_a_divergent_loop_read_after_it` and `scalar_counted_in_nested_divergent_loops`, fixed by #110 and #204. No regression here. Not run in the game. harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300 AI-assisted (Claude Code); no game data.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:42 UTC · original

Tested on Windows 11, RX 7900 XT (RDNA3), Rust 1.98.1. Head d4abf48 (based on 000ffdd), and the same diff applied to current main 4f62c2a, where it applies cleanly.

  • cargo test -p victory-shader --lib -- --test-threads=1 on 4f62c2a + this PR: 278 passed, 0 failed, 6 ignored (4f62c2a alone: 277 / 0 / 6).
  • With only the new test applied to 4f62c2a, atc_probe_immediate_is_not_a_register fails on its first case: the disassembly shows SDATA as the register s7, not the immediate 7.
  • The game's full shaders.rpf, translate --validate --host-lanes 32-64: per-program DXIL hashes are identical to the matching base, both for d4abf48 vs 000ffdd and for 4f62c2a + PR vs 4f62c2a (0 of 25623 changed). Program counts, IR instruction total, validation counts and refusals are unchanged.
  • The game's shaders contain no s_atc_probe or s_atc_probe_buffer at all (0 in the shader-info --disasm listing).
  • Both opcodes are also listed in emit/opcode_refusals.txt, and the SMEM def/use in ir.rs returns unsupported for them. So this fix changes only the disassembly text and the decoded fields, not translated output.

Not tested: GPU tests (nothing here reaches the GPU).

**@⁠adrianmjim** on GitHub · 2026-11-26 19:42 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/186#issuecomment-7201884804) Tested on Windows 11, RX 7900 XT (RDNA3), Rust 1.98.1. Head d4abf48 (based on 000ffdd), and the same diff applied to current main 4f62c2a, where it applies cleanly. - `cargo test -p victory-shader --lib -- --test-threads=1` on 4f62c2a + this PR: 278 passed, 0 failed, 6 ignored (4f62c2a alone: 277 / 0 / 6). - With only the new test applied to 4f62c2a, `atc_probe_immediate_is_not_a_register` fails on its first case: the disassembly shows SDATA as the register `s7`, not the immediate `7`. - The game's full `shaders.rpf`, `translate --validate --host-lanes 32-64`: per-program DXIL hashes are identical to the matching base, both for d4abf48 vs 000ffdd and for 4f62c2a + PR vs 4f62c2a (0 of 25623 changed). Program counts, IR instruction total, validation counts and refusals are unchanged. - The game's shaders contain no `s_atc_probe` or `s_atc_probe_buffer` at all (0 in the `shader-info --disasm` listing). - Both opcodes are also listed in `emit/opcode_refusals.txt`, and the SMEM def/use in `ir.rs` returns unsupported for them. So this fix changes only the disassembly text and the decoded fields, not translated output. Not tested: GPU tests (nothing here reaches the GPU).
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/186/head:github-bot/gh-186'
git switch 'github-bot/gh-186'

Merge

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