tooling: decode gfx10 VOP3 interp e64 at 0x200-0x202 #1226

Merged
triggered02 merged 2 commits from upstream-pr/1233 into main 2026-11-24 05:22:48 +00:00
triggered02 commented 2026-11-24 04:44:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T04:44:40Z.


Part of #938 (D9 remainder: gfx1013 VOP3 interpolation still only decoded at the gfx8/gfx9 opcode range).

Defect

tools/disasm_rdna2.py handled VOP3 interpolation only at 0x270 <= op < 0x274. On gfx10/gfx1013 the e64 forms live at 0x200 / 0x201 / 0x202 (LLVM 15.0.7 llvm/lib/Target/AMDGPU/VOP3Instructions.td:1045-1047), so they fell through to the v_vop3_200 / v_vop3_201 placeholders and the attribute operand was rendered as a source register.

LLVM golden vector from llvm/test/MC/AMDGPU/gfx10_asm_vop3.s:13065, encoding 05 00 00 d6 00 04 02 00:

decode
before opcode='v_vop3_200', asm='v_vop3_200 v5, s0, v2, s0'
after opcode='v_interp_p1_f32_e64', asm='v_interp_p1_f32_e64 v5, v2, attr0.x'

Provenance / field layout

  • Opcodes and mnemonics: VOP3Instructions.td:1045-1047 (VOP3Interp_Real_gfx10<0x200/0x201/0x202>).
  • Printed operand order: the VOP3_INTERP / VOP3_INTERP_MOV profiles at VOP3Instructions.td:55-105 — $vdst, $src0_modifiers, $attr$attrchan$clamp$omod (the mov form's second operand is the InterpSlot p10/p20/p0, not a register).
  • Bit layout: VOP3Interp_gfx10 at VOPInstructions.td:296-312 — attr in SRC0[5:0], attrchan in SRC0[7:6], the data VGPR in SRC1, abs/neg only at source index 1 (the data operand; SRC0 is the attribute), with SRC0[8] (the f16-only high bit), the SRC2 field and all other modifier bits fixed zero.
  • The layout was validated against all 44 v_interp_p1/p2/mov_f32_e64 vectors in gfx10_asm_vop3.s:13065-13195 before the decoder was written.

The gfx8/gfx9 branch at 0x270-0x272 is retained with a clarifying comment rather than gated: LLVM defines it as VOP3Interp_Real_vi under AssemblerPredicate = isGFX8GFX9 (VOP3Instructions.td:1365-1367), and no gfx10 form uses those opcodes, so keeping it only lets gfx8/gfx9 words keep rendering as LLVM's VI tests show; gfx1013 interpolation is not reachable through it.

Changes

  • tools/disasm_rdna2.py: new INTERP_F32_E64_OPS table and _decode_interp_f32_e64 for the p1/p2 forms, plus a 0x200 <= op < 0x203 dispatch branch before the generic fallback. The existing 0x202 InterpSlot decode is unchanged. Words that set the bitfields LLVM fixes to zero are reported as <unsupported VOP3 encoding> records while keeping the 8-byte record length, so the stream stays aligned.
  • tests/rdna2_tools_check.py: 28 golden vectors carrying their file:line provenance, refusal cases for the fixed-zero fields, and an LLVM_LIB-gated round trip. Existing tests are untouched.

Tests

python -B tests/rdna2_tools_check.py -> Ran 132 tests in 3.963s / OK (skipped=16). Baseline on the same worktree was Ran 129 / OK (skipped=15); the extra skip is the new LLVM-gated round-trip test. All 44 upstream goldens decode byte-for-byte to LLVM's printed text.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6574798293 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T04:44:40Z. --- Part of #938 (D9 remainder: gfx1013 VOP3 interpolation still only decoded at the gfx8/gfx9 opcode range). ## Defect `tools/disasm_rdna2.py` handled VOP3 interpolation only at `0x270 <= op < 0x274`. On gfx10/gfx1013 the e64 forms live at `0x200` / `0x201` / `0x202` (LLVM 15.0.7 `llvm/lib/Target/AMDGPU/VOP3Instructions.td:1045-1047`), so they fell through to the `v_vop3_200` / `v_vop3_201` placeholders and the attribute operand was rendered as a source register. LLVM golden vector from `llvm/test/MC/AMDGPU/gfx10_asm_vop3.s:13065`, encoding `05 00 00 d6 00 04 02 00`: | | decode | |---|---| | before | `opcode='v_vop3_200'`, `asm='v_vop3_200 v5, s0, v2, s0'` | | after | `opcode='v_interp_p1_f32_e64'`, `asm='v_interp_p1_f32_e64 v5, v2, attr0.x'` | ## Provenance / field layout - Opcodes and mnemonics: `VOP3Instructions.td:1045-1047` (`VOP3Interp_Real_gfx10<0x200/0x201/0x202>`). - Printed operand order: the `VOP3_INTERP` / `VOP3_INTERP_MOV` profiles at `VOP3Instructions.td:55-105` — `$vdst, $src0_modifiers, $attr$attrchan$clamp$omod` (the mov form's second operand is the `InterpSlot` p10/p20/p0, not a register). - Bit layout: `VOP3Interp_gfx10` at `VOPInstructions.td:296-312` — attr in SRC0[5:0], attrchan in SRC0[7:6], the data VGPR in SRC1, abs/neg only at source index 1 (the data operand; SRC0 is the attribute), with SRC0[8] (the f16-only `high` bit), the SRC2 field and all other modifier bits fixed zero. - The layout was validated against all 44 `v_interp_p1/p2/mov_f32_e64` vectors in `gfx10_asm_vop3.s:13065-13195` before the decoder was written. The gfx8/gfx9 branch at `0x270-0x272` is retained with a clarifying comment rather than gated: LLVM defines it as `VOP3Interp_Real_vi` under `AssemblerPredicate = isGFX8GFX9` (`VOP3Instructions.td:1365-1367`), and no gfx10 form uses those opcodes, so keeping it only lets gfx8/gfx9 words keep rendering as LLVM's VI tests show; gfx1013 interpolation is not reachable through it. ## Changes - `tools/disasm_rdna2.py`: new `INTERP_F32_E64_OPS` table and `_decode_interp_f32_e64` for the p1/p2 forms, plus a `0x200 <= op < 0x203` dispatch branch before the generic fallback. The existing `0x202` InterpSlot decode is unchanged. Words that set the bitfields LLVM fixes to zero are reported as `<unsupported VOP3 encoding>` records while keeping the 8-byte record length, so the stream stays aligned. - `tests/rdna2_tools_check.py`: 28 golden vectors carrying their `file:line` provenance, refusal cases for the fixed-zero fields, and an `LLVM_LIB`-gated round trip. Existing tests are untouched. ## Tests `python -B tests/rdna2_tools_check.py` -> `Ran 132 tests in 3.963s` / `OK (skipped=16)`. Baseline on the same worktree was `Ran 129` / `OK (skipped=15)`; the extra skip is the new LLVM-gated round-trip test. All 44 upstream goldens decode byte-for-byte to LLVM's printed text.
upstream-sync closed this pull request 2026-11-24 06:47:08 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:47:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:48:00Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b10acb889

ℹ️ 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:6033787509 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233#pullrequestreview-6033787509). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T04:48:00Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `7b10acb889` <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>
tedin7 commented 2026-11-24 06:47:08 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed 7b10acb8 on Linux (Windows build/tests were not run locally).

Diff & edge-case audit

  • tools/disasm_rdna2.py:
    • Routes 0x200 <= op < 0x203 in VOP3 decoding: 0x200 (v_interp_p1_f32_e64) and 0x201 (v_interp_p2_f32_e64) dispatch to _decode_interp_f32_e64, while 0x202 (v_interp_mov_f32_e64) keeps its VOP3_NATIVE_OPS[0x202] InterpSlot (p10/p20/p0) decode.
    • _decode_interp_f32_e64 decodes vdst (v{w0 & 0xff}), attr = w1 & 0x3f, attrchan = (w1 >> 6) & 0x3 (xyzw), src1 ((w1 >> 9) & 0x1ff), abs/neg at index 1 (w0[9], w1[30]), and clamp/omod, while rejecting fixed-zero bits (abs index 0/2, neg index 0/2, w1[8], SRC2 w1[26:18], and INTERP_F16_REFUSED_SOURCES) as <unsupported VOP3 encoding>.
    • tools/scan_unsupported_shaders.py compatibility: test_vop3_interp_f32_e64_golden_vectors verifies is_opcode_recognized and classify_isa_category == "VINTRP (Parameter Interpolation)" for all three mnemonics.
  • tests/rdna2_tools_check.py: adds 28 golden vectors (VOP3_INTERP_F32_E64_VECTORS), 0x203 (v_vop3_203) boundary check, fixed-zero refusal tests, and LLVM round-trip test. All changes are title-neutral.

Linux checks (/root/.local/share/x2w-rev-venv/bin/python -B)

  • Targeted VOP3 interp tests (test_vop3_interp_f32_e64_golden_vectors, test_vop3_interp_f32_e64_fixed_zero_fields_are_refused, test_vop3_interp_f32_e64_llvm_round_trip) with LLVM_MC=/usr/bin/llvm-mc-19 LLVM_OBJCOPY=/usr/bin/llvm-objcopy-19 LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so: 3 passed, 0 failed, 0 skipped (full assemble + disassemble round-trip matched llvm-mc-19 and libLLVM-19.so).
  • Full tests/rdna2_tools_check.py with LLVM_MC=/usr/bin/llvm-mc-19 LLVM_OBJCOPY=/usr/bin/llvm-objcopy-19 LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so: 132 run (126 passed, 3 failed, 3 errors, 0 skipped) — all 6 failures/errors are pre-existing LLVM-19 vs LLVM-15 differences (test_llvm_comparison, test_source_built_records_after_s_endpgm, test_vop1_vop2_dpp_llvm_round_trip).
  • tests/form_coverage_check.py: passed (form coverage checks passed, exit 0)
  • tests/docs_links_check.py: passed (16 Markdown files, 278 links, exit 0)
  • tests/bidi_controls_check.py: passed (exit 0)
  • git diff --check origin/main..HEAD: passed (exit 0)
  • Windows build/tests: not run locally.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033797011 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233#pullrequestreview-6033797011). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:49:23Z. **Review:** COMMENTED --- Reviewed `7b10acb8` on Linux (Windows build/tests were not run locally). ### Diff & edge-case audit - `tools/disasm_rdna2.py`: - Routes `0x200 <= op < 0x203` in VOP3 decoding: `0x200` (`v_interp_p1_f32_e64`) and `0x201` (`v_interp_p2_f32_e64`) dispatch to `_decode_interp_f32_e64`, while `0x202` (`v_interp_mov_f32_e64`) keeps its `VOP3_NATIVE_OPS[0x202]` `InterpSlot` (`p10`/`p20`/`p0`) decode. - `_decode_interp_f32_e64` decodes `vdst` (`v{w0 & 0xff}`), `attr = w1 & 0x3f`, `attrchan = (w1 >> 6) & 0x3` (`xyzw`), `src1` (`(w1 >> 9) & 0x1ff`), `abs`/`neg` at index 1 (`w0[9]`, `w1[30]`), and `clamp`/`omod`, while rejecting fixed-zero bits (`abs` index 0/2, `neg` index 0/2, `w1[8]`, `SRC2` `w1[26:18]`, and `INTERP_F16_REFUSED_SOURCES`) as `<unsupported VOP3 encoding>`. - `tools/scan_unsupported_shaders.py` compatibility: `test_vop3_interp_f32_e64_golden_vectors` verifies `is_opcode_recognized` and `classify_isa_category == "VINTRP (Parameter Interpolation)"` for all three mnemonics. - `tests/rdna2_tools_check.py`: adds 28 golden vectors (`VOP3_INTERP_F32_E64_VECTORS`), `0x203` (`v_vop3_203`) boundary check, fixed-zero refusal tests, and LLVM round-trip test. All changes are title-neutral. ### Linux checks (`/root/.local/share/x2w-rev-venv/bin/python -B`) - Targeted VOP3 interp tests (`test_vop3_interp_f32_e64_golden_vectors`, `test_vop3_interp_f32_e64_fixed_zero_fields_are_refused`, `test_vop3_interp_f32_e64_llvm_round_trip`) with `LLVM_MC=/usr/bin/llvm-mc-19 LLVM_OBJCOPY=/usr/bin/llvm-objcopy-19 LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so`: **3 passed, 0 failed, 0 skipped** (full assemble + disassemble round-trip matched `llvm-mc-19` and `libLLVM-19.so`). - Full `tests/rdna2_tools_check.py` with `LLVM_MC=/usr/bin/llvm-mc-19 LLVM_OBJCOPY=/usr/bin/llvm-objcopy-19 LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so`: **132 run (126 passed, 3 failed, 3 errors, 0 skipped)** — all 6 failures/errors are pre-existing LLVM-19 vs LLVM-15 differences (`test_llvm_comparison`, `test_source_built_records_after_s_endpgm`, `test_vop1_vop2_dpp_llvm_round_trip`). - `tests/form_coverage_check.py`: **passed** (`form coverage checks passed`, exit 0) - `tests/docs_links_check.py`: **passed** (16 Markdown files, 278 links, exit 0) - `tests/bidi_controls_check.py`: **passed** (exit 0) - `git diff --check origin/main..HEAD`: **passed** (exit 0) - Windows build/tests: **not run locally**.
tedin7 commented 2026-11-24 06:47:08 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Retested delta 7b10acb8..ca1c6cd0 (ca1c6cd0) on Linux with LLVM 19 (Windows build/tests were not run locally).

Delta audit (7b10acb8..ca1c6cd0)

  • tools/disasm_rdna2.py: _decode_interp_f32_e64 now refuses any source_code outside 256..511 (not 256 <= source_code <= 511) as <unsupported VOP3 encoding> and removes the INTERP_F16_IMMEDIATES fallback, matching VGPR_32 for SRC1 on gfx10 0x200/0x201.
  • tests/rdna2_tools_check.py: adds test_vop3_interp_f32_e64_non_vgpr_source_is_refused covering refused SRC1 codes (0, 128, 209, 249, 255), accepted VGPR boundaries (256/v0, 258/v2, 511/v255), and unaffected SRC0 attributes (attr0.x, attr31.x, attr32.x).

Linux checks (ca1c6cd0, LLVM 19)

  • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so tests/rdna2_tools_check.py -k interp -v: 12 passed, 0 failed, 1 unrelated error (test_interp_f16_llvm_round_trip via llvm-mc 19 vs LLVM 15 target). All four vop3_interp_f32_e64 tests (test_vop3_interp_f32_e64_golden_vectors, test_vop3_interp_f32_e64_fixed_zero_fields_are_refused, test_vop3_interp_f32_e64_non_vgpr_source_is_refused, test_vop3_interp_f32_e64_llvm_round_trip) passed.
  • Full tests/rdna2_tools_check.py with llvm-mc/llvm-objcopy 19 and libLLVM-19.so: 133 run — 127 passed, 3 failed, 3 errored (all 6 in pre-existing LLVM 15 vs LLVM 19 tests: test_interp_f16_llvm_round_trip, test_llvm_comparison, test_vop1_vop2_dpp_llvm_round_trip, test_source_built_records_after_s_endpgm, plus 2 llvm-mc fixture errors).
  • docs_links_check.py: passed (16 Markdown files, 278 links).
  • bidi_controls_check.py: passed (1038 files).
  • git diff --check 7b10acb8..ca1c6cd0: clean.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033899404 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233#pullrequestreview-6033899404). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:58:40Z. **Review:** COMMENTED --- Retested delta `7b10acb8..ca1c6cd0` (`ca1c6cd0`) on Linux with LLVM 19 (Windows build/tests were not run locally). ### Delta audit (`7b10acb8..ca1c6cd0`) - `tools/disasm_rdna2.py`: `_decode_interp_f32_e64` now refuses any `source_code` outside `256..511` (`not 256 <= source_code <= 511`) as `<unsupported VOP3 encoding>` and removes the `INTERP_F16_IMMEDIATES` fallback, matching `VGPR_32` for `SRC1` on gfx10 `0x200`/`0x201`. - `tests/rdna2_tools_check.py`: adds `test_vop3_interp_f32_e64_non_vgpr_source_is_refused` covering refused `SRC1` codes (`0`, `128`, `209`, `249`, `255`), accepted VGPR boundaries (`256`/`v0`, `258`/`v2`, `511`/`v255`), and unaffected `SRC0` attributes (`attr0.x`, `attr31.x`, `attr32.x`). ### Linux checks (`ca1c6cd0`, LLVM 19) - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so tests/rdna2_tools_check.py -k interp -v`: 12 passed, 0 failed, 1 unrelated error (`test_interp_f16_llvm_round_trip` via `llvm-mc` 19 vs LLVM 15 target). All four `vop3_interp_f32_e64` tests (`test_vop3_interp_f32_e64_golden_vectors`, `test_vop3_interp_f32_e64_fixed_zero_fields_are_refused`, `test_vop3_interp_f32_e64_non_vgpr_source_is_refused`, `test_vop3_interp_f32_e64_llvm_round_trip`) passed. - Full `tests/rdna2_tools_check.py` with `llvm-mc`/`llvm-objcopy` 19 and `libLLVM-19.so`: 133 run — 127 passed, 3 failed, 3 errored (all 6 in pre-existing LLVM 15 vs LLVM 19 tests: `test_interp_f16_llvm_round_trip`, `test_llvm_comparison`, `test_vop1_vop2_dpp_llvm_round_trip`, `test_source_built_records_after_s_endpgm`, plus 2 `llvm-mc` fixture errors). - `docs_links_check.py`: passed (16 Markdown files, 278 links). - `bidi_controls_check.py`: passed (1038 files). - `git diff --check 7b10acb8..ca1c6cd0`: clean.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:21 +00:00 (Migrated from github.com)

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


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-24T04:48:02.975826Z 7b10acb 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:7122301633 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233#issuecomment-7122301633). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T04:44:54Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"7b10acb889a929adbee33f21e4f8bd0665d4c61b","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-24T04:48:02.975826Z">2026-11-24T04:48:02.975826Z</relative-time> | `7b10acb` | 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>
triggered02 commented 2026-11-24 06:50:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T04:53:15Z.


Fixed in ca1c6cd0 - _decode_interp_f32_e64 now refuses non-VGPR data sources.

What was wrong: the gfx10 v_interp_p1_f32_e64 / v_interp_p2_f32_e64 SRC1 data operand is a VGPR_32 (VOPInterp_gfx10), but the decoder only rejected the codes listed in INTERP_F16_REFUSED_SOURCES, so SRC1 below 256 was emitted as an ordinary source: src1=0 decoded as v_interp_p1_f32_e64 v5, s0, attr0.x and src1=128 as v5, /*invalid immediate*/, attr0.x instead of being flagged. LLVM 15's gfx1013 disassembler reports those as an invalid register.

What changed: SRC1 ((w1 >> 9) & 0x1ff) must now be in the VGPR range 256..511; anything outside it keeps its eight-byte record and is reported with the existing refusal convention (<op>_unsupported / <op> <unsupported VOP3 encoding>). The attribute operand in SRC0 and all other refusal checks are unchanged; the now-unreachable inline-immediate branch in this decoder was removed.

Tests: python -B tests/rdna2_tools_check.py -> 133 tests, OK (16 skipped) (was 132 before; one new test added). New test_vop3_interp_f32_e64_non_vgpr_source_is_refused adds refusal cases for SRC1 = 0, 128, 209, 249 and 255 on both p1 and p2, and decode cases for the boundaries 256 = v0 and 511 = v255 plus attr32.x beside a boundary VGPR. All previous cases still pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122427803 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233#issuecomment-7122427803). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T04:53:15Z. --- **Fixed in ca1c6cd0** - `_decode_interp_f32_e64` now refuses non-VGPR data sources. **What was wrong:** the gfx10 `v_interp_p1_f32_e64` / `v_interp_p2_f32_e64` SRC1 data operand is a `VGPR_32` (VOPInterp_gfx10), but the decoder only rejected the codes listed in `INTERP_F16_REFUSED_SOURCES`, so SRC1 below 256 was emitted as an ordinary source: `src1=0` decoded as `v_interp_p1_f32_e64 v5, s0, attr0.x` and `src1=128` as `v5, /*invalid immediate*/, attr0.x` instead of being flagged. LLVM 15's gfx1013 disassembler reports those as an invalid register. **What changed:** SRC1 (`(w1 >> 9) & 0x1ff`) must now be in the VGPR range 256..511; anything outside it keeps its eight-byte record and is reported with the existing refusal convention (`<op>_unsupported` / `<op> <unsupported VOP3 encoding>`). The attribute operand in SRC0 and all other refusal checks are unchanged; the now-unreachable inline-immediate branch in this decoder was removed. **Tests:** `python -B tests/rdna2_tools_check.py` -> **133 tests, OK (16 skipped)** (was 132 before; one new test added). New `test_vop3_interp_f32_e64_non_vgpr_source_is_refused` adds refusal cases for SRC1 = 0, 128, 209, 249 and 255 on both p1 and p2, and decode cases for the boundaries 256 = v0 and 511 = v255 plus attr32.x beside a boundary VGPR. All previous cases still pass.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:48:00Z.

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

@@ -2184,6 +2184,53 @@ def source(code: int, index: int) -> str:
     return (8, name, asm, comment)
 
 
+# VOP3 32-bit interpolation (issue #938). gfx10/gfx1013 encodes v_interp_p1_f32_e64,
+# v_interp_p2_f32_e64 and v_interp_mov_f32_e64 at 0x200, 0x201 and 0x202
+# (LLVM 15 llvm/lib/Target/AMDGPU/VOP3Instructions.td:1045-1047), not at the gfx8/gfx9 opcodes
+# 0x270-0x272 that the VI branch below still handles. The VOP3_INTERP / VOP3_INTERP_MOV operand
+# profiles (VOP3Instructions.td:55-105) print
+# "$vdst, $src0_modifiers, $attr$attrchan$clamp$omod" (the mov form prints its InterpSlot
+# instead of a register), and VOP3Interp_gfx10 (llvm/lib/Target/AMDGPU/VOPInstructions.td:296-312)
+# places attr in SRC0[5:0], attrchan in SRC0[7:6], the data VGPR in SRC1, and fixes SRC0[8] (the
+# f16-only high bit), the SRC2 field and every abs/neg bit except index 1 to zero. The vectors
+# this layout was derived from are VOP3_INTERP_F32_E64_VECTORS in tests/rdna2_tools_check.py.
+INTERP_F32_E64_OPS = {
+    0x200: ("v_interp_p1_f32_e64", "Interpolate f32 attribute, P1 stage (VOP3A)"),
+    0x201: ("v_interp_p2_f32_e64", "Interpolate f32 attribute, P2 stage (VOP3A)"),
+}
+
+
+def _decode_interp_f32_e64(op: int, w0: int, w1: int) -> tuple[int, str, str, str]:
+    """Decode the gfx10/gfx1013 VOP3 spelling of v_interp_p1_f32 or v_interp_p2_f32.
+
+    SRC0 is the attribute operand, so the data source keeps the abs/neg bits of index 1 (w0[9]
+    and w1[30]); the modifier bits of index 0 (the attribute) and index 2 (the operand this
+    profile does not have), the f16-only high bit and the SRC2 field are fixed zero and are
+    reported as an unsupported encoding when set, because LLVM's TableGen decoder only matches
+    the zeroes. The source operand is a VRegSrc_32, decoded exactly as _decode_interp_f16 does.
+    """
+    name, comment = INTERP_F32_E64_OPS[op]
+    attr, attrchan = w1 & 0x3f, (w1 >> 6) & 0x3
+    source_code = (w1 >> 9) & 0x1ff
+    abs_bits, neg_bits = (w0 >> 8) & 0x7, (w1 >> 29) & 0x7
+    if abs_bits & 0x5 or neg_bits & 0x5 or w1 & 0x100 or (w1 >> 18) & 0x1ff \
+            or source_code in INTERP_F16_REFUSED_SOURCES:

P2 Badge Reject non-VGPR interpolation sources

When SRC1 is encoded as a scalar or constant value such as 0, this filter lets it through because it is not in INTERP_F16_REFUSED_SOURCES, and the decoder emits s0 as an ordinary source. The gfx10 forms require a VGPR_32 data operand; LLVM's gfx1013 disassembler marks this encoding as an invalid register, so malformed words are reported as normal interpolation instructions instead of invalid encodings. Restrict source_code to the VGPR range 256..511 before formatting.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4675637494 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1233#discussion_r4675637494). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T04:48:00Z. **Code review location:** `tools/disasm_rdna2.py`; line 2217 ~~~~diff @@ -2184,6 +2184,53 @@ def source(code: int, index: int) -> str: return (8, name, asm, comment) +# VOP3 32-bit interpolation (issue #938). gfx10/gfx1013 encodes v_interp_p1_f32_e64, +# v_interp_p2_f32_e64 and v_interp_mov_f32_e64 at 0x200, 0x201 and 0x202 +# (LLVM 15 llvm/lib/Target/AMDGPU/VOP3Instructions.td:1045-1047), not at the gfx8/gfx9 opcodes +# 0x270-0x272 that the VI branch below still handles. The VOP3_INTERP / VOP3_INTERP_MOV operand +# profiles (VOP3Instructions.td:55-105) print +# "$vdst, $src0_modifiers, $attr$attrchan$clamp$omod" (the mov form prints its InterpSlot +# instead of a register), and VOP3Interp_gfx10 (llvm/lib/Target/AMDGPU/VOPInstructions.td:296-312) +# places attr in SRC0[5:0], attrchan in SRC0[7:6], the data VGPR in SRC1, and fixes SRC0[8] (the +# f16-only high bit), the SRC2 field and every abs/neg bit except index 1 to zero. The vectors +# this layout was derived from are VOP3_INTERP_F32_E64_VECTORS in tests/rdna2_tools_check.py. +INTERP_F32_E64_OPS = { + 0x200: ("v_interp_p1_f32_e64", "Interpolate f32 attribute, P1 stage (VOP3A)"), + 0x201: ("v_interp_p2_f32_e64", "Interpolate f32 attribute, P2 stage (VOP3A)"), +} + + +def _decode_interp_f32_e64(op: int, w0: int, w1: int) -> tuple[int, str, str, str]: + """Decode the gfx10/gfx1013 VOP3 spelling of v_interp_p1_f32 or v_interp_p2_f32. + + SRC0 is the attribute operand, so the data source keeps the abs/neg bits of index 1 (w0[9] + and w1[30]); the modifier bits of index 0 (the attribute) and index 2 (the operand this + profile does not have), the f16-only high bit and the SRC2 field are fixed zero and are + reported as an unsupported encoding when set, because LLVM's TableGen decoder only matches + the zeroes. The source operand is a VRegSrc_32, decoded exactly as _decode_interp_f16 does. + """ + name, comment = INTERP_F32_E64_OPS[op] + attr, attrchan = w1 & 0x3f, (w1 >> 6) & 0x3 + source_code = (w1 >> 9) & 0x1ff + abs_bits, neg_bits = (w0 >> 8) & 0x7, (w1 >> 29) & 0x7 + if abs_bits & 0x5 or neg_bits & 0x5 or w1 & 0x100 or (w1 >> 18) & 0x1ff \ + or source_code in INTERP_F16_REFUSED_SOURCES: ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Reject non-VGPR interpolation sources** When `SRC1` is encoded as a scalar or constant value such as `0`, this filter lets it through because it is not in `INTERP_F16_REFUSED_SOURCES`, and the decoder emits `s0` as an ordinary source. The gfx10 forms require a `VGPR_32` data operand; LLVM's gfx1013 disassembler marks this encoding as an invalid register, so malformed words are reported as normal interpolation instructions instead of invalid encodings. Restrict `source_code` to the VGPR range `256..511` before formatting. 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!1226
No description provided.