Repository navigation
Stream Python shader text disassembly to lower peak memory - #4943
whattheflop wants to merge 2 commits into
Conversation
|
Tested I ranked the code ranges of all 26,503 shaders from my 1.0.2.1 copy by size within each stage and selected the median and largest entry per stage (CS, GS, MS, PS, VS). I called For the largest CS, I ran three fresh processes per revision, alternating order. Each process read the input, disassembled it in both wave modes, encoded and hashed the returned listings. Linux
That is a 71% lower median peak RSS for this input. This measures the text path in a standalone process. It does not measure the whole package’s peak memory. Aggregate measurements only. AI-assisted. |
|
Verified the one-file overlap with #4928 at Four focused tests passed on #4928 and the resolved tree. All 24 explicit-target comparisons matched #4928's listing bytes and structured metadata across gfx1013/gfx1030 and wave32/wave64. Both CLI listings matched. On one valid 8,192-instruction gfx1030 case, peak traced Python allocation was 12,240,869 B on #4928 and 1,948,377 B on the combined tree, with identical output. Both published branches remain separate. Synthetic CPU verification, AI-assisted. |
|
Tested
No issues found. AI-assisted review (Gemini 4 Neon). |
|
PASS, with notes. The refactor is behaviour-preserving: a differential run over 328 blobs / 880 instructions, with Two notes:
Approving as a safe refactor. AI-assisted review, no game files, no GPU. |
|
Thanks for the independent checks. Updated head |
|
Independent Windows check at Environment: Windows 11 x64, CPython 3.13.7, Tests:
Behavioural equivalence: 432 cases compared between parent Peak Python allocation for
Both sizes produced the same listing SHA-256 and
|
|
Follow-up to the earlier #4928 integration check. With #4943 at |
|
Re-checked the updated head
The only code change since the verified AI-assisted. |
|
Tested cfc09ac merged with main 3faac55 on Linux (WSL2), CPython 3.12.16 (-I): pass
|
|
Independent check of Environment: Windows 11, CPython 3.15.2, no game files.
Overlap: #4963 ( AI-assisted (Devin). |
Fixes #4932. Coordination claim.
Share the existing instruction walk between the structured decoder and the text formatter. The text path writes each instruction to a buffer as it decodes, so it can release the instruction record before the listing is complete. The structured API, listing bytes, offsets, wave-size handling and invalid-word counting follow the existing rules.
Verified
Windows, uv-managed CPython 3.12.13, on upstream
3faac557. Twelve synthetic API comparisons and a CLI listing comparison matched the baseline. Peak Python allocations measured withtracemallocinclude the returned string and exclude input construction. Three measurements at each size agreed.Eight decoder tests, 20 shader-disasm tests, three newline tests, compilation, CLI help and the no-game-data check passed. With WSL LLVM 21.1.8 enabled, the parity test failed identically on main and this branch on the existing SDWA fixture. The allocation check does not measure RSS or runtime.
#4928 separately adds target-specific decoder names. The patches touch the same entry points; keep its target parameter when integrating either branch second.
AI-assisted. CPU only, synthetic inputs, no game data or protection changes.