Skip to content

perf(agc): draw cache keys on the user words each stage reads - #493

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:perf/draw-key-user-words
Oct 8, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:perf/draw-key-user-words

Conversation

@MichonGoddijn231849

@MichonGoddijn231849 MichonGoddijn231849 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What

Split out of #291, as discussed there. The draw cache key mixed all 32 user data words of every stage, so draws that differed only in words their programs never read got separate entries and decoded and compiled again. The key now mixes only the user words each stage's RSRC2 counts (USER_SGPR, including the high bit). The RSRC2 registers themselves stay in the key, so a different count is a different key. APS5_DRAW_KEY_ALL_USER_WORDS=1 mixes all 32 again.

The other part of #291 is #494 (data-only hits, on top of this). #291's time-based failure memo is dropped.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for splitting it. I checked the key against the decoder: decodeDraw reads exactly the first USER_SGPR words (bits 1 to 5 plus USER_SGPR_MSB at bit 27, which matches SPI_SHADER_PGM_RSRC2_PS/GS/HS in Mesa's gfx10.json) from 0x0c, 0x8c and 0x10c. The RSRC2 registers stay in the key, and nothing else in the draw path reads the words past that count, so a shared entry can't give a different decode or compile. A unit test isn't really possible without a draw harness, so that's fine with me. Merged with current main it builds and passes the full ctest here. Since it changes which draws share a cache entry, I'll run it through PPSA21564 on my integration branch first; after that it's ready to merge from my side.

The draw key mixed all 32 user data words of every stage. It now mixes only the
words a stage's RSRC2 counts, so draws that differ only in words their programs
never read share an entry. The RSRC2 registers stay in the key.
APS5_DRAW_KEY_ALL_USER_WORDS=1 mixes all 32 again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@MichonGoddijn231849

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (now 131adc1), no conflicts. Build and ctest pass.

@oneandonlydean
oneandonlydean merged commit a602045 into boykopovar:main Oct 8, 2026
4 checks passed
@MichonGoddijn231849
MichonGoddijn231849 deleted the perf/draw-key-user-words branch October 9, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants