feat: s_version, s_atc_probe and s_atc_probe_buffer in the RDNA 2 interpreter and HLSL — 1,211/1,490 #241

Manually merged
github merged 1 commit from gh-pr/241/head into gh-pr/241/base 2026-11-26 05:39:39 +00:00
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 20:53 UTC · original
lcg007xd-c:feat/s-version-atc-probe → main · +84 −25 · 14 files · 1 commits · merged 2026-11-26 00:15 UTC

Change

Three RDNA 2 hints that write no register raised Untranslated in the reference interpreter and the HLSL recompiler. They now run as no-ops:

Encoding AMD "RDNA 2" ISA (November 2020) Now
s_version (SOPK 1) §12.2 (printed p. 106): "Do nothing. Argument is ignored by hardware"; §4.1: "Does nothing (treated as S_NOP)" in NO_OPERATION (new SOPK_NO_EFFECT), HLSL emits nothing
s_atc_probe (SMEM 38) §12.6 (p. 130): "Probe or prefetch an address into the SQC data cache" in CACHE_CONTROL with s_dcache_inv, s_gl1_inv…, HLSL emits nothing
s_atc_probe_buffer (SMEM 39) same same

The SDATA field of s_atc_probe is the probe mode, an immediate (llvm-mc 20 prints s_atc_probe 7, s[4:5], 0x64; the disassembler here already prints it that way), not a destination. A test checks that s7 is left alone.

rdna2_hlsl_memory.memory_statements now uses the interpreter's CACHE_CONTROL set instead of a copy of the same names, so the two cannot drift apart.

Coverage of the reference interpreter (rdna2_exec.coverage()): 1,208 → 1,211 of 1,490. The 9 READMEs change that number, and the percentage stays 81%. Overlap: #230 and #232 change the same README number; whichever merges second takes a one-line rebase (add 3 to its count).

Linked issue: none.

Verification

Linux (Arch, Python 3.14.10), no C++ runtime, no GPU (runtime and GPU tests skip), rebased rebased on main 9a06443:

python -m pytest                → 1095 passed, 323 skipped
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed!

The suite is green on this machine since #237 and #238 merged.

Not run here: test_hints_match_interpreter_on_gpu. I have no Windows, dxc or WARP, so it is skipped locally and will run in the Windows CI job. The HLSL side is still checked without a GPU: test_hlsl_translates_the_hints_to_nothing asserts that the translation with the three hints equals the translation without them.

Oracle and test data

  • New tests/test_rdna2_exec_hints.py:
    • the three encodings are executable;
    • running them changes no SGPR, VGPR, SCC, EXEC or VCC (compared with the same program without them, and s7/s3, named in their SDATA fields, explicitly);
    • the HLSL text is identical with and without them;
    • a GPU parity test (CI).
  • Failure case: the 3 CPU tests fail on main (Untranslated / Untranslatable on the hints).
  • Test programs are built in the tests with the existing encoders.

Checklist

  • The PR covers a single reviewable behaviour. (Three no-op hints.)
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success. (These are documented no-ops; s_code_end, an illegal instruction, stays refused.)
  • README: the same change in all 9 languages (test_readme_sync.py checks it).
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: none.
  • Code taken from another project: none.

Made with AI assistance (Claude Code).

🤖 Generated with Claude Code

**@⁠lcg007xd-c** on GitHub · 2026-11-25 20:53 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/241) `lcg007xd-c:feat/s-version-atc-probe` → `main` · +84 −25 · 14 files · 1 commits · merged 2026-11-26 00:15 UTC ## Change Three RDNA 2 hints that write no register raised `Untranslated` in the reference interpreter and the HLSL recompiler. They now run as no-ops: | Encoding | AMD "RDNA 2" ISA (November 2020) | Now | | --- | --- | --- | | `s_version` (SOPK 1) | §12.2 (printed p. 106): "Do nothing. Argument is ignored by hardware"; §4.1: "Does nothing (treated as S_NOP)" | in `NO_OPERATION` (new `SOPK_NO_EFFECT`), HLSL emits nothing | | `s_atc_probe` (SMEM 38) | §12.6 (p. 130): "Probe or prefetch an address into the SQC data cache" | in `CACHE_CONTROL` with `s_dcache_inv`, `s_gl1_inv`…, HLSL emits nothing | | `s_atc_probe_buffer` (SMEM 39) | same | same | The SDATA field of `s_atc_probe` is the probe mode, an immediate (llvm-mc 20 prints `s_atc_probe 7, s[4:5], 0x64`; the disassembler here already prints it that way), not a destination. A test checks that `s7` is left alone. `rdna2_hlsl_memory.memory_statements` now uses the interpreter's `CACHE_CONTROL` set instead of a copy of the same names, so the two cannot drift apart. Coverage of the reference interpreter (`rdna2_exec.coverage()`): **1,208 → 1,211 of 1,490**. The 9 READMEs change that number, and the percentage stays 81%. **Overlap:** #230 and #232 change the same README number; whichever merges second takes a one-line rebase (add 3 to its count). Linked issue: none. ## Verification Linux (Arch, Python 3.14.10), no C++ runtime, no GPU (runtime and GPU tests skip), rebased rebased on `main` `9a06443`: ``` python -m pytest → 1095 passed, 323 skipped python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed! ``` The suite is green on this machine since #237 and #238 merged. **Not run here:** `test_hints_match_interpreter_on_gpu`. I have no Windows, `dxc` or WARP, so it is skipped locally and will run in the Windows CI job. The HLSL side is still checked without a GPU: `test_hlsl_translates_the_hints_to_nothing` asserts that the translation with the three hints equals the translation without them. ## Oracle and test data - New `tests/test_rdna2_exec_hints.py`: - the three encodings are executable; - running them changes no SGPR, VGPR, SCC, EXEC or VCC (compared with the same program without them, and `s7`/`s3`, named in their SDATA fields, explicitly); - the HLSL text is identical with and without them; - a GPU parity test (CI). - Failure case: the 3 CPU tests fail on `main` (`Untranslated` / `Untranslatable` on the hints). - Test programs are built in the tests with the existing encoders. ## Checklist - [x] The PR covers a single reviewable behaviour. (Three no-op hints.) - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. (These are documented no-ops; `s_code_end`, an illegal instruction, stays refused.) - [x] README: the same change in all 9 languages (`test_readme_sync.py` checks it). - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: none. - [x] Code taken from another project: none. Made with AI assistance (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Three hints that write no register, refused until now:
- s_version (SOPK 1): "Do nothing. Argument is ignored by hardware" (ISA
  section 12.2, p. 106; section 4.1 "treated as S_NOP").
- s_atc_probe / s_atc_probe_buffer (SMEM 38-39): "Probe or prefetch an
  address into the SQC data cache" (section 12.6, p. 130). SDATA is the
  probe mode, an immediate, not a destination.

The interpreter runs them as no-ops (NO_OPERATION, CACHE_CONTROL) and
the HLSL recompiler emits nothing for them; rdna2_hlsl_memory now reads
the shared CACHE_CONTROL set instead of repeating it. README: 1,208 ->
1,211 of 1,490 in the 9 languages (still 81%).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:39:37 +00:00
github manually merged commit 6546076f51 into gh-pr/241/base 2026-11-26 05:39:39 +00:00
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-25 21:56 UTC · original

Thanks — this one is approved, but it now conflicts with main after #242, #244 and #248 were merged (mostly the README RDNA 2 line, plus shared rdna2 files for some). Could you merge or rebase onto main, recount the README line with rdna2_exec.coverage() on the merged tree (all 9 languages), and push? I will merge it as soon as CI is green.

**@⁠LooperSalty** on GitHub · 2026-11-25 21:56 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/241#issuecomment-7175744733) Thanks — this one is approved, but it now conflicts with main after #242, #244 and #248 were merged (mostly the README RDNA 2 line, plus shared rdna2 files for some). Could you merge or rebase onto main, recount the README line with `rdna2_exec.coverage()` on the merged tree (all 9 languages), and push? I will merge it as soon as CI is green.
Author
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 22:01 UTC · original

Rebased onto main (9a06443), README line recounted with rdna2_exec.coverage() on the merged tree: 1,211 of 1,490 (81%), all 9 languages. The rdna2_*_memory.py imports now carry both the addtid and cache-control names.

**@⁠lcg007xd-c** on GitHub · 2026-11-25 22:01 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/241#issuecomment-7175832896) Rebased onto `main` (`9a06443`), README line recounted with `rdna2_exec.coverage()` on the merged tree: 1,211 of 1,490 (81%), all 9 languages. The `rdna2_*_memory.py` imports now carry both the addtid and cache-control names.
This discussion has been locked. Commenting is limited to contributors.
No description provided.