mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #556] [MERGED] rdna2_decode: permlane16 op_sel and exp null match llvm-mc and shader_ir (DECODE-LLVM-PARITY) #602
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#602
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/556
Author: @quartz-heron-58
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:decode-permlane-opsel📝 Commits (1)
86da7berdna2_decode: permlane16 op_sel and the exp null target match llvm-mc and shader_ir (DECODE-LLVM-PARITY)📊 Changes
2 files changed (+43 additions, -2 deletions)
View changed files
📝
tests/test_rdna2_decode.py(+34 -0)📝
tools/rdna2_decode.py(+9 -2)📄 Description
Claimed in the coordination issue as: DECODE-LLVM-PARITY (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125590718)
What and why
tests/test_rdna2_decode.pytest_parity_with_llvm_mc_on_shader_fixturescomparesrdna2_decode.decode_byteswith llvm-mc over everyruntime/test/shaders/*.asm. On main1c93c869with llvm-mc 21.1.8 it fails. It is red in CI on main as well:fiestorrafound the same assertion in main's ownstdlib-tests-linuxjob (run 45320704311, headece4ba5b3; finding in #14), and that run'scheckandmacos-pythonjobs are failures too.Correction (edited): this description first said CI skips the test because those jobs have no llvm-mc. That was wrong, a conclusion I drew from reading
ci.ymlwithout looking at a run.Two decoder mismatches, the second hidden behind the first:
v_permlane16_b32/v_permlanex16_b32(cs_w32_permlane_fi.asm). These useop_selbits 0 and 1 as FI and BOUND_CTRL. llvm-mc printsop_sel:[FI,BOUND_CTRL], and nothing when both are 0, whatever bits 2 and 3 hold. The decoder printed the generic[s0,s1,s2,dst]list, e.g.op_sel:[0,1,0,0]forop_sel:[0,1].exp null(ps_w64_a_discard.asm).shader_ir.parse_linereads thenullexport target as the special register (core not in ("null",)in its target rule).decode_bytesgave{"k": "target", "t": "null"}, so a decodedexp nulldid not equal its own printed line parsed back. It now gives the special register fornulland a target for every other name.No translator output changes that I can find:
Gen.opsel_bits(mods, 2)reads the first two values either way, and thepythondisassembly backend goes throughdisasm_bytestext andshader_ir.parse_line. No contract-table row: no translation rule changes.Tested
Windows 11 Home build 26300, Python 3.12.10, llvm-mc 21.1.8 (built by
scripts\build_llvm_mc.ps1), SPIRV-Tools v2026.4. No game files.python -I tests/test_rdna2_decode.pywithLLVM_MCset: 19 tests OK (17 on main, 1 failing). WithoutLLVM_MCand with no llvm-mc on PATH: 19 OK, 1 skipped.test_permlane16_opsel_is_the_fi_bound_ctrl_pair: tenop_selvalues for each of the two ops, hand-assembled words. Fails on main's decoder. Each expectation was also compared withllvm-mc -disassemble -mcpu=gfx1013by hand: 20 of 20 equal.test_exp_null_target_matches_the_parsed_line:exp nullandexp mrt0words from llvm-mc's own encoding.rdna2_decodeorshader_disasm: all OK.python -I scripts/run_semantic_tests.py tests/semantic: 465 files, 6107 tests, 1 file failed,test_image_cube_store_glc(FileNotFoundErrorin its llvm-mc round trip). It fails the same way on main without this change; #419 covers it.python -m compileall -q make_game.py tools tests: exit 0.scripts/check_no_game_data.pyon both files: exit 0.GPUs tested: n/a
AI-assisted: yes (Claude Code found the failure, wrote the change and ran the tests)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.