Repository navigation
perf(agc): prebuild registration shader libraries only when APS5_LIBRARY_PREBUILD=1 - #23812
Conversation
…ARY_PREBUILD=1 A cold boot spent minutes of worker CPU prebuilding registration-form libraries for parts the draws mostly never used, with no measured load or frame gain, so the prebuild is now opt-in. APS5_LIBRARY_PREBUILD=1 turns it on; APS5_NO_LIBRARY_PREBUILD is no longer read. The policy tests check that unset and 0 materialize no registration result and 1 does, and the prepared graphics test opts in for its prebuild checks.
|
NVIDIA Linux run with the Khronos validation layer of the current head Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
The pattern is the prepared graphics test and its three prebuild policy cases ( No new AI-assisted: yes (Claude Code) |
|
This pull request is labeled |
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
What
Graphics pipeline library prebuild becomes opt-in. It runs only with
APS5_LIBRARY_PREBUILD=1.APS5_NO_LIBRARY_PREBUILDis no longer read; thedocs/dev/ENVIRONMENT.mdrow for the new switch says so.Why: at shader registration the prebuild compiles every part a registered shader could need, before any draw asks for it. On GTA V that's about 12 times what the game reaches by the time it's standing in the world. It costs about 10 minutes of worker-thread CPU per cold-cache boot, and loading isn't faster with it; the quiet boots below load sooner without it. On a warm cache it does nothing useful either. With it off, draws build only the parts they use.
Tested
GTA V in-game, build against build:
main6db6a3e;Both builds have #14561 merged for the measurement only, since GTA aborts without it. Both use their defaults, with no profile switch and only
APS5_TRACE_SECONDS=140:30set (stood_still plus about 20 s).The shader cache was emptied before every boot. Setup:
One untimed warm-up boot ran per build, then the order on, off, off, on. A boot that wasn't quiet ran once more. The second on boot was still not quiet on its rerun (another process on the machine), so it's left out. That leaves one on boot and two off:
Driver.Draw.shader_compile_and_linkper frameVulkan.GraphicsPipelinePrebuild, summed per bootVulkan.GraphicsPipelineLibrary, summed per bootReading the table:
Load: the off boots reached the world 5-8 s sooner. An earlier pair on our development branch (draw pipeline on, prebuild with a stage gate, same machine and scene) went the same way:
Across both sets, every quiet off boot beat every quiet on boot by more than the spread within an arm:
That's 2 on boots against 3, over two builds, so it's a likely load-time gain rather than a measured one.
Boots that weren't quiet are left out of both:
Frames: in the window, draws build what the prebuild would have built earlier, so
shader_compile_and_linkis about 2 ms per frame higher. p50 is 3-5 % higher, against the 134 ms frames of a cold cache.CPU: the cost the prebuild adds is certain.
The summary lines, traces, nav cues and quiet verdicts of all four boots, and the summary lines and nav cues of the branch pair (
branch-cb1-*), are attached at https://github.com/chitters2004/AnyPS5/releases/tag/pr-library-prebuild-opt-in.Tests:
agc_driver_prepared_graphics_prebuild_{unset,0,1}now run againstAPS5_LIBRARY_PREBUILD:0materialize no registration result, so nothing reaches the prebuild;1materializes the fragment result.agc_driver_prepared_graphicsopts in for its own prebuild checks.These ran on Linux (Mesa llvmpipe, LLVM 20.1.2) and on Windows, on
main6db6a3e and on this change, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1and the Khronos validation layer 1.4.363.1. All 4 pass on both sides on both platforms, with 0 validation messages.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)🤖 Generated with Claude Code