perf(agc): back off the draw cache while its entries do not pay off #17225
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17225"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by XatiX on 2026-11-08T15:23:17Z.
What
A title whose draw cache entries are evicted before their draw repeats
pays the entry key, lookup and insert on every draw for no hit. The
driver now counts the draws served by an entry (full or data-only hits)
in windows of 4096 draws. After a window in which fewer than one draw in
32 was served, only every 16th draw uses entries; those probes keep
measuring, and a window that pays off again ends the back-off.
Tested
Windows 11 Pro 26300, NVIDIA GeForce RTX 5080, driver 617.42, MinGW-w64 GCC, Release.
Focused AGC tests (
ctest -R '^agc.*(image_table|table|reuse|template|revalid|variant|resource_cache|bda|texture_cache|storage|shader_memory|locks|draw_cache|depth_surface|snapshot|pending|per_use)' -VwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation), same machine and GPU:mainf5fe807353: 100% tests passed, 0 tests failed out of 148, 0VUID-lines, layer loaded (0 "was not found" lines) -main-focused.logVUID-lines, layer loaded (0 "was not found" lines) -C-focused.logAge of Mythology: Retold (PPSA18653), title screen, idle,
APS5_TRACE_SECONDS=60:120(about 16 presents) after a warm-up run.mainhere isupstream/mainwith #15327 and41f70c5e1cmerged, an earlier head of #16437 that fails clock id 20 withEINVAL; the title needs both to run past the title screen (a GPU hang, then an abort on clock 20). Runs alternated with runs of that build; each run of the change is compared with the mean of the runs just before and after it.main+ #15327 +41f70c5e1c, frame p50 (ms)Mean difference: -11.3 %.
Summary lines:
Digest,
main:Slowest frames (largest slices inside each, inclusive)
Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 7834.5, Driver.Packet.draw 7719.6, Driver.Draw 7719.1, Driver.Draw.draw_and_resource_release 6614.2, Graphics.Draw 6589.3, Graphics.Draw.draw_and_resource_release 6284.6, Resources.Complete 6090.4, Driver.Draw.shader_compile_and_link 1080.6, batch 547.0, Graphics.Draw.validate 286.7
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
seconds 60:120 from present 558: 17 presents, frame p50 6953.5 / p90 7730.5 / p99 8153.2 / max 8153.2 ms, GPU busy 447.6 ms per present
NVIDIA GeForce RTX 5080, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit dbba935fd08c, dropped: no
Slowest frames (largest slices inside each, inclusive)
Persistent spikes (frame time above the fastest frame that separates it from a longer frame; one entry per stall, not per frame)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 7106.0, Driver.Packet.draw 7016.6, Driver.Draw 7016.0, Driver.Draw.draw_and_resource_release 6641.4, Graphics.Draw 6616.7, Graphics.Draw.draw_and_resource_release 6344.7, Resources.Complete 6157.5, batch 456.8, Driver.Draw.shader_compile_and_link 337.0, Graphics.Draw.validate 254.4
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
The two traces and both test logs are attached.
main-focused.log
C-focused.log
main-aps5-trace-57be81439239-38472.json.gz
change-aps5-trace-dbba935fd08c-40428.json.gz
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)