mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1525] rdna2_decode: decode 16-bit integer inline constants 240..248 as binary16 hex (DECODE-VOP16-INT-INLINE) #1553
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#1553
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/1525
Author: @jarvixaiassistant-glitch
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/decode-vop16-int-inline📝 Commits (1)
bf0ba2frdna2_decode: decode 16-bit integer inline constants 240..248 as binary16 hex (DECODE-VOP16-INT-INLINE)📊 Changes
2 files changed (+172 additions, -7 deletions)
View changed files
📝
tests/test_rdna2_decode.py(+102 -0)📝
tools/rdna2_decode.py(+70 -7)📄 Description
Claimed in the coordination issue as: DECODE-VOP16-INT-INLINE
What and why
On RDNA2, inline constant codes
240..248(0.5,-0.5,1.0,-1.0,2.0,-2.0,4.0,-4.0,1/(2*pi)) on scalar 16-bit integer operands (LLVMOPERAND_REG_IMM_INT16/OPERAND_REG_INLINE_C_INT16) deliver the 16-bit binary16 bit patterns (0x3800,0xB800,0x3C00,0xBC00,0x4000,0xC000,0x4400,0xC400,0x3118), which LLVM prints as hex integer immediates rather than float literals.Previously
tools/rdna2_decode.py:_src()unconditionally emitted{k: fimm, ...}for codes240..248even on 16-bit integer VOP1/VOPC/VOP3 instructions, causing 126 mismatches against LLVM 21.1.8's GFX10 disassembler test vectors and producing wrong 32-bit float bit patterns if translated through--backend python.This PR:
_INLINE_INT16,_INT16_ALL_SRCS,_INT16_SRC01_ONLY, and_src_is_int16(name, src_idx)intools/rdna2_decode.py, emitting{k: imm, v: _INLINE_INT16[code]}on 16-bit integer VOP1/VOPC/VOP3 sources while carefully preserving:v_mad_i32_i16/v_mad_u32_u16SRC2(32-bit, staysfimm).v_sat_pk_u8_i16and VOP3PV2INT16operands.SDWA16-bit ops (ps_sdwa_f16_const.asm), which take 32-bit float bits on RDNA2 and remainfimm.rdna2_decode -> rdna2spirv -> spirv_mini_interptest intests/test_rdna2_decode.py.Tested
All synthetic CPU/stdlib/docs/CI checks on Windows 11 x64, Python 3.12.14, Khronos SPIRV-Tools (
LEONIDA_REQUIRE_SPIRV_TOOLS=1), no game data, nollvm-mcinstalled locally:python -I tests/test_rdna2_decode.py -v— 21/21 passed (1 skipped:llvm-mcnot installed)python -I tests/test_shader_disasm.py— 31/31 passedpython -I tests/test_ci_registration.py— 16/16 passedpython -I scripts/check_no_game_data.py— passedpython -m compileall -q tools/rdna2_decode.py tests/test_rdna2_decode.py— passedgfx10_vopc.txt1,438/1,438 exact)GPUs tested: n/a (pure-Python ISA binary decoder + CPU SPIR-V interpreter round-trip only)
AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek V4 Flash)
Checklist
main(1cfc29af7) and merges cleanly.docs/design.md, with how it was confirmed. (N/A — pure-Python ISA decoder inline-constant parity with LLVM; no translator rule changed.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.