tooling: decode the VOP1 rounding, frexp and operand-free opcodes in disasm_rdna2 #1654
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1661"
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 vladbondarenko97 on 2026-11-24T16:40:50Z.
Change
Eleven VOP1 opcodes (0x17-0x1b, 0x3c-0x41) printed as
v_vop1_NNin the e32 and VOP3 spellings:v_trunc_f64,v_ceil_f64,v_rndne_f64,v_floor_f64,v_fract_f64,v_frexp_exp_i32_f64,v_frexp_mant_f64,v_frexp_exp_i32_f32,v_frexp_mant_f32,v_pipeflush,v_clrexcp. They now decode as llvm-mc prints them for gfx1013. The binary64 and operand-free forms have no SDWA or DPP spelling and stay eight-byte refusals;v_pipeflushandv_clrexcpprint bare and take no literal. The scanner recognizes the three names it did not know. Decoding and recognition only. Follows #1593 (v_frexp_exp_i32_f64uses its one-register result). Refs #938.Verification
Commit
1ca92d57on mainc864f138, macOS, Python 3.14.python -B tests/rdna2_tools_check.py: Ran 147, OK (skipped=18).tools/without this commit: decode test FAILED (failures=23), scan test FAILED (failures=1).v_rcp_f64/v_rsq_f64/v_sqrt_f64already have.Not run: the Windows ctest, and LLVM 15 (the new tests are golden strings and need no LLVM).
Evidence and follow-up
No lowering, no readback. The decoder does not check that VDST is zero for
v_pipeflush/v_clrexcp(llvm-mc refuses a non-zero VDST;v_nophas the same gap). Stillv_vop1_NN: the f16 transcendentals 0x54-0x5a, 0x60, 0x61 (#938 shows an earlier f16 claim, so I left them). Fixtures are hand-assembled words and llvm-mc output, no game data.Checklist
AI use: Claude Code. Claude Sonnet 5.5 wrote the change, the tests and the llvm-mc sweep; Claude Opus 5.5 rebased it, reran the suite and reviewed the diff. I reviewed it.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:47:24Z.
Review: COMMENTED
Peer review at
head_sha:1ca92d57f04e2d6c20f3e457d39eff5d108a5900Findings
No defects found.
tools/disasm_rdna2.py: adds the 11 VOP1 opcodes (0x17..0x1b,0x3c..0x41), handlesVOP1_NO_OPERAND_OPS(v_pipeflush,v_clrexcp) in both_e32(4-byte, no literal dword even withSRC0=255) and_e64(8-byte, 0-arity), and addsv_frexp_exp_i32_f64tonarrow_dstso its destination is a single VGPR.tools/scan_unsupported_shaders.py: addsv_pipeflush,v_clrexcp, andv_frexp_exp_i32_f32toKNOWN_RDNA2_BASE_OPCODESfor recognition.tests/rdna2_tools_check.py,docs/experiments.md: comprehensive unit tests covering_e32,_e64, SDWA/DPP forms and refusals, and scanner recognition; 100% title-neutral.Verification
python3 -B tests/rdna2_tools_check.py: 147 tests ran, OK (skipped=18) (2.839s, exit 0).if op_name in VOP1_NO_OPERAND_OPS:withif False:intools/disasm_rdna2.pyand ranpython3 -B tests/rdna2_tools_check.py— failed as expected (5failures intest_vop1_rounding_frexp_and_no_operand_opcodes, exit 1); restored cleanly (git status --shortclean).--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6(10.33s);ctest --preset dev -R '^rdna2_tools_check$' --parallel 4 --no-tests=error --output-on-failure: 1/1 passed (5.31s)./O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6(8.03s);ctest --preset release -R '^rdna2_tools_check$' --parallel 4 --no-tests=error --output-on-failure: 1/1 passed (5.25s).AI-assisted; commands listed were executed locally.
upstream-sync referenced this pull request2026-11-24 18:02:49 +00:00
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T17:29:58Z.
Ran this at
1ca92d57. The decoder changes hold up against the unit expectations, but the strongest check in this suite is not running here, and for a table of opcode names that matters.Mutation evidence that the new entries are exercised
I removed or changed three things the patch adds, and restored the file each time:
v_clrexcpdropped fromVOP1_NO_OPERAND_OPS0x3frenamed fromv_frexp_exp_i32_f32_e32tov_frexp_mant_f32_e32So the table is not dead weight: a wrong name, a wrong membership or a wrong instruction width each fails the suite.
What is not running, and why I am raising it
All 18 skips are the same kind:
That is exactly the mechanism that would independently confirm the names in this patch —
v_frexp_exp_i32_f32_e32versusv_frexp_mant_f32_e32is a claim about what LLVM prints, and withLLVM_LIBunset nothing here compares against LLVM. My mutant caught the swap only because the expected string in the test is hand-written from the same source as the table, which is correlation, not confirmation.Two questions, both cheap to answer in the PR body:
llvm-mc/llvm-objdumprun with gfx1013 support? If so, a line with the version and the two printed mnemonics (v_frexp_exp_i32_f32_e32,v_frexp_mant_f32_e32) would make the claim checkable for everyone else.v_pipeflushandv_clrexcp(the 4-versus-8 distinction, which the no-operand path decides) taken from LLVM or from the ISA table? The patch asserts LLVM prints the bare mnemonic and takes no literal dword "even when SRC0 is 255" — that is a specific behaviour worth citing where it was observed.Neither blocks the change. If the comparison was done outside CI, recording it in the PR body is all I would ask; otherwise a reader has to take the mnemonics on trust, which is the one thing this repository is careful about everywhere else.
Otherwise
docs/experiments.mdand the two tools move together, and the scanner picks up the new no-operand classification. Nothing else stood out.Verdict
Reviewed
1ca92d57. Decoding is exercised by the suite (three mutations caught); the LLVM cross-check for the new names is skipped in this environment and should be recorded explicitly.