mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:50:53 +01:00
[PR #1959] rdna2_decode: decode GFX10 special sources 235..239 and f64 32-bit literals (DECODE-F64-LIT-AND-SPECIAL-SRCS) #1966
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#1966
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/1959
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/decode-f64-lit-and-special-srcs📝 Commits (1)
d8db285rdna2_decode: decode GFX10 special sources 235..239 and f64 32-bit literals📊 Changes
2 files changed (+194 additions, -19 deletions)
View changed files
📝
tests/test_rdna2_decode.py(+162 -0)📝
tools/rdna2_decode.py(+32 -19)📄 Description
Claimed in #1608 as
DECODE-F64-LIT-AND-SPECIAL-SRCS.What and why
Two bugs in the pure-Python RDNA2 binary decoder (
tools/rdna2_decode.py) broke parity withshader_ir.parse_line()and miscompiled or rejected instructions fed intotools/rdna2spirv.py:235..239decoded asraw(src_235..src_239):235..239assrc_shared_base,src_shared_limit,src_private_base,src_private_limit, andsrc_pops_exiting_wave_id(all already listed inshader_ir.SPECIAL)._src()only handled251..254, so POPS pixel shaders usingsrc_pops_exiting_wave_id(239, handled intools/rdna2spirv.py:531) decoded as{"k": "raw", "t": "src_239"}and failed translation withUnsupported: operand src_239.f64) 32-bit literal sources (code == 255) lost theirf64_literaltag and hex formatting:tools/rdna2_isa_tables.pyalready marks binary64 source operands with type'f64'acrossVOP1,VOPC, andVOP3(while keeping non-f64 operands such asv_ldexp_f64SRC1,v_cmp_class_f64SRC1, andv_cvt_f64_i32SRC0typed'i')._src(255, ...)returned plain{"k": "imm", "v": lit}withoutf64_literal: True/literal_hex_digits, so directdecode_bytes()input intordna2spirv.f64_source_words()placed a 32-bit literal such as0x40180000(6.0) in bits[31:0]instead of bits[63:32]._format_operand(), values< 100(such as0x0,0x1,0x40) formatted in decimal (1) instead of hex (0x1), erasing the distinction between a trailing 32-bit literal ((0, 1)) and an inline integer ((1, 0)) whendisasm_bytes()output is parsed byshader_ir.parse_line().Changes
tools/rdna2_decode.py:_SPECIAL_SRCSmapping codes235..239and251..254to theirshader_irspecial operand names.f64=(typ == "f64")from theVOP1,VOPC, andVOP3decode paths into_src(), settingf64_literal: Trueandliteral_hex_digits: len(f"{val:x}")oncode == 255literals for'f64'sources._format_operand()to formatf64_literalimmediates in hex (0x...) regardless of magnitude sodisasm_bytes()->shader_ir.parse_line()round-trips bit-identically withdecode_bytes().tests/test_rdna2_decode.py:test_gfx10_special_source_operands_235_to_239(SOP1/VOP1/VOP3 decode +disasm_bytesround-trip + end-to-end POPS pixel shader translation &spirv_asm.assemblecheck for both text and directdecode_bytespaths).test_f64_literal_sources_decode_format_and_translate(VOP1/VOPC/VOP3 decode + small< 100hex formatting + VOP3neg/absmodifiers + negative controls for non-f64operands + end-to-endrdna2spirv+spirv_mini_interpexecution ofv_frexp_exp_i32_f64_e32andv_frexp_mant_f64_e32via bothdisasm_bytesand directdecode_bytes).Verification
spirv_mini_interp; no GPU, LLVM, or SPIRV-Tools installed locally).python -I tests/test_rdna2_decode.py -v(21 passed, 1 skippedllvm-mc not available)python -I tests/test_shader_ir_parse.pypython -m unittest discover -s tests/semantic -p test_library_compute_forms.pypython -m unittest discover -s tests/semantic -p test_vop3_const_mods.pypython -I tests/test_text_write_line_endings.pypython -m compileall -q tools/rdna2_decode.py tests/test_rdna2_decode.pypython -I scripts/check_no_game_data.py tools/rdna2_decode.py tests/test_rdna2_decode.pygit diff --checkorigin/main(tools/rdna2_decode.pyat9e7720c): both new test methods fail onorigin/main(13 subtest/assertion failures +Unsupported: operand src_239on POPS translation, and wrongv_frexp_*_f64outputs on bothdisasm_bytes0x1and directdecode_bytes0x40180000).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.