Repository navigation
RDNA2 decoder: correct FMA modifiers, image atomics and target-specific legacy MAD - #2786
kacper-serewis wants to merge 17 commits into
Conversation
…negatives as decimal Addresses review feedback on PR ItsNotRexed#2038 (@borislisandro): - Sign-extend SOPP branch simm16 offsets with _s16(simm16) so backward branches decode as negative integers (e.g. -4, -20) matching shader_ir/llvm-mc 21/22 instead of 0xfffc. - Format negative immediates (< 0) as decimal rather than broken '0x-...' hex. - Clarify module docstring (shader_ir-compatible .s text) and update unit tests (normalizing SOPP branch immediates mod 16-bit for LLVM 18 vs 21/22 parity).
|
Independent decoder modifier matrix ( Synthetic inputs only. AI-assisted (Codex). |
# Conflicts: # tools/shader_disasm.py
0809672 to
1e3c6a8
Compare
…-mc -disassemble fails to round-trip SDWA float inline constants
kacper-serewis
left a comment
There was a problem hiding this comment.
BUILD-784 / BUILD-806. Depends on: #2038. AI-assisted integration e74cef0 includes prerequisite a8c1473. LLVM 21.1.8 synthetic comparisons matched 192/192 mixed FMA, 50/50 sampler+SLC, 8/8 atomic and 5/5 target-dependent legacy cases. The three targeted suites passed 13/13, 20/20 and 24/24. Across 26,503 cached listings all 987,873 targeted instruction occurrences matched the LLVM encoding, opcode, ordered operands and modifiers. Full-stream PC alignment was outside this check. CPU only.
Depends on: #2038
BUILD-784 and BUILD-806. Current coordination claim. Integration parent
402ef8cecombines main4c52ce27with #2038998128ec. Compare402ef8ceto tested head2e594cf1for the four fixes.Each mixed-precision FMA source carries its own negate/absolute flags. MIMG SLC comes from the first instruction word, independently of the sampler index. Both corrections have hand-written synthetic regression tests.
CPU-only full retail differential on the earlier #2038 base
c329207f: 26,503 listings, 44,398,977 instructions at matching PCs. The two changes removed 59,094 and 36,610 exact opcode/operand/modifier disagreements respectively. Counts describe agreement with LLVM 21.1.8 listings, not GPU execution.Independent synthetic LLVM 21.1.8 comparisons on Windows, integration parent
402ef8ce→ PR head2e594cf1. Across the three mixed FMA opcodes and all 64 source sign/absolute combinations per opcode, exact matches rose from 3/192 to 192/192. Sampling with 25 sampler indices crossed with both SLC states rose from 25/50 to 50/50, atomic width and GLC from 4/8 to 8/8, and target-specific legacy MAD/FMA from 1/5 to 5/5.On the tested head, 12 of 13 decoder tests passed. Fixture parity stopped at
ps_sdwa_f16_const.asmon both heads. LLVM prints a 12-byte literal encoding for the 8-byte SDWA inline constant. The dependency’s dedicated inline-constant operand test passed. Shader disassembly (19), stage resume (44), rdna2spirv decode (24), startup (2), text line endings (3), docs links (6), mixed-FMA semantics (15), printed encodings (7), and compileall passed. AI-assisted Windows CPU validation. No GPU, driver or game files used for this update. Corpus comparisons below are historical.Historical validation on
08096726: MIMG atomic VDATA width now follows dmask (all 2,485 image_atomic_umax occurrences agree with LLVM, including 954 previously wrong), and legacy MAD versus FMA follows the selected GPU target (24,765 corrected mnemonics in 6,059 listings). These are CPU comparisons.On the previous stack, 4da8851 to 0809672, exact opcode, ordered operand and modifier matches rose from 43,886,911 to 44,008,334 across 44,398,977 equal-PC pairs in 26,503 listings. The 121,423 gains comprise 59,094 mixed-FMA corrections, 36,610 MIMG SLC corrections, 954 atomic register-width corrections and 24,765 target-specific MAD/FMA selections. All 523,693 mixed-FMA instructions matched LLVM on fields, PC and encoded bytes. The full metric compares parsed fields at equal PCs. Both revisions had 1,313 equal-PC pairs with differing encoded bytes outside mixed FMA. Both reached the expected end of every listing. The run loaded verified Git blobs from separate directories. AI-assisted Windows CPU comparison with cached LLVM 21.1.8 listings.