Repository navigation
Conversation
…ong line llvm-mc slows down sharply on one long input line. disasm() joined each program's bytes with spaces into a single line, so large programs took tens of seconds each: a 90 KB library program took 58.6 s that way and 0.2 s split into lines of 64 bytes, with byte-identical disassembly (the same .s text and the same count of undecodable words; only the line/column numbers in llvm-mc's diagnostics change). make_game.py's pipeline-library step (2,684 programs from shaders.rpf) went from about one program per minute to about 1.5 minutes for all of them. tests/test_shader_disasm_input_lines.py stubs subprocess.run and checks the text llvm-mc would receive: lines of at most 64 bytes, the same bytes in order, no empty or trailing lines, and inputs of up to 64 bytes (the probe included) unchanged. It needs no llvm-mc and no game data. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
4 tasks done
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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