tooling: decode gfx10 VOP3 interp e64 at 0x200-0x202 #1226
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1233"
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 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.pyhandled VOP3 interpolation only at0x270 <= op < 0x274. On gfx10/gfx1013 the e64 forms live at0x200/0x201/0x202(LLVM 15.0.7llvm/lib/Target/AMDGPU/VOP3Instructions.td:1045-1047), so they fell through to thev_vop3_200/v_vop3_201placeholders and the attribute operand was rendered as a source register.LLVM golden vector from
llvm/test/MC/AMDGPU/gfx10_asm_vop3.s:13065, encoding05 00 00 d6 00 04 02 00:opcode='v_vop3_200',asm='v_vop3_200 v5, s0, v2, s0'opcode='v_interp_p1_f32_e64',asm='v_interp_p1_f32_e64 v5, v2, attr0.x'Provenance / field layout
VOP3Instructions.td:1045-1047(VOP3Interp_Real_gfx10<0x200/0x201/0x202>).VOP3_INTERP/VOP3_INTERP_MOVprofiles atVOP3Instructions.td:55-105—$vdst, $src0_modifiers, $attr$attrchan$clamp$omod(the mov form's second operand is theInterpSlotp10/p20/p0, not a register).VOP3Interp_gfx10atVOPInstructions.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-onlyhighbit), the SRC2 field and all other modifier bits fixed zero.v_interp_p1/p2/mov_f32_e64vectors ingfx10_asm_vop3.s:13065-13195before the decoder was written.The gfx8/gfx9 branch at
0x270-0x272is retained with a clarifying comment rather than gated: LLVM defines it asVOP3Interp_Real_viunderAssemblerPredicate = 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: newINTERP_F32_E64_OPStable and_decode_interp_f32_e64for the p1/p2 forms, plus a0x200 <= op < 0x203dispatch branch before the generic fallback. The existing0x202InterpSlot 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 theirfile:lineprovenance, refusal cases for the fixed-zero fields, and anLLVM_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 wasRan 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.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
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-24T04:49:23Z.
Review: COMMENTED
Reviewed
7b10acb8on Linux (Windows build/tests were not run locally).Diff & edge-case audit
tools/disasm_rdna2.py:0x200 <= op < 0x203in VOP3 decoding:0x200(v_interp_p1_f32_e64) and0x201(v_interp_p2_f32_e64) dispatch to_decode_interp_f32_e64, while0x202(v_interp_mov_f32_e64) keeps itsVOP3_NATIVE_OPS[0x202]InterpSlot(p10/p20/p0) decode._decode_interp_f32_e64decodesvdst(v{w0 & 0xff}),attr = w1 & 0x3f,attrchan = (w1 >> 6) & 0x3(xyzw),src1((w1 >> 9) & 0x1ff),abs/negat index 1 (w0[9],w1[30]), andclamp/omod, while rejecting fixed-zero bits (absindex 0/2,negindex 0/2,w1[8],SRC2w1[26:18], andINTERP_F16_REFUSED_SOURCES) as<unsupported VOP3 encoding>.tools/scan_unsupported_shaders.pycompatibility:test_vop3_interp_f32_e64_golden_vectorsverifiesis_opcode_recognizedandclassify_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)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) withLLVM_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 matchedllvm-mc-19andlibLLVM-19.so).tests/rdna2_tools_check.pywithLLVM_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)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_e64now refuses anysource_codeoutside256..511(not 256 <= source_code <= 511) as<unsupported VOP3 encoding>and removes theINTERP_F16_IMMEDIATESfallback, matchingVGPR_32forSRC1on gfx100x200/0x201.tests/rdna2_tools_check.py: addstest_vop3_interp_f32_e64_non_vgpr_source_is_refusedcovering refusedSRC1codes (0,128,209,249,255), accepted VGPR boundaries (256/v0,258/v2,511/v255), and unaffectedSRC0attributes (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_tripviallvm-mc19 vs LLVM 15 target). All fourvop3_interp_f32_e64tests (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.tests/rdna2_tools_check.pywithllvm-mc/llvm-objcopy19 andlibLLVM-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 2llvm-mcfixture errors).docs_links_check.py: passed (16 Markdown files, 278 links).bidi_controls_check.py: passed (1038 files).git diff --check 7b10acb8..ca1c6cd0: clean.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.
7b10acbℹ️ 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 triggered02 on 2026-11-24T04:53:15Z.
Fixed in
ca1c6cd0-_decode_interp_f32_e64now refuses non-VGPR data sources.What was wrong: the gfx10
v_interp_p1_f32_e64/v_interp_p2_f32_e64SRC1 data operand is aVGPR_32(VOPInterp_gfx10), but the decoder only rejected the codes listed inINTERP_F16_REFUSED_SOURCES, so SRC1 below 256 was emitted as an ordinary source:src1=0decoded asv_interp_p1_f32_e64 v5, s0, attr0.xandsrc1=128asv5, /*invalid immediate*/, attr0.xinstead 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). Newtest_vop3_interp_f32_e64_non_vgpr_source_is_refusedadds 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.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 2217When
SRC1is encoded as a scalar or constant value such as0, this filter lets it through because it is not inINTERP_F16_REFUSED_SOURCES, and the decoder emitss0as an ordinary source. The gfx10 forms require aVGPR_32data 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. Restrictsource_codeto the VGPR range256..511before formatting.Useful? React with 👍 / 👎.