fix(agc): skip the first-visit library prebuild for a pipeline the async build defers #26196
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26196"
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 oneandonlydean on 2026-11-23T12:47:28Z.
What
Since #25434, commitDraw calls PrebuildGraphicsLibrariesOnFirstVisit
before the draw reaches the APS5_ASYNC_PIPELINE_WORDS check, so a large
first-visit pipeline is compiled on the draw-commit thread again and the
deferral no longer helps. The prebuild now returns early when
DefersPipelineBuild says the deferred-build thread will build it. The
default path (APS5_ASYNC_PIPELINE_WORDS unset) is unchanged.
Fixes #26186.
Tested
On #26186, Jazeupoi (PPSA47770, RTX 2060, Windows 11) exits 4 of 4 runs on main and runs 3 of 3 with #25434 reverted. The change is one early return in
VulkanDevice::PrebuildGraphicsLibrariesOnFirstVisit: it returns early whenGraphics::DefersPipelineBuild(shaders)is true, the same predicateGraphics/src/Draw.cppuses to defer. The default path (APS5_ASYNC_PIPELINE_WORDSunset) is unchanged. Not compiled locally; CI builds it.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)Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T12:59:20Z.
Review: CHANGES_REQUESTED
The threshold gate restores the normal cached async route. The documented cache-off combination below still needs the off-lock first visit.
I checked the exact base and head routing and deferred queue in a native Windows CPU fixture using mock pipeline/library creation. For the cache-enabled async path, eight stress runs per arm kept one outstanding build across 64 repeat attempts per run, retained the copied program/view data, waited for the worker at device drain, and handed a worker failure back to the synchronous path. The head skipped the early prebuild. The fixture creates no Vulkan device. The existing Afterglow request in #26186 is the separate title/GPU check.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-23T14:17:11Z.
Review: COMMENTED
@oneandonlydean the Afterglow check you asked for in #26186, on exactly
8f9a9cae20: it defers the build and keeps presenting, 2 of 2 runs.Setup: same machine as #26186. Windows 11 Pro (build 26300), AMD Ryzen 5 3400G, NVIDIA GeForce RTX 2060 (driver 621.24, Vulkan 1.4.357), WinLibs GCC 15.2.0 r7, Release. The tree was checked out at
8f9a9cae20with no other change, andlibsandrelinkerwere built from it. Afterglow (PPSA47770), catalog 01.000.006,APS5_ASYNC_PIPELINE_WORDS=100000andAPS5_PROFILE_DRAW=1. Before each run the NVIDIA shader cache (%LOCALAPPDATA%\NVIDIA\DXCacheandGLCache) was moved aside as before, and it was restored after each run.[pipecache] deferred buildsubmission retirement faileddeferred build 0x11fccc541fe21fb6 queued, its draws are skipped until it is residentBoth runs were still alive when stopped at about 95 s and draw the title's "Flashing lights" notice. On
mainf5b7e1d1acthe same check exited in 4 of 4 runs (#26186).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T15:03:38Z.
Review: APPROVED
Re-reviewed exact head
8f9a9cae20d7c67537df81e64ba09e9ce214f9b9. This resolves my cache-off first-visit blocker.In an exact production-slice A/B, the previous head performed 0 prebuilds and reached 64 simulated lock-held first visits with the pipeline cache disabled. This head performed all 64 builds off-lock with 0 lock-held misses; eight strict repeats passed. The default path still prebuilt all 64, while the async path used its two workers, copied inputs safely, preserved failure fallback, and drained. Null/empty shader identities no longer enter deferred state, while a valid SPIR-V identity remains deferable.
I also read the complete exact-head Hosted Windows log. It compiles and links
agc_driver_graphics_tests.exe, startsagc_pipeline_deferred_build_cache_offas test #2694, and passes it in 0.03 s; the normal deferred-build test #2693 also passes in 0.03 s. The job reports zero failures across 5,579 tests, and every applicable check is successful.No physical GPU or Afterglow title run was performed or inferred here; the open title report remains separate. This approval is limited to the exact commit above.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T08:24:27Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected logic and added regression coverage support the stated fix.
What I ran
Reviewed head
8f9a9cae20d7c67537df81e64ba09e9ce214f9b9and the prepared diff. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not run CI, compile the change, or run the added tests. Read the changed sections of
VulkanDevice.cpp,Pipeline.cpp,Graphics.cpp, andagc_driver_graphics_tests.cmake, plus the draw call sites inDraw.cpp. The remainder ofGraphics.cppandVulkanDevice.cppwas not read; no claims are made about those sections. The author reports CI builds the change and describes hardware runs in the PR description; these were not independently verified.To get this to a good state
Nothing is required.