shader: decode the remaining GFX10 SMEM operations in disasm_rdna2 #1094

Merged
tedin7 merged 4 commits from upstream-pr/1101 into main 2026-11-24 02:24:03 +00:00
tedin7 commented 2026-11-24 01:01:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:01:54Z.


Change

Decode the remaining GFX10 SMEM operations in tools/disasm_rdna2.py: s_buffer_store_dword{,x2,x4}, s_gl1_inv, s_dcache_inv, s_dcache_wb, s_memtime, s_memrealtime, s_atc_probe and s_atc_probe_buffer. Before this they printed as s_smem_NN with a four-register data operand. Cache-control ops print no operands, the timer ops print only the destination pair, and the probe ops print the 7-bit probe immediate. Follow-up to #938. Only the SMEM tables are touched.

AI-assisted.

Verification

  • python3 -B tests/rdna2_tools_check.py with LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 (no LLVM_LIB): 101 tests, OK (skipped=9, the LLVM-library round trips).
  • Negative control: the new test file against origin/main tools fails test_golden_vectors; with this change it passes.
  • Golden bytes and spellings were produced by llvm-mc-19 -mcpu=gfx1013 -show-encoding (llvm-mc-15 was not available on my machine). The same strings are added to the llvm-mc assembly list in the existing source-built test, which runs where LLVM 15 is installed.
  • With the LLVM library loaded locally (LLVM 19), test_llvm_comparison and test_source_built_records_after_s_endpgm also fail on unmodified origin/main (version spelling differences); none of the mismatches involve the new SMEM forms.

Evidence and follow-up

  • No GPU readback is used; the checks are byte-to-text decoding only.
  • Inputs are synthetic encodings assembled from one-line source.
  • Not covered: s_store_dword*, s_dcache_discard*.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed (none needed).
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572189459 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:01:54Z. --- ## Change Decode the remaining GFX10 SMEM operations in `tools/disasm_rdna2.py`: `s_buffer_store_dword{,x2,x4}`, `s_gl1_inv`, `s_dcache_inv`, `s_dcache_wb`, `s_memtime`, `s_memrealtime`, `s_atc_probe` and `s_atc_probe_buffer`. Before this they printed as `s_smem_NN` with a four-register data operand. Cache-control ops print no operands, the timer ops print only the destination pair, and the probe ops print the 7-bit probe immediate. Follow-up to #938. Only the SMEM tables are touched. AI-assisted. ## Verification - `python3 -B tests/rdna2_tools_check.py` with `LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19` (no `LLVM_LIB`): 101 tests, OK (skipped=9, the LLVM-library round trips). - Negative control: the new test file against `origin/main` tools fails `test_golden_vectors`; with this change it passes. - Golden bytes and spellings were produced by `llvm-mc-19 -mcpu=gfx1013 -show-encoding` (llvm-mc-15 was not available on my machine). The same strings are added to the llvm-mc assembly list in the existing source-built test, which runs where LLVM 15 is installed. - With the LLVM library loaded locally (LLVM 19), `test_llvm_comparison` and `test_source_built_records_after_s_endpgm` also fail on unmodified `origin/main` (version spelling differences); none of the mismatches involve the new SMEM forms. ## Evidence and follow-up - No GPU readback is used; the checks are byte-to-text decoding only. - Inputs are synthetic encodings assembled from one-line source. - Not covered: `s_store_dword*`, `s_dcache_discard*`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed (none needed). - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:46:19 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:46:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:08:54Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c04bf850b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032084274 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#pullrequestreview-6032084274). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T01:08:54Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `2c04bf850b` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 06:50:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:02:09Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T01:08:57.225503Z 2c04bf8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118686562 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#issuecomment-7118686562). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T01:02:09Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"2c04bf850b87cda33d580292314599318af729f6","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T01:08:57.225503Z">2026-11-24T01:08:57.225503Z</relative-time> | `2c04bf8` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
tedin7 commented 2026-11-24 06:50:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:13:24Z.


AI-assisted follow-up (305de800) for the review findings.

  • P1: docs/experiments.md now has a note on the public SMEM decoding coverage: forms decoded, operand convention, reproduction command python3 -B tests/rdna2_tools_check.py, and the decoding-only limits (no lowering, scanner support or hardware evidence).
  • P2: s_memtime / s_memrealtime now keep the named 64-bit destination spelling (null, vcc, ttmp[n:n+1]), matching llvm-mc. Record 401f90f400000000 decodes as s_memtime null instead of s[125:126].
  • Test: five new fixed vectors in tests/rdna2_tools_check.py. Before the fix: 101 tests, 1 failure (mismatch for 401f90f400000000). After: 101 tests OK (9 skipped).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118884181 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#issuecomment-7118884181). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:13:24Z. --- AI-assisted follow-up (305de800) for the review findings. - P1: docs/experiments.md now has a note on the public SMEM decoding coverage: forms decoded, operand convention, reproduction command `python3 -B tests/rdna2_tools_check.py`, and the decoding-only limits (no lowering, scanner support or hardware evidence). - P2: `s_memtime` / `s_memrealtime` now keep the named 64-bit destination spelling (`null`, `vcc`, `ttmp[n:n+1]`), matching llvm-mc. Record `401f90f400000000` decodes as `s_memtime null` instead of `s[125:126]`. - Test: five new fixed vectors in tests/rdna2_tools_check.py. Before the fix: 101 tests, 1 failure (mismatch for 401f90f400000000). After: 101 tests OK (9 skipped).
tedin7 commented 2026-11-24 06:50:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:33:49Z.


AI-assisted update: the scanner now recognizes the decoded scalar-memory mnemonics (is_opcode_recognized, recognition only, no lowering). New test test_decoded_scalar_memory_forms_are_recognized fails against main's scanner (10 mnemonics missing) and passes here; python3 -B tests/rdna2_tools_check.py gives 102 tests OK (9 skipped). docs/experiments.md note updated.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119223968 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#issuecomment-7119223968). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:33:49Z. --- AI-assisted update: the scanner now recognizes the decoded scalar-memory mnemonics (`is_opcode_recognized`, recognition only, no lowering). New test `test_decoded_scalar_memory_forms_are_recognized` fails against main's scanner (10 mnemonics missing) and passes here; `python3 -B tests/rdna2_tools_check.py` gives 102 tests OK (9 skipped). `docs/experiments.md` note updated.
tedin7 commented 2026-11-24 06:50:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:00:07Z.


AI-assisted. Merged origin/main to resolve conflicts with the SOPK and SOPP decoder change: the scanner recognition sets, the test import and the recognition test are kept side by side. python3 -B tests/rdna2_tools_check.py passes locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119657813 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#issuecomment-7119657813). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:00:07Z. --- AI-assisted. Merged origin/main to resolve conflicts with the SOPK and SOPP decoder change: the scanner recognition sets, the test import and the recognition test are kept side by side. python3 -B tests/rdna2_tools_check.py passes locally.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:08:54Z.

Code review location: tools/disasm_rdna2.py; line 376

@@ -372,11 +372,28 @@ def format_literal32(value: int) -> str:
     0x0a: "s_buffer_load_dwordx4",
     0x0b: "s_buffer_load_dwordx8",
     0x0c: "s_buffer_load_dwordx16",
+    0x18: "s_buffer_store_dword",
+    0x19: "s_buffer_store_dwordx2",

P1 Badge Document the new public SMEM decoding coverage

The added stores, cache-control operations, timers and probes extend the user-visible decoding capabilities, but neither the README nor docs/experiments.md is updated. The root AGENTS.md requires a README or experiment-documentation update when a public capability changes. Record the disassembly-only scope, reproduction command and remaining unsupported forms there rather than leaving that information only in the commit message.

AGENTS.md reference: AGENTS.md:L172-L173

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4674188687 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#discussion_r4674188687). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T01:08:54Z. **Code review location:** `tools/disasm_rdna2.py`; line 376 ~~~~diff @@ -372,11 +372,28 @@ def format_literal32(value: int) -> str: 0x0a: "s_buffer_load_dwordx4", 0x0b: "s_buffer_load_dwordx8", 0x0c: "s_buffer_load_dwordx16", + 0x18: "s_buffer_store_dword", + 0x19: "s_buffer_store_dwordx2", ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the new public SMEM decoding coverage** The added stores, cache-control operations, timers and probes extend the user-visible decoding capabilities, but neither the README nor `docs/experiments.md` is updated. The root `AGENTS.md` requires a README or experiment-documentation update when a public capability changes. Record the disassembly-only scope, reproduction command and remaining unsupported forms there rather than leaving that information only in the commit message. AGENTS.md reference: [AGENTS.md:L172-L173](https://github.com/R0Y00/Xbox2Windows/blob/2c04bf850b87cda33d580292314599318af729f6/AGENTS.md#L172-L173) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-24 06:50:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:08:54Z.

Code review location: tools/disasm_rdna2.py; line 2011

@@ -1986,7 +2003,15 @@ def sopc_operand(reg_id: int, wide: bool) -> str:
         sbase = (w0 & 0x3f) * 2
         op_name = SMEM_OPS.get(op, f"s_smem_{op:02x}")
         data_width, base_width = SMEM_WIDTHS.get(op, (4, 2))
-        sdata_str = decode_s_reg(sdata) if data_width == 1 else f"s[{sdata}:{sdata + data_width - 1}]"
+        if op in SMEM_NO_OPERANDS:
+            return (8, op_name, op_name, "Scalar memory cache control")
+        if op in SMEM_PROBE_OPS:
+            sdata_str = str(sdata)
+        else:
+            sdata_str = decode_s_reg(sdata) if data_width == 1 else f"s[{sdata}:{sdata + data_width - 1}]"

P2 Badge Preserve special-register destinations in timer decoding

For valid gfx1013 timer encodings with a special destination, this formats the destination as a nonexistent SGPR range. For example, 401f90f400000000, assembled by LLVM 20 as s_memtime null, now prints s_memtime s[125:126]; a VCC destination similarly prints s[106:107]. LLVM rejects those emitted operands, so the newly supported timer instructions misidentify their destination and cannot round-trip through assembly. Use the existing decode_s_reg64 helper for two-register operands and cover special destinations in the vectors.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4674188692 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1101#discussion_r4674188692). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T01:08:54Z. **Code review location:** `tools/disasm_rdna2.py`; line 2011 ~~~~diff @@ -1986,7 +2003,15 @@ def sopc_operand(reg_id: int, wide: bool) -> str: sbase = (w0 & 0x3f) * 2 op_name = SMEM_OPS.get(op, f"s_smem_{op:02x}") data_width, base_width = SMEM_WIDTHS.get(op, (4, 2)) - sdata_str = decode_s_reg(sdata) if data_width == 1 else f"s[{sdata}:{sdata + data_width - 1}]" + if op in SMEM_NO_OPERANDS: + return (8, op_name, op_name, "Scalar memory cache control") + if op in SMEM_PROBE_OPS: + sdata_str = str(sdata) + else: + sdata_str = decode_s_reg(sdata) if data_width == 1 else f"s[{sdata}:{sdata + data_width - 1}]" ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve special-register destinations in timer decoding** For valid gfx1013 timer encodings with a special destination, this formats the destination as a nonexistent SGPR range. For example, `401f90f400000000`, assembled by LLVM 20 as `s_memtime null`, now prints `s_memtime s[125:126]`; a VCC destination similarly prints `s[106:107]`. LLVM rejects those emitted operands, so the newly supported timer instructions misidentify their destination and cannot round-trip through assembly. Use the existing `decode_s_reg64` helper for two-register operands and cover special destinations in the vectors. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
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
R0Y00/Xbox2Windows!1094
No description provided.