mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #633] [MERGED] rdna2_decode: align MIMG addr, atomic TFE/cmpswap, and r128 widths with LLVM (DECODE-MIMG-PARITY) #674
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#674
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/633
Author: @jarvixaiassistant-glitch
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:fix/decode-mimg-llvm-parity📝 Commits (1)
450cd81rdna2_decode: align MIMG addr, atomic TFE/cmpswap, and r128 widths with LLVM📊 Changes
2 files changed (+109 additions, -44 deletions)
View changed files
📝
tests/test_rdna2_decode.py(+72 -0)📝
tools/rdna2_decode.py(+37 -44)📄 Description
Claimed in the coordination issue as: DECODE-MIMG-PARITY
What and why
Fixes 72 MIMG disassembly mismatches in the pure-Python RDNA2 decoder (
tools/rdna2_decode.py) uncovered by cross-checking against all 291image_*test vectors in upstream LLVM's official GFX10/GFX1030 disassembler suites (gfx10_mimg.txt,gfx10_mimg_features.txt,gfx1030_new.txt) andAMDGPU::getAddrSizeMIMGOp(llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp):_mimg_addr_count()— matches LLVMAMDGPU::getAddrSizeMIMGOpon GFX10:image_bvh_intersect_ray/image_bvh64_intersect_ray: return8/9VGPRs whena16=True(previously always11/12).image_msaa_load: no longer falsely matches"_l"inside"_load", removing a spurious+1address VGPR (and spurious trailingv0in NSA lists).image_load_mip_pck,image_load_mip_pck_sgn,image_store_mip_pck,*_mip_pck2/4,*_mip_by2/4: include the mip VGPR (previously only exactimage_load_mip/image_store_mipmatched).image_load_by2/by4/image_store_by2/by4: no longer falsely match"_b"as bias.image_sample_*cd*(all 16 coarse-derivative opcodes): tokenize underscore-delimited suffixes (parts = set(name.split("_")[2:])) so"cd"is counted as derivatives instead of falsely triggering z-compare"c"and dropping all derivative VGPRs.image_sample_*_g16(all 16 G16 opcodes): recognize"cl"and"o"before"g16", and pack 16-bit gradients asalignTo<2>(grad_coords)((grad_coords + 1) & ~1:2 / 2 / 4VGPRs for 1D / 2D / 3D instead of2 / 4 / 6).image_get_lod: respectsa16coordinate packing.a16packing: computes(coords + has_lod_or_cl_or_mip + 1) // 2(LLVMdivideCeil(AddrComponents, 2)) instead of(coords + 1) // 2 + extra, fixing 1D/3D/2D-array/cube +lod/cl/mipovercounts by 1 VGPR._mimg_data_count()— atomictfeandcmpswapdmask:0x1:+ (1 if tfe else 0)onimage_atomic_*instead of returning early before TFE (fixing all 26image_atomic_* ... tfevectors ingfx10_mimg_features.txt).image_atomic_cmpswap/image_atomic_fcmpswapreturn2VGPRs fordmask:0x1(and0x3) and4fordmask:0xf, matching LLVM (which has no 1-VGPRcmpswapvariant).r128resource width (rsrc_w):4SGPRs (SReg_128_XNULL) only forimage_bvh*_intersect_rayand8SGPRs (SReg_256_XNULL) for all non-BVH MIMG instructions even whenr128is set, matchingMIMGInstructions.tdandgfx10_mimg.txt.Adds
test_mimg_addr_data_and_rsrc_widths_match_llvmintests/test_rdna2_decode.pycovering all fixed categories with hand-encoded GFX10/GFX1030 words (zero game data), round-trip checked through bothdecode_bytes()anddisasm_bytes()→shader_ir.parse_line().Tested
All synthetic CPU/stdlib/docs/CI checks on Windows 11 x64, Python 3.12.14, Node v24.19.0 (no game files, no
llvm-mcinstalled locally):python -I tests/test_rdna2_decode.py -v— 20/20 passed (1 skipped:llvm-mcnot installed)gfx1030_new.txt: 12/12 PASS (was 5/12, 7 mismatches)gfx10_mimg.txt: 253/253 PASS (was 214/253, 39 mismatches)gfx10_mimg_features.txt: 26/26 PASS (was 0/26, 26 mismatches)python -I tests/test_ci_registration.py— 15/15 passedpython -I tests/test_runtime_paths.py— 5/5 passedpython -I scripts/check_no_game_data.py— passed (0 forbidden tracked extensions)python -m compileall -q make_game.py tools tests— passedpython -I tests/test_text_write_line_endings.py,tests/test_report_paths.py,tests/test_i18n_index.py, and alltests/test_docs_*.py— passednode --test tests/test_viewer_streaming.cjs— passedGPUs tested: n/a (pure-Python ISA binary decoder / unit tests only)
AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek V4 Flash + NVIDIA NIM Nemotron-3.5-Lightning & Nemotron-3-Ultra-550B)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (N/A — binary ISA decoder parity with LLVMllvm-mconly; no SPIR-V shader-translator rule changed.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.