fix(agc): drain the registration preparation pool before the device i… #2909
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2909"
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 queeeef on 2026-10-10T18:23:29Z.
What
Fixes #2891. Background registration preparations (#2583) copy the device's
SpirvTarget, whose capability and extension spans point into the device's shader profile.Driver::stopjoined the queue workers and reset the device without waiting for the detachedRegistrationPreparePool, so a preparation still queued or running read freed extension names inRecompileCacheKey::appendInterface. This is theagc_drivercrash at exit on RADV that #2891 and the review of #2589 report.RegistrationPreparePool::Closestops queueing and waits until no task is queued or running.Driver::stopcalls it (CloseRegistrationPreparation) after joining the queue workers and beforedevice.Reset(). The pool counts running tasks and destroys each task's captures before it reports idle.RegisterShaderholds its ownshared_ptrto the device for the duration, so the spans stay valid. ThrowingProcessShutdownthere instead would also be possible; happy to switch if preferred.PrepareRegisteredInBackgroundsubmits throughSubmitRegistrationPreparation, which the test also uses.This is the drain Celegans12 asked for in the #2583 review ("Could the pool be included in shutdown").
Tested
Linux (Ubuntu 24.04, GCC 13.3), lavapipe (Mesa 25.2.8), main at
57f96fd. Full build with-DANYPS5_ENABLE_SPIRV_TOOLS=ONand the CI ctest invocation (--parallel 4 --timeout 120).agc_driver_registration_prepare_shutdown(0.2 s, no GPU needed): a latch-based shutdown test. A task on the preparation pool blocks on a latch while another thread runsLibcRunShutdown_nid_postfix. Shutdown must not return before the latch is released and the task has finished. A preparation submitted after shutdown must run on the caller's thread. It fails without theClosecall inDriver::stop("shutdown returned while a registration preparation was still running"). It also fails whenCloseignores running tasks, and whenSubmitignores the closed pool. It passes 30 of 30 repeated runs.guest_avplayer(links onlylibSceAvPlayerandlibc), aborted once under parallel load and passed 10 of 10 reruns alone and 10 of 10 under GPU load; it is unrelated.agc_driver_flat_storeis the only test over 30 s (50 s), as on main.agc_driver_tests: 0 of 30 runs fail. It also did not crash on main here; the crash needs RADV or NVIDIA timing. @SleglJan and @adriadam10, could you rerun your loop (7/8 and 10/30 crashes on main) with this branch?tools/check_conventions.pyandtools/check_test_registration.pypass.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 (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T18:33:08Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T18:33:53Z.
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.
main)core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hppL12, L91-92Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-10T19:07:28Z.
@queeeef Rerun of the #2891 loop on RADV, as you asked.
Setup: Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), Release with
BUILD_TESTING=ONandANYPS5_ENABLE_SPIRV_TOOLS=ON. RADV is Mesa 26.2.4 on the Ryzen 9 7950X3D's iGPU (gfx1036), selected withVK_DRIVER_FILES; the RTX 3080 runs NVIDIA 615.71.09.ctest -R '^agc_driver$'ran alone, one run at a time, in the same build directory:8153d5abwas built and run first, then57f96fd2was rebuilt and run.main57f96fd2(the commit's parent)8153d5ab8153d5abmainwas 0 of 8 there in #2891, so this only checks for regressions)agc_driver_registration_prepare_shutdownpasses 30 of 30.Since the intake pause closed this PR: if you and the maintainers are OK with it, I can open it under my account with your commit unchanged and you as the author.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by queeeef on 2026-10-10T19:11:45Z.
I'm fine with that
Pull request closed