mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #289] [CLOSED] shader_disasm: hand llvm-mc its input in lines of 64 bytes, not one long line (up to ~380x faster, identical output) #340
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#340
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/289
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:old-pr/10020📝 Commits (1)
f550251shader_disasm: hand llvm-mc its input in lines of 64 bytes, not one long line📊 Changes
2 files changed (+76 additions, -1 deletions)
View changed files
➕
tests/test_shader_disasm_input_lines.py(+73 -0)📝
tools/shader_disasm.py(+3 -1)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Item: new BUILD item, claimed in the coordination issue: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117003507
Depends on: none (applies to
main).Why
tools/shader_disasm.py'sdisasm()joins a program's bytes with spaces into one line of hex and hands it tollvm-mc.llvm-mcslows down sharply on one long input line, so large programs took tens of seconds each. That makesmake_game.py's pipeline-library step (2,684 compute programs fromshaders.rpf) run at about one program per minute: in one run, 994 programs in about an hour, with about 1,700 left.What
disasm()passes the same bytes in lines of 64 bytes. Inputs of up to 64 bytes, thes_endpgmprobe among them, are unchanged.tests/test_shader_disasm_input_lines.py: stubssubprocess.runand checks the textllvm-mcwould receive (lines of at most 64 bytes, the same bytes in order, a partial last line, no empty or trailing lines, short inputs unchanged). Standard library only; nollvm-mc, no game data. Red without the change (2 of 4 fail), green with it.Same output
Byte-identical disassembly: the same
.stext and the same count of undecodable words. Only the line/column numbers inllvm-mc's diagnostics differ.make_game.pyalready fingerprintsshader_disasm.pyfor the library, FSPX, BVH and exe steps, so those rerun once after this; the main corpus's disassembly and translation do not.Measured with the old and new
disasm()side by side on six real library programs (own 1.0.2.1 copy; sizes and timings only):The library step's unpack and disassembly then took about 1.5 minutes for all 2,684 programs.
Tested
Windows 11, i5-9600K, Python 3.14.10, native
llvm-mc21.1.8 (AMDGPU, built withscripts/build_llvm_mc.ps1).python -I tests/test_shader_disasm_input_lines.py: 4/4.test_shader_disasm.py(30),test_fssm_crosscheck.py(6),test_shader_stage_resume.py(46),test_fspx_shaders_stage.py(23): OK.test_bvh_shaders_stage.py(test_the_builder_runs_after_fspx_and_alone_when_only_its_dll_changes) andtest_rdna2_decode.py(test_parity_with_llvm_mc_on_shader_fixtures) fail once each, identically onmainwithout this change.python -m compileall -q make_game.py tools tests: clean.make_game.py --stages check,shaderson a work folder (ladder-frame base): library 1,538 of 2,684 translated and all 1,538 passspirv-val; BVH 52/52; exe 10/10. The untranslated library programs are translator gaps, unrelated to this change.AI-assisted (Claude Code).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.