gpu/pack: scan() drops 2,634 labelled shaders — : in the name tail, and the data_end jump hides 143 fragments #34
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#34
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?
@MoonYueya on GitHub · 2026-11-22 14:14 UTC · original
One line: complete the RPF9 record scan, so 2,634 labelled shaders stop falling out of the extractor.
Background — we re-implemented
scan()and ran it on our own copy. It reports 23,869 records. Of the 26,721 records in that layer, 2,707 are rejected byident()(line 27) because their names carry a stage suffix such as…:CS_<8 hex>_Wrapped— yetrpf.rs:32already rewrites:to_when writing files. 143 more are hidden byi = data_end(line 69): each starts inside the compressed span of a record you already accept, sharing its end offset and payload digest. 2 more have a bad first byte. Net: 2,634 labelled shaders never reach the extractor. Longest name: 126 bytes with terminator, so the ">255" note at lines 10-11 does not apply.Stages
:in the name tail; other predicates unchanged. Accept:cargo testgreen plus amod testscase on one synthetic…:CS_…record; the family then appears in the listing (26,576 candidates).i + 1instead of the payload end, collapsing duplicates by (end offset, payload digest) and keeping the earlier start. Accept: a fixture of two overlapping records yields one, and the count settles at 26,503 distinct.rpf.rs:147: 26,719 raw, 26,503 de-duplicated.Field layout — your
p = i + lenis the NUL byte, so this lines up with yourp + 1/p + 2/p + 10/p + 14andheader_end = p + 18:d[i+1..p]len - 1bytesd[p]== 0d[p+1]d[p+2]== d[p+10],0 < cs < 16 MiBd[p+6]d[p+10]== d[p+2]d[p+14]0 < us < 64 MiBd[p+18]csbytes; the record ends atp + 18 + csFour predicates. We accept a candidate only when all four hold: (1)
p + 18 + csis inside the buffer and the two size fields agree; (2) the raw-deflate stream ends and inflates to exactlyusbytes; (3) the output starts withDXBC; (4) the container's own total-size field, its u32 at +24, equalsus. Byte order is little-endian throughout.De-dup key. Enumerating every offset gives 26,721 accepted records. 218 of them start inside the previous record's name (suffix aliases; corrected below) and share its end offset, its DXBC digest (container bytes 4..20) and its tag; keep the earlier start and drop the later copy — 26,503 records, 25,889 distinct digests. Two consequences worth knowing before S2: your
i = data_endcurrently suppresses 143 of those 218, so switching toi + 1without this rule adds all 143 back as phantom records; and 55 of the 218 already get through today. The one shape the enumeration cannot see is a 3-character name, whose length byte is not part of a printable run — the shortest name in this archive is 20 bytes.We can also offer: patch review, and we will do S1 if nobody claims it.
Open question: is the identifier-only filter deliberate — is
…:STAGE…not a shader record for your pipeline?Drafted with AI assistance; numbers independently re-checked.
@ivall on GitHub · 2026-11-22 15:41 UTC · original
Thanks – S1 is right and is fixed (it lands with our next push). S2 and S3 are not needed: the extra hits they surface are not fragments, they are aliases of records we already have. Details below, measured on v1.0.2.1
shaders.rpf(411,695,600 bytes) with a separate Python re-implementation and withxcl rpfafter the fix.S1 –
:in the name. 2,689 records have an effect-qualified name (alphaResolve:CS_AlphaTransmissionDenoise_2871f2e9_Wrapped). All of them inflate to DXBC and all of them are compute shaders.ident()rejected them. This was not deliberate – the filter assumed plain identifiers.scan()now accepts:after the first byte (the first-byte rule is unchanged) and finds 26,503 records.The net gain is 2,634, not 2,689: 55 of those records were already being picked up, under the wrong name. Once the real record was rejected, the scan moved on byte by byte, and where the
:byte (0x3A = 58) happened to equal the length of the rest of the name plus its terminator, the tail (CS_AutofocusSceneDepthScanFinalReduction_a00a21f4_Wrapped) parsed as a record with the same header and payload. Those 55 were the "CS 55" in our corpus numbers. The new testqualified_names_are_whole_recordsbuilds exactly that case. It fails on the old predicate with the alias name and a lost record.S2 – resuming at
i + 1. The 143 extra hits (216 once:is allowed) do not start inside a compressed span. Every one of them starts inside the name of an accepted record, at a name byte that equals its distance to the terminator, and shares that record's terminator, header and payload. They are suffix aliases of the same record. Thei = data_endjump is what discards them. Resume-at-i + 1plus your (end offset, payload digest) de-dup gives 26,503 – the same set S1 alone gives with the existing jump. Your 26,576 for S1 counts all 2,707 raw:hits, 18 of which are such aliases. The 2 "bad first byte" hits are aliases too (:CS_WavePerSplineConstraint_32_a913d34f_Wrapped,2UInt:CS_RGBA8AsR32UInt_Broadcast_4db369a6_Wrapped).S3. 26,719 counts aliases, so
xcl rpfprints only the record count (26,503).The module note about names longer than 255 bytes was also wrong. The longest name is 125 bytes; the "truncated" names it described were these aliases. The note has been rewritten.
The 2,634 records through the recompiler. They exposed three translator gaps, now fixed:
ds_swizzle_b32in the bit mode with xor ≥ 16 (0x401F, which swaps the 16-lane halves) was misread as FFT/rotate mode. The real FFT and rotate modes are now implemented as the ISA defines them.s_getpc_b64/s_add_u32/s_addc_u32/s_setpc_b64with a constant offset, for targets beyond the ±128 KBs_branchrange). It is now treated as a direct branch.indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays_d60186e6_Wrapped: 76,699 instructions, 1,377 far jumps) translating for more than ten minutes. It now takes seconds.The whole pack now translates in full: 26,698 / 26,698 programs.
@ivall on GitHub · 2026-11-22 15:46 UTC · original
Landed in
e80ce8d.@MoonYueya on GitHub · 2026-11-22 16:11 UTC · original
Thanks, and thanks for the correction. You're right about S2: we checked our own index, and all 218 of our re-detections start inside the previous record's name. None start in its header or its payload, so they're suffix aliases, as you describe, and not fragments. We've fixed our notes and the two other threads where we said otherwise. Good to see the 2,634 records also shook out three translator gaps.
Drafted with AI assistance.