Repository navigation
Conversation
…h llvm-mc 21 and 23 Review findings on ItsNotRexed#4343 (@tupacfan04): * A compute record may hold NONE in any field (ref allows it), but parse() indexed the blob table with a NONE layout (IndexError) and main() decoded a NONE state. A record without a program now names no stage, one without a layout links no digest, one without a state gets no dispatch fields, and library.json gives a missing program as null. * find_library inflated any false zlib header without a cap, up to ~132 MB per stream. Each stream now inflates to at most BLOCK + 1 bytes (a library block is at most 64 KiB, so a longer stream isn't one), and a header that asks for more than 1032:1 of the bytes after it is rejected. Three new tests fail on main (the IndexError, the ratio, a too-long stream with a library header) and pass here. docs/shader_library.md: * 91 compute programs set TG_SIZE_EN, not 90 (90 was the refusal count; one program is refused earlier). * A default run writes 21,521 programs: --stages all adds the slot-6 one (@bielfreedom). * Section 5 said llvm-mc 23, but those counts were made with 21.1.8, which can't decode the vcc tuples (LLVM 23 added VCCTuple). The section now compares 21.1.8 (15,551), 23.1.5 (16,699) and 23.1.5 with ItsNotRexed#6446, ItsNotRexed#6808 and ItsNotRexed#6809 (18,544) at main 561b65a, and lists what stops the rest. Section 4 says to use llvm-mc 23. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independently checked
The same independent harness also passes on WSL Ubuntu 22.04 / Python 3.10.12: all 16 NONE combinations and 48 archive round trips, with the same 14 exceptions at base; traced peaks there are 9,839,856 versus 176,705 bytes. No blocking findings in those code paths. I did not validate the game-derived corpus counts, LLVM-version results, disassembly, or GPU behavior. AI-assisted (Codex); the commands and independent harness were run locally. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
tools/shader_library.py bounds find_library() inflation to BLOCK + 1 bytes and rejects headers whose declared size exceeds deflate's maximum ratio from the remaining archive. Compute records now tolerate NONE in any field, so stage/digest/link building and cs_state skip nulls. Documentation and tests cover oversized streams, impossible sizes, and null compute fields.
Why merge
Unbounded decompression of false headers wasted memory and could raise on malformed archives, and real libraries contain compute records with null references. Hardening the scan and accepting those records makes library discovery robust on the shipped data.
Verdict: Approve
Summary
Why mergeUnbounded decompression of false headers wasted memory and could raise on malformed archives, and real libraries contain compute records with null references. Hardening the scan and accepting those records makes library discovery robust on the shipped data. Verdict: Approve |
|
Tested fd17a67 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
Follow-up to #4343. Claimed in #5781 (comment).
Review findings on #4343
From @tupacfan04's review:
NONE.ref()allows it, butparse()indexed the blob table with aNONElayout (IndexError, notLibraryError), andmain()decoded aNONEstate. Now:library.jsongives a missing program asnull.find_libraryinflated any false zlib header without a limit, up to about 132 MB per stream. Each stream now inflates to at most 64 KiB + 1 bytes: a library block is at most 64 KiB, so a longer stream isn't one. A header that asks for more than deflate's 1032:1 ratio of the bytes after it is rejected.Doc corrections (
docs/shader_library.md)91 compute programs set
TG_SIZE_EN, not 90. The 90 was the refusal count; one program is refused earlier. No program is named by two records that disagree on the bit.A default run writes 21,521 programs (@bielfreedom's count);
--stages alladds the slot-6 one.§5 named the wrong llvm-mc version. It said llvm-mc 23, but its counts were made with 21.1.8. LLVM 21 and 22 can't decode the scalar register groups that run into
vcc, which these programs use often. LLVM 23 addedVCCTuplefor them and prints[s100,...,vcc_lo,vcc_hi], which the translator already reads. §5 now compares the versions atmain561b65a8(counts only):§5 also lists what stops the rest. The largest are 1,731 programs with words no llvm-mc version decodes (mostly VOPC with a DPP16 source) and 767 with
v_cmp_*_e64 vcc_hiin wave32 code.§4 says to use llvm-mc 23.
Tests
tests/test_shader_library.py: 12 passed. The three new tests (NONEfields, too-long stream, impossible size) fail onmain.tests/test_docs_*.py: 45 passed.No game data. AI-assisted (Claude Code). Windows 11, Python 3.12, no GPU used.
🤖 Generated with Claude Code