Skip to content

feat(agc): count which key component differs on resource-content cache misses - #5408

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
AlxcBTW:diag/resource-key-miss-trace
Oct 14, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
AlxcBTW:diag/resource-key-miss-trace

Conversation

@AlxcBTW

@AlxcBTW AlxcBTW commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What

APS5_TRACE_RESOURCE_KEY_MISSES=1 reports why a resource-content cache lookup missed, not just that it missed. On each miss, the new key is compared word by word with the last key of the same shader set. Each differing word is attributed to the component it belongs to:

  • the descriptor layout;
  • buffer V# words 0–3;
  • image and sampler descriptors;
  • shader data;
  • the draw target and index tail;
  • other.

Every 10 s it prints one line per draw/dispatch:

[keymiss] resource-content dispatch (10 s): misses N; differing: layout …, V# word0 …, V# word1 …, V# word2 …, V# word3 …, image …, sampler …, shader-data …, other …, draw target/index …; no-candidate …; identical …; not comparable …

It also prints up to 256 per-miss lines, at most 4 per shader set, naming the components that changed.

This complements #5364, which traces draw-key misses. This PR covers the resource-content key, which is the one that decides whether a draw or dispatch re-records its descriptor contents. For #5345 the question is which part of that key changes from frame to frame: a buffer base address (word 0), a size or stride (word 2), or the layout itself. That decides whether masking a component in the key is worth trying. Off by default; no behaviour change without the variable.

Tested

  • New unit test tests/KeyMiss.cpp:
    • labels a dispatch key and a draw key component by component;
    • checks that a change in each component is attributed to that component;
    • checks that a key of a different length counts as not comparable.
  • Fork CI green on Linux and Windows.
  • Not run in a title on this branch yet.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (diagnostic for perf: RDR gameplay at 2.6 FPS, single queue worker CPU-bound #5345)
  • GPUs tested: n/a (trace only, off by default; CI unit test)
  • AI-assisted: yes

🤖 Generated with Claude Code

…e misses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AlxcBTW and others added 2 commits October 13, 2026 23:43
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ISSES is set

The per-miss component comparison allocates and walks the whole key, and
it ran under APS5_PROFILE_DRAW as well, where it cost queue time on every
resource-content miss. It now runs only with the trace variable, which is
also the only one that prints its [keymiss] lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on Linux (GCC/Ninja, PR merged onto main): agc_driver_key_miss passes and does not build without the change. The component labelling matches the ContentKey layout for dispatch and draw keys, and with the variable unset nothing changes. The two other failures in the libSceAgcDriver ctest scope (agc_recorder_kept_bytes, agc_driver_tessellation) also fail on clean main. Merging once the full Build is green.

@adriadam10
adriadam10 merged commit cba0746 into boykopovar:main Oct 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants