tooling: decode 18 gfx1013 binary16 VOP1 and VOP2 opcodes #1103

Manually merged
github merged 7 commits from gh-pr/1103/head into gh-pr/1103/base 2026-11-26 22:41:46 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:03 UTC · original
tedin7:x2w-disasm-vop1-vop2-f16 → main · +118 −3 · 4 files · 7 commits · merged 2026-11-24 03:25 UTC

Change

Refs #938. Add 18 gfx1013 binary16 e32 mnemonics to the Python disassembler opcode tables. VOP2 gains v_add_f16, v_sub_f16, v_subrev_f16, v_mul_f16, v_max_f16, v_min_f16 and v_pk_fmac_f16 (opcodes 0x32-0x35, 0x39, 0x3a, 0x3c). VOP1 gains v_cvt_f16_u16, v_cvt_f16_i16, v_cvt_u16_f16, v_cvt_i16_f16, v_floor_f16, v_ceil_f16, v_trunc_f16, v_rndne_f16, v_fract_f16, v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 (opcodes 0x50-0x53, 0x5b-0x5f, 0x63, 0x64). The production diff is confined to VOP1_OPS and VOP2_OPS. The spelling follows LLVM 15 (the CI assembler): v_pk_fmac_f16 prints without an _e32 suffix, the others with it. The test extends the existing golden table from #1070. No other open PR adds these opcodes (#906 lowers some binary16 math in a different tool).

Verification

Linux x86-64 (Debian 13). LLVM 15.0.6 was extracted from the Debian bookworm packages into a scratch directory outside the repo and used as the assembler, objcopy and disassembly library.

  • Base decoder with the new test (negative control): python3 -B tests/rdna2_tools_check.py -k test_vop1_vop2_e32_gfx1013 reported 18 failing subtests, one per new mnemonic. With LLVM_LIB set, -k test_vop1_vop2_e32 reported FAILED (failures=19): the 18 golden subtests plus the LLVM round trip.
  • With the change and LLVM 15: -k test_vop1_vop2_e32 passed both tests. All 24 instructions round-tripped byte for byte, and Python output equals LLVM 15 disassembly.
  • LLVM 15 assembled the 18 new lines to the same bytes that llvm-mc-19 prints (checked on all 18 words).
  • Full suite with LLVM 15: python3 -B tests/rdna2_tools_check.py ran 101 tests, OK. python3 -B tests/pixel_aot_check.py binary ..., python3 -B tests/compute_store_check.py binary ... and python3 -B tests/pso_readiness_check.py exited 0.
  • With LLVM disabled (env -u LLVM_LIB): 101 tests, OK, 9 skipped (the LLVM-only tests).
  • git diff --check passed.

Evidence and follow-up

The 18 instructions are original synthetic register-only fixtures contributed under the repository's MIT license; each uses distinct operand numbers so a mixed-up field would change the expected text. The expected bytes come from llvm-mc, the decoded text is checked against LLVM's own disassembly of the same bytes, and reassembly reproduces the bytes. This is decoder coverage only; it makes no claim about execution.

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.

This change was AI-assisted.

**@⁠tedin7** on GitHub · 2026-11-24 01:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103) `tedin7:x2w-disasm-vop1-vop2-f16` → `main` · +118 −3 · 4 files · 7 commits · merged 2026-11-24 03:25 UTC ## Change Refs #938. Add 18 gfx1013 binary16 e32 mnemonics to the Python disassembler opcode tables. VOP2 gains `v_add_f16`, `v_sub_f16`, `v_subrev_f16`, `v_mul_f16`, `v_max_f16`, `v_min_f16` and `v_pk_fmac_f16` (opcodes 0x32-0x35, 0x39, 0x3a, 0x3c). VOP1 gains `v_cvt_f16_u16`, `v_cvt_f16_i16`, `v_cvt_u16_f16`, `v_cvt_i16_f16`, `v_floor_f16`, `v_ceil_f16`, `v_trunc_f16`, `v_rndne_f16`, `v_fract_f16`, `v_cvt_norm_i16_f16` and `v_cvt_norm_u16_f16` (opcodes 0x50-0x53, 0x5b-0x5f, 0x63, 0x64). The production diff is confined to `VOP1_OPS` and `VOP2_OPS`. The spelling follows LLVM 15 (the CI assembler): `v_pk_fmac_f16` prints without an `_e32` suffix, the others with it. The test extends the existing golden table from #1070. No other open PR adds these opcodes (#906 lowers some binary16 math in a different tool). ## Verification Linux x86-64 (Debian 13). LLVM 15.0.6 was extracted from the Debian bookworm packages into a scratch directory outside the repo and used as the assembler, objcopy and disassembly library. - Base decoder with the new test (negative control): `python3 -B tests/rdna2_tools_check.py -k test_vop1_vop2_e32_gfx1013` reported 18 failing subtests, one per new mnemonic. With LLVM_LIB set, `-k test_vop1_vop2_e32` reported FAILED (failures=19): the 18 golden subtests plus the LLVM round trip. - With the change and LLVM 15: `-k test_vop1_vop2_e32` passed both tests. All 24 instructions round-tripped byte for byte, and Python output equals LLVM 15 disassembly. - LLVM 15 assembled the 18 new lines to the same bytes that llvm-mc-19 prints (checked on all 18 words). - Full suite with LLVM 15: `python3 -B tests/rdna2_tools_check.py` ran 101 tests, OK. `python3 -B tests/pixel_aot_check.py binary ...`, `python3 -B tests/compute_store_check.py binary ...` and `python3 -B tests/pso_readiness_check.py` exited 0. - With LLVM disabled (`env -u LLVM_LIB`): 101 tests, OK, 9 skipped (the LLVM-only tests). - `git diff --check` passed. ## Evidence and follow-up The 18 instructions are original synthetic register-only fixtures contributed under the repository's MIT license; each uses distinct operand numbers so a mixed-up field would change the expected text. The expected bytes come from llvm-mc, the decoded text is checked against LLVM's own disassembly of the same bytes, and reassembly reproduces the bytes. This is decoder coverage only; it makes no claim about execution. ## 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. This change was AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:41:44 +00:00
github manually merged commit b30c7f803f into gh-pr/1103/base 2026-11-26 22:41:46 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:03 UTC · original · edited 2026-11-24 01:09 UTC

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:09:13.448198Z b89f9ec 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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#issuecomment-7118710569) · edited 2026-11-24 01:09 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"b89f9ec6c8ee308dd3d585d26848b5a1940e23e3","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:09:13.448198Z">2026-11-24T01:09:13.448198Z</relative-time> | `b89f9ec` | 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>
@ -860,1 +875,4 @@
0x39: ("v_max_f16_e32", "Vector maximum float16"),
0x3a: ("v_min_f16_e32", "Vector minimum float16"),
0x3b: ("v_ldexp_f16_e32", "Vector scale float16 by a power of two"),
0x3c: ("v_pk_fmac_f16", "Vector packed fused multiply-accumulate float16"),
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:09 UTC · original

P2 Badge Reject the nonexistent VOP3 form of packed FMAC

For a VOP3 word with opcode 0x13c (e.g. 03003cd5050f0200), the existing VOP3 fallback now reuses this entry; replacing _e32 with _e64 leaves the suffix-less name unchanged, so it emits v_pk_fmac_f16 v3, v5, v7. Packed FMAC has no gfx1013 e64 form (LLVM 20 rejects these bytes), yet this assembly is accepted by pixel_aot.lower with initialized operands and half_denorm="preserve"; the parent instead produced an unsupported v_vop2_3c instruction. Guard the VOP3 dispatch so adding VOP2 coverage cannot silently make this invalid encoding lowerable.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#discussion_r4674190801) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Reject the nonexistent VOP3 form of packed FMAC** For a VOP3 word with opcode `0x13c` (e.g. `03003cd5050f0200`), the existing VOP3 fallback now reuses this entry; replacing `_e32` with `_e64` leaves the suffix-less name unchanged, so it emits `v_pk_fmac_f16 v3, v5, v7`. Packed FMAC has no gfx1013 e64 form (LLVM 20 rejects these bytes), yet this assembly is accepted by `pixel_aot.lower` with initialized operands and `half_denorm="preserve"`; the parent instead produced an unsupported `v_vop2_3c` instruction. Guard the VOP3 dispatch so adding VOP2 coverage cannot silently make this invalid encoding lowerable. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:13 UTC · original

AI-assisted. Fixed the P2 finding in tools/disasm_rdna2.py: VOP3 opcode 0x13c no longer decodes as v_pk_fmac_f16. gfx1013 has no VOP3 form of it (llvm-mc 15 and 19 report 'e64 variant of this instruction is not supported'), so the record is now v_pk_fmac_f16_unsupported with the correct length (8, or 12 with a literal) and is not recognized or supported by the scanner. Neighbouring VOP2 ops that do exist in VOP3 (v_fmac_f16, v_max_f16, v_min_f16, v_ldexp_f16 as _e64) still decode; the encodings were assembled with llvm-mc-19. New test test_vop3_rejects_packed_fmac_f16_but_keeps_other_vop2_forms fails before the fix (decoded as v_pk_fmac_f16) and passes after. python3 -B tests/rdna2_tools_check.py: 102 tests OK (9 skipped). docs/experiments.md pk_fmac note now says so. Commit b8869f5d.

**@⁠tedin7** on GitHub · 2026-11-24 01:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#issuecomment-7118883483) AI-assisted. Fixed the P2 finding in tools/disasm_rdna2.py: VOP3 opcode 0x13c no longer decodes as v_pk_fmac_f16. gfx1013 has no VOP3 form of it (llvm-mc 15 and 19 report 'e64 variant of this instruction is not supported'), so the record is now v_pk_fmac_f16_unsupported with the correct length (8, or 12 with a literal) and is not recognized or supported by the scanner. Neighbouring VOP2 ops that do exist in VOP3 (v_fmac_f16, v_max_f16, v_min_f16, v_ldexp_f16 as _e64) still decode; the encodings were assembled with llvm-mc-19. New test test_vop3_rejects_packed_fmac_f16_but_keeps_other_vop2_forms fails before the fix (decoded as v_pk_fmac_f16) and passes after. python3 -B tests/rdna2_tools_check.py: 102 tests OK (9 skipped). docs/experiments.md pk_fmac note now says so. Commit b8869f5d.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:35 UTC · original

AI-assisted update: merged current main and added scanner recognition for the decoded binary16 VOP1/VOP2 mnemonics (v_cvt_u16_f16, v_cvt_i16_f16, v_fract_f16, v_cvt_norm_i16_f16, v_cvt_norm_u16_f16, v_fmac_f16, v_max_f16, v_min_f16, v_ldexp_f16, v_pk_fmac_f16). Recognition only, no lowering.

Verification: python3 -B tests/rdna2_tools_check.py runs 108 tests, OK (10 skipped). The new test_decoded_binary16_vop1_vop2_forms_are_recognized fails against the scanner from main (10 unrecognized names) and passes with this change. The rejected VOP3 spelling v_pk_fmac_f16_unsupported stays unrecognized. Note added in docs/experiments.md.

**@⁠tedin7** on GitHub · 2026-11-24 01:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#issuecomment-7119247933) AI-assisted update: merged current main and added scanner recognition for the decoded binary16 VOP1/VOP2 mnemonics (`v_cvt_u16_f16`, `v_cvt_i16_f16`, `v_fract_f16`, `v_cvt_norm_i16_f16`, `v_cvt_norm_u16_f16`, `v_fmac_f16`, `v_max_f16`, `v_min_f16`, `v_ldexp_f16`, `v_pk_fmac_f16`). Recognition only, no lowering. Verification: `python3 -B tests/rdna2_tools_check.py` runs 108 tests, OK (10 skipped). The new `test_decoded_binary16_vop1_vop2_forms_are_recognized` fails against the scanner from main (10 unrecognized names) and passes with this change. The rejected VOP3 spelling `v_pk_fmac_f16_unsupported` stays unrecognized. Note added in `docs/experiments.md`.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:00 UTC · original

AI-assisted. Merged origin/main to resolve conflicts with the SOPK and SOPP decoder change: both docs/experiments.md sections, the test import and both recognition tests are kept. python3 -B tests/rdna2_tools_check.py passes locally.

**@⁠tedin7** on GitHub · 2026-11-24 02:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#issuecomment-7119663818) AI-assisted. Merged origin/main to resolve conflicts with the SOPK and SOPP decoder change: both docs/experiments.md sections, the test import and both recognition tests are kept. python3 -B tests/rdna2_tools_check.py passes locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:31 UTC · original

Merged origin/main again after the scalar-memory decoder landed. The only conflict was in tests/rdna2_tools_check.py (the import line and the scanner recognition tests); both sides are kept, so the binary16 and the scalar-memory recognition tests both stay. python3 -B tests/rdna2_tools_check.py: 112 tests OK (10 skipped). No force push. AI-assisted.

**@⁠tedin7** on GitHub · 2026-11-24 02:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#issuecomment-7120234523) Merged origin/main again after the scalar-memory decoder landed. The only conflict was in `tests/rdna2_tools_check.py` (the import line and the scanner recognition tests); both sides are kept, so the binary16 and the scalar-memory recognition tests both stay. `python3 -B tests/rdna2_tools_check.py`: 112 tests OK (10 skipped). No force push. AI-assisted.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:43 UTC · original

Merged origin/main again after the SOP1 relative-move decoder landed. The only conflict was in docs/experiments.md (two adjacent sections); both are kept, the SOP1 section first and the binary16 recognition section after it, each with its own scope line. python3 -B tests/rdna2_tools_check.py: 113 tests OK (10 skipped). No force push. AI-assisted.

**@⁠tedin7** on GitHub · 2026-11-24 02:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#issuecomment-7120419859) Merged origin/main again after the SOP1 relative-move decoder landed. The only conflict was in `docs/experiments.md` (two adjacent sections); both are kept, the SOP1 section first and the binary16 recognition section after it, each with its own scope line. `python3 -B tests/rdna2_tools_check.py`: 113 tests OK (10 skipped). No force push. AI-assisted.
@ -860,1 +875,4 @@
0x39: ("v_max_f16_e32", "Vector maximum float16"),
0x3a: ("v_min_f16_e32", "Vector minimum float16"),
0x3b: ("v_ldexp_f16_e32", "Vector scale float16 by a power of two"),
0x3c: ("v_pk_fmac_f16", "Vector packed fused multiply-accumulate float16"),
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 03:23 UTC · original

Fixed in b8869f5d (AI-assisted): VOP3 opcode 0x13c now decodes as v_pk_fmac_f16_unsupported, not recognized by the scanner; the new test fails before and passes after.

**@⁠tedin7** on GitHub · 2026-11-24 03:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#discussion_r4675122094) Fixed in b8869f5d (AI-assisted): VOP3 opcode 0x13c now decodes as v_pk_fmac_f16_unsupported, not recognized by the scanner; the new test fails before and passes after.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:09 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b89f9ec6c8

ℹ️ 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".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1103#pullrequestreview-6032087029) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `b89f9ec6c8` <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>
This discussion has been locked. Commenting is limited to contributors.
No description provided.