Skip to content

WIP: Sonic Origins draw-cache investigation (probes, not for merge) - #2

Draft
mrfelek wants to merge 8 commits into
base/draw-cache-integration-572fe318cfrom
wip/sonic-draw-cache-probes
Draft

mrfelek wants to merge 8 commits into
base/draw-cache-integration-572fe318cfrom
wip/sonic-draw-cache-probes

Conversation

@mrfelek

@mrfelek mrfelek commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

WIP: Sonic Origins draw-cache investigation, with every local probe

Draft fork PR against JJenkx's draw-cache integration branch (572fe31, pinned as base/draw-cache-integration-572fe318c). Not for merging. It keeps every local commit from the investigation, including the temporary probes, so the numbers in docs/dev/notes/sonic-origins-s2-menu.md can be reproduced.

The clean parts are split out:

What is here

commit what
alias key probe which register-key words differ between draws of one shape
relocation eligibility probe [tmp-reloc]: why stage captures are or are not relocatable
vertex-fetch relocation the change in the relocation branch, plus APS5_NO_VERTEX_FETCH_RELOCATION
relocation probes + FlagVector APS5_RELOCATION_NEVER_IDLE; inline flags for DescriptorBinding (a duplicate of boykopovar#6970, kept only for the measurements)
per-kind phases + validation timers [tmp-phases] (miss / data hit / relocated hit), [tmp-validate]
one-layer storage share the #1 change on this base
key-step timers [tmp-key] in Driver::draw
notes docs/dev/notes/sonic-origins-s2-menu.md

Main findings (Sonic 2 menu, ~130 presents per 10 s)

  • Alias copies: the GPU spent 5.1 ms per frame copying storage images (~54 copies of ~24 MB each). Fixed in fix(agc): share one storage image between a 2D surface and a one-layer 2D array over it #1.
  • Draw cache: vertex-fetch stages were never relocated. With them relocatable, about half of the draws hit (with the trial throttle off), and the per-draw capture and recompile costs fall by about half. The frame rate does not move, because a relocated hit still costs ~16 µs of CPU and the committer stays at ~46 ms per frame.
  • Ceiling: with the GPU at ~45 ms per frame, a CPU-only fast path could gain at most about 45%.

AI-assisted; the runs are from my machine(s).

mrfelek and others added 8 commits October 21, 2026 12:57
…over it

A sampled or storage one-layer 2D array over a 2D storage surface made a
second storage image of the same memory, and the two handed their texels
to each other on every switch (borrowUnits: ~7,200 whole-surface copies,
~170 GB per 10 s on the Sonic Origins S2 menu, and stale glyphs in the
menu's help text). ArrayLayersServeView lets a 2D surface serve that
view; SurfaceKey files both under one key (APS5_NO_ONE_LAYER_SHARE=1
keeps them apart), and storage bindings take the view of the shape they
declare (first-layer view: 2D over an array, one-layer array over 2D).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BywPXoZACVi8ALV4JKvuPZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BywPXoZACVi8ALV4JKvuPZ
mrfelek pushed a commit that referenced this pull request Nov 28, 2026
…d-20261127

fix(libc): check signalcontext guest stack address arithmetic
mrfelek pushed a commit that referenced this pull request Nov 28, 2026
…sion-20261127

test(libSceFreeType): cover second output-copy rollback

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant