Repository navigation
rdna2_decode: stream the text listing instead of retaining every instruction - #4963
Open
tupacfan04 wants to merge 1 commit into
Open
tupacfan04 wants to merge 1 commit into
tupacfan04 wants to merge 1 commit into
Conversation
tupacfan04
force-pushed
the
fix/rdna2-decode-stream-text
branch
2 times, most recently
from
November 23, 2026 06:57
7786790 to
595c5dc
Compare
tupacfan04
force-pushed
the
fix/rdna2-decode-stream-text
branch
from
November 23, 2026 07:00
595c5dc to
e54f1cf
Compare
|
Independent check of Environment: Windows 11, CPython 3.15.2, CPU only. Synthetic inputs, no GPU, no game files.
Read the diff: text listing now streams per-instruction instead of accumulating — the memory win the title claims, with the byte path preserved for the binary listing. No issues found. AI-assisted (Devin). |
|
Tested e54f1cf on Arch Linux (in a VM), CPython 3.14, LLVM 23.1.5: pass.
|
Contributor
|
Tested e54f1cf merged with main 3faac55 on Linux (WSL2), CPython 3.12.16, CPU only: pass
|
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.
Claimed in the coordination issue as #4932 (claim).
What and why
rdna2_decode.disasm_bytes()calleddecode_bytes(), kept every decoded instruction dictionary, built a second list of formatted lines, and joined it. For a text-only caller that doubled the retained Python objects until the final string existed._iter_decoded(), which yields each instruction (orNonefor an invalid word) as soon as it is decoded.decode_bytes()keeps collecting the structured result its callers expect.disasm_bytes()formats each instruction and writes it to aStringIOimmediately, so the instruction dict and its formatted line are released before the next decode.code_starthandling, the trailing newline and the invalid-word count are unchanged.Measured on Windows 11 with CPython 3.14.7, using
bytes.fromhex("000040d501050e04") * 8192 + b"\xff"andtracemallocstarted immediately before the call:Both return the same 778,240-character listing and report one invalid word. This measures Python allocations only, not RSS or throughput.
Tested
py -3 -I -m pytest tests/test_rdna2_decode.py tests/test_rdna2spirv_decode.py tests/test_shader_disasm.py -q: 57 passed, 1 skipped, 72 subtests passed.py -3 -m compileall -q tools/rdna2_decode.py: exit 0.code_start,wave32=False, and the 2,048-instruction repeated input), compared by SHA-256 of the full listing plus the invalid count.AI-assisted: the change, tests and this description were written by an AI coding agent running in OpenCode and checked by the commands above.
Checklist
CONTRIBUTING.md), including in logs or reports quoted here.docs/design.md, with how it was confirmed. (Not a translator change.)Depends on: nothing.