Repository navigation
perf(agc): draws that differ only in user data reuse their shape's decode and stages - #494
Conversation
|
Thanks, the data-only path reads right to me. The same shape means the same registers apart from the user words and merged pointers, the copied decode re-reads exactly those, and a stage is only reused when its own user words are unchanged and its captured reads validate. So the result should match a full decode and compile. Two things before I'd take it:
A small one: this commit drops |
5c30b5f to
795b8bc
Compare
|
Thanks. Both points and the includes are done in 795b8bc, on top of a rebase onto current
The rebase had one conflict: I haven't measured the |
|
Thanks, both points are done in 795b8bc. The shape is only passed when It conflicts with main now in |
|
Rebased onto current |
795b8bc to
9f52b1e
Compare
|
Rebased onto current |
9f52b1e to
35c8550
Compare
35c8550 to
cf9195e
Compare
|
Taking the rebase onto #5216 (with the shape admission rule above and a case in |
…code and stages The draw key now has a shape: the key without the user words the stages read. A draw whose key misses but whose shape has an entry copies that entry's decode, re-reads only the user words (and merged-stage pointers), and reuses each compiled stage whose captured reads still hold, compiling the rest. APS5_NO_DRAW_DATA_HITS=1 disables it; APS5_VERIFY_DRAW_DATA_HITS=1 also decodes and compiles in full and throws when the results differ. A shape keeps its previous entries and only points at its newest key, so draws of one shape that alternate between stable user words keep their own key hits. The shape is passed only when data hits are on, so APS5_NO_DRAW_DATA_HITS=1 keeps the previous behaviour exactly. Rebased onto main a8b032b by CouchRiv (the conflicts with boykopovar#639 resolved; built and tested on Linux with an RTX 4070 Ti and RADV, and on Windows with an RTX 5080), and onto main 6ac63bf by gjonn (main's free-function decoder with its static-ABI mode, its incremental register key as the shape key). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: CouchRiv <270190108+CouchRiv@users.noreply.github.com> Co-Authored-By: Gjon Gojcevic <7807870+gjonn@users.noreply.github.com>
Since boykopovar#5216 a key gets its entry at its second sight, so a shape whose user words change on every draw never got an entry and its data-only hits never started. A key whose shape was seen before but has no entry is now admitted at its first sight. A shape that already has an entry serves data-only hits from it, and its new keys are still admitted at their second sight, so per-draw keys don't churn the cache. Shapes are remembered in a second sightings table of the same size. agc_driver_draw_cache_reuse draws three times with new pixel user words over a cached shape (three data-only hits, the vertex stages reused, no insert), then three keys of a new shape (the second one is admitted), and runs again with APS5_VERIFY_DRAW_DATA_HITS=1. Co-Authored-By: Claude <noreply@anthropic.com>
|
Took over the rebase onto #5216, as announced. Pushed on top of your commit:
|
5fe165d to
94ea410
Compare
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads (GetUserData), the words its binding layout forwards into shader data, and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A data-only hit (boykopovar#494) reused a cached stage only when every user data word of the stage was unchanged. A stage records the user words it depends on when it is captured: the words its SRT walk reads as values or bases (SrtUserDataUse), the words its binding layout forwards into shader data (userDataRegisterReads), and the vertex fetch table words of its vertex stage info. A cached stage is now a candidate when only words outside that set changed; its captured memory is validated as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Split out of #291, as discussed there. It builds on #493 (merged), which keys draws on the user words each stage reads.
A draw that misses the cache often differs from an earlier draw only in user data, for example a per-object constant buffer pointer. Such a draw decoded and compiled from scratch. Now:
APS5_NO_DRAW_DATA_HITS=1disables it.APS5_VERIFY_DRAW_DATA_HITS=1also decodes and compiles everything in full and throws when the results differ.APS5_TRACE_DRAW_CACHEcounts why keys missed (new registers, user words only, evicted, never inserted), and the profile line counts data-only hits and reused or compiled stages.#291's time-based failure memo is not part of this: #422 memoizes source failures already, and a skip that ends on a timer isn't exact.
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.
ctest: everything that passes onmainhere passes.maina56c905 (2026-10-13), starting from gjonn's rebase of this series onto 6ac63bf (thanks). On Windows (MinGW GCC 15.2, RTX 5080) the wholeagc_*suite passes on the top of the series: 483 tests, 1 skipped (agc_driver_stencil_ref_export).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code