Repository navigation
test_rdna2_decode: check the decoder's bytes against the assembled ones (parity fails on main with LLVM 21 and 23) - #4867
Conversation
The llvm-mc parity test failed on main with both LLVMs here although the decoder was right: - llvm-mc 21.1.8 re-encodes `v_cvt_f16_u16_sdwa v5, 1.0` (ps_sdwa_f16_const) when disassembling it, printing ff...003c0000 and "15360" for the inline f2...; the test compared against that. The decoder's bytes are now checked against the assembled bytes, and operands only where llvm-mc's printed encoding round-trips (at most a handful may not). - llvm-mc 23.1.6 prints exp's null target as the null register; the decoder names it a target, as LLVM 21 does. Both spellings compare as one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kacper-serewis
left a comment
There was a problem hiding this comment.
Independent synthetic comparison at 8d43709 and #2811 3b47b72 including #2786. Both parity loops passed on LLVM 21.1.8 and 23.1.6. On LLVM 21 both catch an opcode mutation, but changing the decoded SDWA source from 1.0 to 2.0 passed this PR’s parity loop and failed the stack’s operand comparison. The dedicated SDWA test does cover this literal. The parity loops conflict on integration; retain the stack’s operand/modifier checks when LLVM re-encodes. AI-assisted CPU only.
|
Tested on Windows 11 / Python 3.12.10 at head
Code read: AI-assisted review (Gemini 4 Neon). |
|
PASS (review only; the parity test itself was skipped here).
One nit: there is no AI-assisted review, no game files, no GPU. |
Item: new TEST item, claimed in #4816 (#4816 (comment)).
tests/test_rdna2_decode.py::test_parity_with_llvm_mc_on_shader_fixturesfails onmainwith both llvm-mc versions I have, whiletools/rdna2_decode.pydecodes the bytes correctly both times. The test assembles each fixture, disassembles the bytes with llvm-mc and compares the decoder to that listing:%USERPROFILE%\.leonida\llvm-mc): disassemblingv_cvt_f16_u16_sdwa v5, 1.0 ... src0_sel:WORD_1(ps_sdwa_f16_const), it prints the re-encodingff148500 003c0000and the operand15360, where the assembled bytes aref2148500and the decoder says1.0. Fix: the decoder's bytes are checked against the assembled bytes; operands are compared only where llvm-mc's printed encoding round-trips, with an upper bound (fewer than 5 per run) so the comparison keeps meaning something.exp'snulltarget as the null register (special), the decoder as atarget, as LLVM 21 does (ps_w64_a_discard). Both spellings now compare as one.Test-only; the decoder is unchanged.
Tested
Windows 11, Python 3.12:
LLVM_MCf9a00a7ef2148500!=f9a00a7eff148500003c0000)target/specialnull)No game files. AI-assisted (Claude Code).
🤖 Generated with Claude Code