tooling: decode 18 gfx1013 binary16 VOP1 and VOP2 opcodes #1096
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1103"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:03:23Z.
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_f16andv_pk_fmac_f16(opcodes 0x32-0x35, 0x39, 0x3a, 0x3c). VOP1 gainsv_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_f16andv_cvt_norm_u16_f16(opcodes 0x50-0x53, 0x5b-0x5f, 0x63, 0x64). The production diff is confined toVOP1_OPSandVOP2_OPS. The spelling follows LLVM 15 (the CI assembler):v_pk_fmac_f16prints without an_e32suffix, 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.
python3 -B tests/rdna2_tools_check.py -k test_vop1_vop2_e32_gfx1013reported 18 failing subtests, one per new mnemonic. With LLVM_LIB set,-k test_vop1_vop2_e32reported FAILED (failures=19): the 18 golden subtests plus the LLVM round trip.-k test_vop1_vop2_e32passed both tests. All 24 instructions round-tripped byte for byte, and Python output equals LLVM 15 disassembly.python3 -B tests/rdna2_tools_check.pyran 101 tests, OK.python3 -B tests/pixel_aot_check.py binary ...,python3 -B tests/compute_store_check.py binary ...andpython3 -B tests/pso_readiness_check.pyexited 0.env -u LLVM_LIB): 101 tests, OK, 9 skipped (the LLVM-only tests).git diff --checkpassed.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 change was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:09:10Z.
Review: COMMENTED
💡 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
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".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T03:23:16Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:03:35Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
b89f9ecℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:13:21Z.
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.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:35:13Z.
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.pyruns 108 tests, OK (10 skipped). The newtest_decoded_binary16_vop1_vop2_forms_are_recognizedfails against the scanner from main (10 unrecognized names) and passes with this change. The rejected VOP3 spellingv_pk_fmac_f16_unsupportedstays unrecognized. Note added indocs/experiments.md.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:00:29Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:31:53Z.
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.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:43:29Z.
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.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:09:11Z.
Code review location:
tools/disasm_rdna2.py; line 738For a VOP3 word with opcode
0x13c(e.g.03003cd5050f0200), the existing VOP3 fallback now reuses this entry; replacing_e32with_e64leaves the suffix-less name unchanged, so it emitsv_pk_fmac_f16 v3, v5, v7. Packed FMAC has no gfx1013 e64 form (LLVM 20 rejects these bytes), yet this assembly is accepted bypixel_aot.lowerwith initialized operands andhalf_denorm="preserve"; the parent instead produced an unsupportedv_vop2_3cinstruction. Guard the VOP3 dispatch so adding VOP2 coverage cannot silently make this invalid encoding lowerable.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T03:23:16Z.
Code review location:
tools/disasm_rdna2.py; line 738Fixed 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.