docs/breakthroughs.json: two different stage breakdowns for the same 21,522 #39

Closed
opened 2026-11-27 02:32:23 +00:00 by github-bot · 5 comments
Owner

@⁠MoonYueya on GitHub · 2026-11-22 14:14 UTC · original

One line: fix the stage breakdown in docs/breakthroughs.json, where two copies disagree for the same 21,522 shaders.

Background — your PS09 note matches our own measurement: header 0x80, then 25,471 × 0x70 graphics PSOs, 2,693 × 0x18 compute PSOs, 54,576 × 8 metadata entries, 21,522 × 8 shader-index entries, then the metadata blob and the raw code.

The split appears twice, and the copies disagree. Line 16, and line 243 which adds VS 703: 9,580 CS · 7,463 PS · 3,574 NGG · 202 RT. Line 74: PS 9,535 · VS 1,343 · CS 3,082 · NGG 7,498 · RT 64. Both sum to 21,522, but per stage they differ by up to 6,498 (compute, 9,580 against 3,082). One calls itself an exact breakdown; the other presents the same 21,522 as verified totals — and they disagree. Line 74's SGD5 split (2,689 + 195 + 12,101 + 11,518) also sums to 26,503, the named-record count we measure.

Suggested change: keep one breakdown and mark the other superseded, or say which pass produced each. Doc-only.

A number: independent of your index, we count 21,044 code-bearing records inside the inflated cache (4,205 streams, 275,540,780 B), each with a 12-byte header and an s_endpgm payload.

Open question: do the 478 between index length and record count correspond to index entries that alias an existing code blob — a shader shared by several PSOs, or a zero-length entry — or does our record model miss them?

Drafted with AI assistance; numbers independently re-checked.

**@⁠MoonYueya** on GitHub · 2026-11-22 14:14 UTC · [original](https://github.com/rpatty-dev/PercyStar/issues/39) **One line**: fix the stage breakdown in `docs/breakthroughs.json`, where two copies disagree for the same 21,522 shaders. **Background** — your PS09 note matches our own measurement: header 0x80, then 25,471 × 0x70 graphics PSOs, 2,693 × 0x18 compute PSOs, 54,576 × 8 metadata entries, 21,522 × 8 shader-index entries, then the metadata blob and the raw code. The split appears twice, and the copies disagree. Line 16, and line 243 which adds VS 703: 9,580 CS · 7,463 PS · 3,574 NGG · 202 RT. Line 74: PS 9,535 · VS 1,343 · CS 3,082 · NGG 7,498 · RT 64. Both sum to 21,522, but per stage they differ by up to 6,498 (compute, 9,580 against 3,082). One calls itself an exact breakdown; the other presents the same 21,522 as verified totals — and they disagree. Line 74's SGD5 split (2,689 + 195 + 12,101 + 11,518) also sums to 26,503, the named-record count we measure. **Suggested change**: keep one breakdown and mark the other superseded, or say which pass produced each. Doc-only. **A number**: independent of your index, we count 21,044 code-bearing records inside the inflated cache (4,205 streams, 275,540,780 B), each with a 12-byte header and an `s_endpgm` payload. **Open question**: do the 478 between index length and record count correspond to index entries that alias an existing code blob — a shader shared by several PSOs, or a zero-length entry — or does our record model miss them? Drafted with AI assistance; numbers independently re-checked.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:32:23 +00:00
Author
Owner

@⁠rpatty-dev on GitHub · 2026-11-22 14:33 UTC · original

Fixed in docs/breakthroughs.json and answered below!

  1. Stage breakdown reconciled: Updated kpis[0].sub to 9,535 PS · 1,343 VS · 3,082 CS · 7,498 NGG · 64 RT (matching the v1.3.6 PS09 + PSO-metadata pass) and marked the earlier v1.3.0 ps09-rdna2-lifter raw opcode-heuristic split (9,580 CS · 7,463 PS · 3,574 NGG · 703 VS · 202 RT) as superseded by the v1.3.6 pass.
  2. Re: the 478 difference (21,522 index vs 21,044 s_endpgm records): Verified against shaders_index.csv from shaders.rpf — all 21,522 entries have unique, non-zero (code_offset, code_size) (unique_blobs=21522, shared_aliases=0, zero_size=0). The 478 difference comes from shaders that terminate with s_code_end (0xBF9F0000) / non-standard prologues rather than a 12-byte header + s_endpgm (0xBF810000) pattern.
**@⁠rpatty-dev** on GitHub · 2026-11-22 14:33 UTC · [original](https://github.com/rpatty-dev/PercyStar/issues/39#issuecomment-7080634069) Fixed in `docs/breakthroughs.json` and answered below! 1. **Stage breakdown reconciled**: Updated `kpis[0].sub` to `9,535 PS · 1,343 VS · 3,082 CS · 7,498 NGG · 64 RT` (matching the v1.3.6 `PS09` + PSO-metadata pass) and marked the earlier v1.3.0 `ps09-rdna2-lifter` raw opcode-heuristic split (`9,580 CS · 7,463 PS · 3,574 NGG · 703 VS · 202 RT`) as superseded by the v1.3.6 pass. 2. **Re: the 478 difference (`21,522` index vs `21,044` `s_endpgm` records)**: Verified against `shaders_index.csv` from `shaders.rpf` — all `21,522` entries have **unique, non-zero `(code_offset, code_size)`** (`unique_blobs=21522`, `shared_aliases=0`, `zero_size=0`). The 478 difference comes from shaders that terminate with `s_code_end` (`0xBF9F0000`) / non-standard prologues rather than a 12-byte header + `s_endpgm` (`0xBF810000`) pattern.
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-22 14:41 UTC · original

Thanks for the quick fix in 6ca2efe, and for checking the index: the per-entry numbers (21,522 unique non-zero (code_offset, code_size), no shared aliases, no zero-size entries) are exactly what we needed to narrow this down.

That moves the 478 onto our side. Our record model expects a 12-byte header plus an s_endpgm terminator, so programs that end on s_code_end or start with a different prologue would be missed. We'll re-count against the index ranges directly, reading each (code_offset, code_size) span, and post the breakdown of the 478 here once it's done, in case it's useful for your lifter.

Drafted with AI assistance.

**@⁠MoonYueya** on GitHub · 2026-11-22 14:41 UTC · [original](https://github.com/rpatty-dev/PercyStar/issues/39#issuecomment-7080726976) Thanks for the quick fix in 6ca2efe, and for checking the index: the per-entry numbers (21,522 unique non-zero `(code_offset, code_size)`, no shared aliases, no zero-size entries) are exactly what we needed to narrow this down. That moves the 478 onto our side. Our record model expects a 12-byte header plus an `s_endpgm` terminator, so programs that end on `s_code_end` or start with a different prologue would be missed. We'll re-count against the index ranges directly, reading each `(code_offset, code_size)` span, and post the breakdown of the 478 here once it's done, in case it's useful for your lifter. Drafted with AI assistance.
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-22 14:53 UTC · original

Thanks again — we re-derived the gap from your index on a read-only copy.

Your index checks out: 21,522 distinct (code_offset, code_size) pairs, no zero sizes, no overlapping ranges, all 16-byte aligned. One entry has offset 0, which is fine because offsets are relative to the code area (base 34,646,340; area 240,894,440 B; 2,064,676 B unallocated). code_size looks like an allocation span: where an entry lands exactly on one of our records it exceeds it by 168–228 B (median 200).

Against our 21,044 records: 16,559 entries start exactly on a record; 4,485 start inside one, and there our boundary is wrong at both ends — our start is early by 232–92,928 B (median 3,072) and our end falls 568–89,652 B short of that entry's span (median 7,456), so one of our records covers the tail of one program plus the head of the next rather than a whole program (2,793 of them still carry the 8-byte gate at our own start, which is what made the merge invisible); 478 sit in gaps we never picked up. Of those 478, 419 carry the usual 8-byte gate and S_ENDPGM — 407 with a 20-byte S_CODE_END tail instead of the 40 B we assumed, the other 12 with no S_CODE_END fill at all — 58 have no gate, 1 has no terminator. So for the 478 it is the tail padding, not the prologue, that our model got wrong. 21,522 is now our program count.

Drafted with AI assistance.

**@⁠MoonYueya** on GitHub · 2026-11-22 14:53 UTC · [original](https://github.com/rpatty-dev/PercyStar/issues/39#issuecomment-7080889917) Thanks again — we re-derived the gap from your index on a read-only copy. Your index checks out: 21,522 distinct (code_offset, code_size) pairs, no zero sizes, no overlapping ranges, all 16-byte aligned. One entry has offset 0, which is fine because offsets are relative to the code area (base 34,646,340; area 240,894,440 B; 2,064,676 B unallocated). code_size looks like an allocation span: where an entry lands exactly on one of our records it exceeds it by 168–228 B (median 200). Against our 21,044 records: 16,559 entries start exactly on a record; 4,485 start inside one, and there our boundary is wrong at both ends — our start is early by 232–92,928 B (median 3,072) and our end falls 568–89,652 B short of that entry's span (median 7,456), so one of our records covers the tail of one program plus the head of the next rather than a whole program (2,793 of them still carry the 8-byte gate at our own start, which is what made the merge invisible); 478 sit in gaps we never picked up. Of those 478, 419 carry the usual 8-byte gate and S_ENDPGM — 407 with a 20-byte S_CODE_END tail instead of the 40 B we assumed, the other 12 with no S_CODE_END fill at all — 58 have no gate, 1 has no terminator. So for the 478 it is the tail padding, not the prologue, that our model got wrong. 21,522 is now our program count. Drafted with AI assistance.
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-22 16:20 UTC · original

Correction to the 4,485 description above. None of those entries start inside one of our records. Each starts in the gap between two of our old records, and its tail runs on into the next old record, so it is the following record that we had bounded wrongly at both ends. The counts are unchanged.

Drafted with AI assistance.

**@⁠MoonYueya** on GitHub · 2026-11-22 16:20 UTC · [original](https://github.com/rpatty-dev/PercyStar/issues/39#issuecomment-7082000650) Correction to the 4,485 description above. None of those entries start inside one of our records. Each starts in the gap between two of our old records, and its tail runs on into the next old record, so it is the following record that we had bounded wrongly at both ends. The counts are unchanged. Drafted with AI assistance.
Author
Owner

@⁠rpatty-dev on GitHub · 2026-11-22 16:45 UTC · original

Awesome, thank you so much for double-checking and sharing the breakdown! Really glad the numbers line up at 21,522 now, and the tail-padding / gate details are super helpful to have noted here.

Closing this out as resolved — thanks again!

**@⁠rpatty-dev** on GitHub · 2026-11-22 16:45 UTC · [original](https://github.com/rpatty-dev/PercyStar/issues/39#issuecomment-7082316342) Awesome, thank you so much for double-checking and sharing the breakdown! Really glad the numbers line up at 21,522 now, and the tail-padding / gate details are super helpful to have noted here. Closing this out as resolved — thanks again!
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/rpatty-dev--PercyStar#39
No description provided.