tooling: decode the VOP3 binary16 interpolation forms in disasm_rdna2 #963
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/970"
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 MasterDomino on 2026-11-23T19:15:45Z.
Change
Step 2 of #938, scoped as claimed there:
tools/disasm_rdna2.pydecodes the VOP3 binary16 interpolation formsv_interp_p1ll_f16,v_interp_p1lv_f16andv_interp_p2_f16(opcodes 0x342, 0x343, 0x35a) as LLVM 15 prints them for gfx1013. Before, they printed asv_vop3_342/v_vop3_343/v_vop3_35awith three register operands, sotools/scan_unsupported_shaders.pyreported them as unrecognized opcodes in the VALU category.Encoding. These are the encodings LLVM 15.0.7 produces for gfx1013, checked field by field with
llvm-mc.SRC0holds the attribute (bits 5:0), the channelxyzw(bits 7:6) and the high-half select (bit 8, printedhigh).SRC1and, forp1lv/p2,SRC2are the data sources, with the usualabs/negbits.clampand the output modifier (mul:2,mul:4,div:2) follow.vdst, src1, attrN.c[, src2][ high][ clamp][ omod].Encodings LLVM 15 refuses keep their eight-byte record and decode as
<name>_unsupported/<name> <unsupported VOP3 encoding>, asv_readfirstlane_b32's VOP3A word already does:absornegbit on the attribute operand;p1llthird source or its modifier bits;p2;op_selbits are ignored, as LLVM ignores them.Inline-constant sources. LLVM 15 accepts them but prints
/*invalid immediate*/, with a lone negation asneg(/*invalid immediate*/). The decoder prints the same text, so its output stays identical to LLVM's.Not in this PR:
s_endpgmwork from #951/#956;image_atomic_*,v_add_co_ci_u32_e32);v_interp_*_f32_e64forms;pixel_aotdoes not lower (#711/#713).Refs #938
Verification
Upstream
mainat6f111ed, Fedora 45 x86_64, Python 3.15.2, LLVM 15.0.7.With LLVM, the suite exits
OK. Without it,OKwith the LLVM-gated tests skipped. The 26 platform-independent checks,tests/pixel_aot_check.py binaryandtests/form_coverage_check.pyalso exit 0.New tests:
test_interp_f16_uses_llvm_spelling(pure Python).high,clamp, each output modifier,abs/neg/-|x|, SGPR and special-register sources, attributes 0-63, and both inline-constant spellings._unsupportedwith the followings_endpgmstill at offset 8. Every vector was checked againstpixel_aot.disassemble.test_interp_f16_llvm_round_trip(LLVM 15).high, SGPR source, swapped sources, modifiers,clamp, output modifier), so a dropped or swapped field changes the bytes.test_binary_scan_recognizes_decoded_interp_f16(pure Python, source-built scan case).scan_directory_or_filesruns on a.binof llvm-mc output.opcode_recognized_translator_rejected, with nov_vop3_*names.Negative control. With
tools/disasm_rdna2.pyreverted to6f111ed:FAILED (failures=15). That is 13 spelling subtests, the round trip and the scan case. Restoring the change passes all of them.Exhaustive comparison (local, not part of the suite) against LLVM 15's
LLVMDisasmInstructionfor gfx1013, 77,920 encodings of the three opcodes:abs/negcombination;highvalue;abs×neg× output-modifier ×clamp×highgrid with and withoutop_selbits;Results: 17,561 decode to exactly LLVM's text, LLVM and the decoder both refuse the other 60,359, and none differ.
Evidence and follow-up
Effect on one local input (the 12,101 PS records from #932; aggregates only), using
tools/scan_unsupported_shaders.py:v_vop3_342/343/35aThe per-record compatibility categories don't change. Those records still contain other misdecoded instructions, which are step 3 of #938.
Checklist
AI-assisted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B48PpcRN2Er51keRf2DsS5