tooling: decode 29 gfx1013 SOPK and SOPP opcodes #1085

Merged
tedin7 merged 3 commits from upstream-pr/1092 into main 2026-11-24 01:52:18 +00:00
tedin7 commented 2026-11-24 00:50:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T00:50:58Z.


Change

Refs #938. Name nine additional SOPK immediate comparisons, decode the
s_call_b64 destination as an SGPR pair, and name 19 SOPP system opcodes on
gfx1013. Use a raw hexadecimal immediate for message and dependency-control
operands so the output is independent of LLVM's symbolic spelling.

Verification

Linux x86-64, commit 94044c6a.

  • python3 -B tests/rdna2_tools_check.py passed with 92 passes and 9 skips for
    checks that require LLVM.
  • LLVM_LIB=libLLVM-15.so.1 LLVM_MC=llvm-mc-15 LLVM_OBJCOPY=llvm-objcopy-15 python3 -B tests/rdna2_tools_check.py
    passed all 101 tests with LLVM 15.0.6.
  • Negative control with the decoder at ed983c1c and the new tests:
    python3 -B tests/rdna2_tools_check.py TestRdna2Disasm.test_sopk_compare_and_call_opcodes TestRdna2Disasm.test_sopp_system_opcodes
    reported 29 failing subtests. The same vectors pass with this commit.
  • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python3 -B tests/rdna2_tools_check.py
    passes the new tests and reproduces the same three LLVM 19 incompatibilities
    as the baseline (test_interp_f16_llvm_round_trip, test_llvm_comparison,
    test_source_built_records_after_s_endpgm).
  • build-a-turno python3 -B tests/pixel_aot_check.py binary llvm-mc-15 llvm-objcopy-15 "$PWD/out/llvm15/usr/lib/x86_64-linux-gnu/libLLVM-15.so.1"
    exited 0 with the extracted LLVM 15.0.6 toolchain.
  • build-a-turno python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 "$PWD/out/llvm15/usr/lib/x86_64-linux-gnu/libLLVM-15.so.1"
    exited 0 with the extracted LLVM 15.0.6 toolchain.
  • build-a-turno python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so
    exited 1 at the existing v_cvt_f16_i16_e32 v1, 0xfff0 encoding assertion.
  • build-a-turno python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so
    exited 0.
  • git diff --check passed.

Evidence and follow-up

The MIT-licensed test vectors are synthetic gfx1013 words. LLVM 15.0.6 and
LLVM 19.1.7 both reassemble all 29 expected instructions byte-for-byte. The
tests verify the instruction length and the offset of a following s_endpgm
and check the fallback for a reserved SOPP word.
AMD RDNA 2 ISA reference ·
LLVM 15 scalar instruction definitions

The four SOPP debug branches are outside this slice.
This change uses the existing disassembly and test entry points.

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.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572059739 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1092). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T00:50:58Z. --- ## Change Refs #938. Name nine additional SOPK immediate comparisons, decode the `s_call_b64` destination as an SGPR pair, and name 19 SOPP system opcodes on gfx1013. Use a raw hexadecimal immediate for message and dependency-control operands so the output is independent of LLVM's symbolic spelling. ## Verification Linux x86-64, commit `94044c6a`. - `python3 -B tests/rdna2_tools_check.py` passed with 92 passes and 9 skips for checks that require LLVM. - `LLVM_LIB=libLLVM-15.so.1 LLVM_MC=llvm-mc-15 LLVM_OBJCOPY=llvm-objcopy-15 python3 -B tests/rdna2_tools_check.py` passed all 101 tests with LLVM 15.0.6. - Negative control with the decoder at `ed983c1c` and the new tests: `python3 -B tests/rdna2_tools_check.py TestRdna2Disasm.test_sopk_compare_and_call_opcodes TestRdna2Disasm.test_sopp_system_opcodes` reported 29 failing subtests. The same vectors pass with this commit. - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python3 -B tests/rdna2_tools_check.py` passes the new tests and reproduces the same three LLVM 19 incompatibilities as the baseline (`test_interp_f16_llvm_round_trip`, `test_llvm_comparison`, `test_source_built_records_after_s_endpgm`). - `build-a-turno python3 -B tests/pixel_aot_check.py binary llvm-mc-15 llvm-objcopy-15 "$PWD/out/llvm15/usr/lib/x86_64-linux-gnu/libLLVM-15.so.1"` exited 0 with the extracted LLVM 15.0.6 toolchain. - `build-a-turno python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 "$PWD/out/llvm15/usr/lib/x86_64-linux-gnu/libLLVM-15.so.1"` exited 0 with the extracted LLVM 15.0.6 toolchain. - `build-a-turno python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so` exited 1 at the existing `v_cvt_f16_i16_e32 v1, 0xfff0` encoding assertion. - `build-a-turno python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so` exited 0. - `git diff --check` passed. ## Evidence and follow-up The MIT-licensed test vectors are synthetic gfx1013 words. LLVM 15.0.6 and LLVM 19.1.7 both reassemble all 29 expected instructions byte-for-byte. The tests verify the instruction length and the offset of a following `s_endpgm` and check the fallback for a reserved SOPP word. [AMD RDNA 2 ISA reference](https://docs.amd.com/v/u/en-US/rdna2-shader-instruction-set-architecture) · [LLVM 15 scalar instruction definitions](https://github.com/llvm/llvm-project/blob/llvmorg-15.0.7/llvm/lib/Target/AMDGPU/SOPInstructions.td) The four SOPP debug branches are outside this slice. This change uses the existing disassembly and test entry points. ## 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. - [ ] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:46:16 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:46:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:58:22Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94044c6a88

ℹ️ 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:6031997471 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1092#pullrequestreview-6031997471). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:58:22Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `94044c6a88` <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:49:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:51:07Z.


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-24T00:58:24.446440Z 94044c6 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:7118501011 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1092#issuecomment-7118501011). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:51:07Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"94044c6a88c99c3c2b07b974df311f7a8c49ecd4","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-24T00:58:24.446440Z">2026-11-24T00:58:24.446440Z</relative-time> | `94044c6` | 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:04 +00:00 (Migrated from github.com)

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


AI-assisted. Both review findings were addressed in d9d453e3: docs/experiments.md now documents the SOPK and SOPP decoding coverage (forms, operand convention, reproduction command, decoding-only limits), and the new mnemonics, including s_sendmsg and s_call_b64, are registered in the scanner so they are counted as recognized by the translator-rejected path instead of unsupported opcodes.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119300310 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1092#issuecomment-7119300310). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:38:21Z. --- AI-assisted. Both review findings were addressed in d9d453e3: docs/experiments.md now documents the SOPK and SOPP decoding coverage (forms, operand convention, reproduction command, decoding-only limits), and the new mnemonics, including s_sendmsg and s_call_b64, are registered in the scanner so they are counted as recognized by the translator-rejected path instead of unsupported opcodes.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:58:22Z.

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

@@ -250,11 +269,21 @@ def _format_operand_modifiers(val: str, is_abs: int, is_neg: int) -> str:
     0x03: ("s_cmpk_eq_i32", "Scalar compare equal immediate"),
     0x04: ("s_cmpk_lg_i32", "Scalar compare not-equal immediate"),
     0x05: ("s_cmpk_gt_i32", "Scalar compare greater immediate"),
+    0x06: ("s_cmpk_ge_i32", "Scalar signed compare greater-or-equal immediate"),

P1 Badge Document the added public disassembly capability

This expands the public binary/hex decoder by 29 gfx1013 instruction forms, but the commit updates neither README.md nor docs/experiments.md. Root AGENTS.md explicitly requires updating one of those documents when a public capability changes. Add a scoped note covering the newly decoded forms, raw-immediate convention, reproduction command, and decoding-only validation limits rather than leaving that information solely in the commit message.

AGENTS.md reference: AGENTS.md:L171-L172

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4674112918 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1092#discussion_r4674112918). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:58:22Z. **Code review location:** `tools/disasm_rdna2.py`; line 272 ~~~~diff @@ -250,11 +269,21 @@ def _format_operand_modifiers(val: str, is_abs: int, is_neg: int) -> str: 0x03: ("s_cmpk_eq_i32", "Scalar compare equal immediate"), 0x04: ("s_cmpk_lg_i32", "Scalar compare not-equal immediate"), 0x05: ("s_cmpk_gt_i32", "Scalar compare greater immediate"), + 0x06: ("s_cmpk_ge_i32", "Scalar signed compare greater-or-equal immediate"), ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the added public disassembly capability** This expands the public binary/hex decoder by 29 gfx1013 instruction forms, but the commit updates neither `README.md` nor `docs/experiments.md`. Root `AGENTS.md` explicitly requires updating one of those documents when a public capability changes. Add a scoped note covering the newly decoded forms, raw-immediate convention, reproduction command, and decoding-only validation limits rather than leaving that information solely in the commit message. AGENTS.md reference: [AGENTS.md:L171-L172](https://github.com/R0Y00/Xbox2Windows/blob/94044c6a88c99c3c2b07b974df311f7a8c49ecd4/AGENTS.md#L171-L172) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-24 06:50:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:58:22Z.

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

@@ -126,17 +126,36 @@ def _format_operand_modifiers(val: str, is_abs: int, is_neg: int) -> str:
     0x00: ("s_nop", "No operation (wait cycles)"),
     0x01: ("s_endpgm", "Terminate shader execution"),
     0x02: ("s_branch", "Unconditional branch"),
+    0x03: ("s_wakeup", "Wake a sleeping wave"),
     0x04: ("s_cbranch_scc0", "Branch if SCC == 0"),
     0x05: ("s_cbranch_scc1", "Branch if SCC == 1"),
     0x06: ("s_cbranch_vccz", "Branch if VCC is zero"),
     0x07: ("s_cbranch_vccnz", "Branch if VCC is non-zero"),
     0x08: ("s_cbranch_execz", "Branch if EXEC is zero"),
     0x09: ("s_cbranch_execnz", "Branch if EXEC is non-zero"),
     0x0a: ("s_barrier", "Synchronize wavefronts in workgroup"),
+    0x0b: ("s_setkill", "Set the wave kill bit"),
     0x0c: ("s_waitcnt", "Wait for memory operations"),
+    0x0d: ("s_sethalt", "Set the wave halt bit"),
+    0x0e: ("s_sleep", "Suspend the wave temporarily"),
+    0x0f: ("s_setprio", "Set wave priority"),
+    0x10: ("s_sendmsg", "Send a message"),
+    0x11: ("s_sendmsghalt", "Send a message and halt the wave"),

P2 Badge Register new decoded mnemonics in scanner recognition

When the binary scanner consumes these newly decoded instructions, is_opcode_recognized() in tools/scan_unsupported_shaders.py still consults a separate set that omits s_sendmsg and 15 other added mnemonics, including s_call_b64. For example, analyzing 030090bf000081bf now decodes s_sendmsg 0x3; s_endpgm but still produces unsupported_opcodes={'s_sendmsg': 1} and the unsupported_opcodes category instead of opcode_recognized_translator_rejected. Consequently, generated recognition totals continue counting these decoded ISA instructions as unrecognized. Register the new SOPP/SOPK names with the scanner and add an integration assertion; this does not require adding lowering support.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4674112927 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1092#discussion_r4674112927). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:58:22Z. **Code review location:** `tools/disasm_rdna2.py`; line 143 ~~~~diff @@ -126,17 +126,36 @@ def _format_operand_modifiers(val: str, is_abs: int, is_neg: int) -> str: 0x00: ("s_nop", "No operation (wait cycles)"), 0x01: ("s_endpgm", "Terminate shader execution"), 0x02: ("s_branch", "Unconditional branch"), + 0x03: ("s_wakeup", "Wake a sleeping wave"), 0x04: ("s_cbranch_scc0", "Branch if SCC == 0"), 0x05: ("s_cbranch_scc1", "Branch if SCC == 1"), 0x06: ("s_cbranch_vccz", "Branch if VCC is zero"), 0x07: ("s_cbranch_vccnz", "Branch if VCC is non-zero"), 0x08: ("s_cbranch_execz", "Branch if EXEC is zero"), 0x09: ("s_cbranch_execnz", "Branch if EXEC is non-zero"), 0x0a: ("s_barrier", "Synchronize wavefronts in workgroup"), + 0x0b: ("s_setkill", "Set the wave kill bit"), 0x0c: ("s_waitcnt", "Wait for memory operations"), + 0x0d: ("s_sethalt", "Set the wave halt bit"), + 0x0e: ("s_sleep", "Suspend the wave temporarily"), + 0x0f: ("s_setprio", "Set wave priority"), + 0x10: ("s_sendmsg", "Send a message"), + 0x11: ("s_sendmsghalt", "Send a message and halt the wave"), ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Register new decoded mnemonics in scanner recognition** When the binary scanner consumes these newly decoded instructions, `is_opcode_recognized()` in `tools/scan_unsupported_shaders.py` still consults a separate set that omits `s_sendmsg` and 15 other added mnemonics, including `s_call_b64`. For example, analyzing `030090bf000081bf` now decodes `s_sendmsg 0x3; s_endpgm` but still produces `unsupported_opcodes={'s_sendmsg': 1}` and the `unsupported_opcodes` category instead of `opcode_recognized_translator_rejected`. Consequently, generated recognition totals continue counting these decoded ISA instructions as unrecognized. Register the new SOPP/SOPK names with the scanner and add an integration assertion; this does not require adding lowering support. 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!1085
No description provided.