fix(agc): trace the title threads that register shaders #7293
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7293"
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 milescoviello on 2026-10-17T21:41:57Z.
What
Driver::RegisterShader,ResolveShaderAbi,ResolveGraphicsAbiandResolveGraphicsStagesAbirun on the title's own threads (sceAgcCreateShaderand the ABI calls oflibSceAgc). Those threads never callPerformanceTrace::BindThread, soPerformanceTrace::Thread()is null there. TheirShader.RegisterandShader.Resolve*scopes, and anyShader.PrepareArtifactwork they do inline, were missing from everyAPS5_TRACE_*trace and summary. The summary still saidtrace_dropped: false.Each of the four entry points now binds the calling thread first, when a trace is configured, as
title. It uses the 32,768-event buffer the shader preparation threads use (TraceThread::DefaultCapacity / 8).BindThreadreturns at once for a thread that is already bound, such as a queue worker. Without a trace switch, nothing is allocated.docs/dev/BUILD.mdnames the new buffer next to the shader preparation ones.#6341 does the same for the draw committer thread. This PR binds different threads and puts its test entries in another part of the CMake test block, so the two don't touch the same lines.
Tested
Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.02;
maine815fb4170.New
agc_driver_registration_trace(APS5_TRACE_FRAMES=0:1): a new thread registers a pixel shader inside the window. That thread must then hold a trace buffer namedtitle, not dropped, whose slices and totals both have aShader.Registerscope longer than zero.agc_driver_registration_trace_disabledruns it with the trace switches unset; the registering thread must have no buffer.With
main'sShaderRegistry.cppthe traced case fails 3 of 3 witha title thread that registered a shader has no trace buffer, and the disabled case passes. With this change both pass 3 of 3.ctest
^agc_(674 tests): all pass.Forspoken (PPSA03984), warm caches, 130 s with scripted pad input,
APS5_TRACE_SECONDS=45:20, one run of each build. Onmain922dc8999ethe trace has notitlethread, and the summary's eight largest phases are driver and Vulkan scopes. With this PR (f7cd8df309) the trace has seventitlethreads holding 7,047Shader.Registerscopes (14.5 s summed over the threads), 323Shader.ResolveGraphicsStagesAbi(780 ms), 163Shader.ResolveAbi(536 ms) and oneShader.ResolveGraphicsAbi.Shader.Registeris the summary's fourth largest phase, at 500.8 ms per frame:check_conventions.pypasses.pr_overlap.pylists the PRs that editCMakeLists.txtand the two that also editShaderRegistry.cpp(#6946, #6947). None of them binds these threads.Not checked on Windows, macOS, AMD or Intel.
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
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T21:55:01Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/BUILD.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/BUILD.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/BUILD.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txt