perf(agc): journal the pipelines of a run and build them ahead on the next one #5875
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5875"
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 adriadam10 on 2026-10-14T14:31:43Z.
What
Every run compiles its Vulkan pipelines again: the shader cache keeps the recompiled SPIR-V and the driver's
VkPipelineCachekeeps the driver's binaries, but the specialized modules, theVkPipelineobjects and the graphics pipeline libraries are built on the queue worker at the first draw or dispatch of each configuration, underGpuMutex. On a warm run that is the remaining first-use hitch; on a cold run it is paid once per configuration whenever the title reaches it.This PR journals the pipelines of a run and builds them ahead on the next one:
Graphics::CachedPipelineand the compute pipeline creation inVulkanDevice::dispatchappend each pipeline they build topipelines.journal, next to the shader cache entries: the materializedRecompileResultof every stage (specialized SPIR-V, bindings, push constants;ShaderDiskCache::EncodeResult, which existed unused) and aGraphicsPipelineRecipe(stage identities, vertex input layout, descriptor set layout keys and exactly theStatefields thePipelineconstructor reads,CanonicalPipelineState). A writer thread appends; modules and recipes are deduplicated by content; a torn tail from a crashed run is cut at a record boundary before the next append; a header mismatch (format,RuntimeAbi::Version, recompilerSourceVersion, device fingerprint) starts the file over. The file names the GPU and driver it was written for (the properties the driver's pipeline cache file is named by), so another device's modules are never replayed. Two runs sharing the directory take turns onpipelines.journal.lockand keep each other's records; a read failure never starts the file over.VulkanDeviceis created with a window, the journal is loaded and its pipelines are built onhardware_concurrency() / 2threads while the title loads, through the sameCachedPipeline/createComputePipelinepaths and into the same stores, so the first draw or dispatch of a configuration an earlier run already built finds its pipeline resident. A headless device (the oneShaderRegistryor the first draw creates beforeDriver::AttachWindow) starts its replay at its first draw or dispatch instead, since the window's device usually replaces it first; a device cancels its replay before it is replaced or destroyed, and a replaced device destroys its pipelines then. A draw that arrives first builds the pipeline itself; the first inserted wins (find-or-insert, ascomputePipelinesalready did). A replayed pipeline enters the store at its least recently used end and a full store takes none, and its optimized (link-time-optimized) relink waits for the first draw that binds it, so the title's own pipelines come first in both the store and the relink thread.RecompileResult::Identity: a 128-bit hash of the module words (SharedSpirv::ContentHash, computed once per shared module and dropped by a write), the specialization constants, the host subgroup width, the workgroup memory slice and the bindings' shape. It is the same on every run, unlike the process-lifetime variant ids, which is what lets a replayed entry be found; in-process it also lets two results with the same module share a pipeline (a recompile withuseCache = falseused to get its own; the pipeline cache and library tests now change the module rather than the variant id to get a different pipeline). A generated stage (rect-list pair, geometry) is keyed by its identity like the others, since its module depends on device limits. The store key additionally covers the color component mapping, the depth target's sample count and whether a depth bias clamp is set, which the constructor reads (SplitsAlternateAlpha,ValidateSampleLocations, the depth bias clamp feature check) but the key did not name.CachedPipelinebuilds outside the store's mutex, andLinkPipelineFromLibrariesbuilds the library parts and the link outside the library store's mutex (the part build already did so for the registration prebuild): a draw whose pipeline is resident is not held behind another thread's build, and replay threads build in parallel, which drivers that compile in parallel turn into throughput.VulkanDevice::createComputePipelineholds the compute module, layout and pipeline creation thatdispatchhad inline, shared with the replay;APS5_VERIFY_SET_LAYOUTS=1now also checks a dispatch's set layout against the oneDescribeSetLayoutsderives from its shader, which is the layout the replay builds over.APS5_NO_PIPELINE_JOURNAL=1disables recording and replay (the lavapipe test suite, which shares one cache directory, runs with it off except for the journal's own tests);APS5_PIPELINE_JOURNAL_THREADS,APS5_PIPELINE_JOURNAL_ENTRIES(1024, the first recorded, which a run reaches first),APS5_PIPELINE_STORE_ENTRIES(the store's LRU bound, 1024 as before) andAPS5_PIPELINE_JOURNAL_MAX_MIB(1024).APS5_PROFILE_DRAW=1prints a[pipeline-journal]line when the replay finishes and at teardown. The journal is disabled without a shader cache directory.docs/dev/ARCHITECTURE.md,docs/user/USAGE.md(Pipeline journal) and a technical debt entry (append-only file, bounds, the compute layout check, the format number as the codec's only guard, deferred relinks).Not in this PR, on purpose: creating pipelines ahead of the packet on the first run (#4897, #5441, #5115 cover the first-run paths), and any change to what the recompiler emits.
Tested
Linux (Ubuntu 24.04, GCC 13.3, Release,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=OFF), lavapipe (Mesa 25.2.8, LLVM 20.1.2), 4 cores.New
agc_pipeline_journal(agc_driver_graphics_tests --pipeline-journal, mock Vulkan): the recipe codec round-trips byte for byte and refuses every truncation; the store key of the original state, of the canonical state and of the decoded recipe is the same, a field the pipeline does not read (viewport, target address, layers) leaves it unchanged, the component mapping changes it and a depth bias clamp changes it only with depth bias on; identities are shared by copies, change on a write and on specialization constants or subgroup width; the journal records one graphics and one compute pipeline with three modules once, not again on repeat; a replay on a fresh mock device builds the graphics pipeline so the same configuration hits the store without creating, and hands the compute result (words, bindings, push constants, subgroup) to its hook; a tail cut inside the last record's padding is recovered from (the next append is record aligned, nothing is dropped, the cut pipeline is recorded again without its module); a cancelled replay stops cleanly; no Vulkan objects leak.New
agc_driver_pipeline_journal(lavapipe, end to end): a device dispatches a compute program and draws a triangle into an A1R5G5B5 target (both read back and checked), which records two pipelines; a second device replays them before any work (replayedGraphics == 1,replayedCompute == 1, nothing rejected or failed), its dispatch builds no pipeline, its draw finds the replayed one in the store and renders the same texels, and nothing is recorded again. Runs withAPS5_VERIFY_SET_LAYOUTS=1.agc_pipeline_cache,agc_pipeline_library,agc_pipeline_library_fast_only: updated from variant ids to module content (a different variant id with the same module shares the pipeline; a changed module does not).agc_driver_pipeline_journal_tests --benchmark 32(synthetic, 32 distinct compute programs dispatched for the first time on three devices in turn; wall times, lavapipe, 2 replay threads):With lavapipe's own on-disk shader cache disabled (
MESA_SHADER_CACHE_DISABLE=true) every first dispatch costs about 1.5 s on all three runs: lavapipe JITs the shader at the first dispatch, not atvkCreateComputePipelines, so a replay cannot move that cost. The replay moves what the driver does at pipeline creation (here about 20 ms per pipeline with the JIT cached); on drivers that compile at creation (RADV, NVIDIA, ANV) that is the whole compile, which this environment cannot measure.Regression:
ctest -R "^(agc_|shader_|guest_shader_)"on the final build, 536/536 passed (80 skipped for device features lavapipe lacks); the three pipeline tests above included.python3 tools/check_conventions.py --base origin/mainandtools/check_test_registration.py buildpass.An adversarial review pass over the diff (five dimensions: concurrency and lifetime, key correctness, file format, Vulkan semantics, repository rules) found the device replacement race, the uncancellable replay, the shared-directory write hazard, the generated-stage keying, the depth bias clamp, the padding-torn tail, the index decode cost, the read-failure truncation, the relink flood and the store eviction order; all are fixed in this PR with the tests above.
Not run: Windows, a title, a hardware GPU. The journal changes nothing a title renders; what it changes is when pipelines are built, so a title run with
APS5_PROFILE_DRAW=1(the[pipeline-journal]and[pipecache]lines of a second run) is the measurement that remains to be taken.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
https://claude.ai/code/session_01P6hw3kRAuQdfcU9YCZgaoK
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T16:05:58Z.
Rebased on main
e34c47921(after #5861, #757 and #758).569ff84ea: #5861 addedsampleLocationGridandperSampleShadingtoStateand to the pipeline key; the recipe codec andCanonicalPipelineStatenow carry both (thesizeof(State)guard caught it: 664 → 688).agc_pipeline_journalchecks that a grid + per-sample state round-trips and keys the same pipeline; removing the field from the codec makes it fail.ShaderDiskCache.cppsize guards updated to the merged layouts.Linux RADV, libSceAgc + libSceAgcDriver scope: 577/578,
agc_driver_tessellationsegfaults the same onmain. #5925 is stacked on this.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-14T18:01:36Z.
On
maine34c47921with this PR,pipeline_journalpasses on NVIDIA, RADV and lavapipe. My Playroom numbers are on PR 5925, which includes this one, so they don't separate the journal from the lookahead.Two things from reading the code.
APS5_NO_PIPELINE_JOURNAL,APS5_PIPELINE_JOURNAL_MAX_MIBandAPS5_PIPELINE_STORE_ENTRIESare environment switches. AndFileLockcarries on without the lock whenopen/flock(orCreateFileW/LockFileEx) fails, so in that case two runs sharing the directory append without the turn-taking the description promises.Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-14T20:07:25Z.
Windows + NVIDIA title runs, the measurement the description says is missing. Windows 11, RTX 4080 (NVIDIA 616.56), WinLibs GCC 15.2.0 r7, Release:
maine34c47921, this head569ff84ea, and #5925's3339ddd3a, which includes it. The titles are free catalog homebrew: SuperTuxKart (PPSA69421, start screen) and vkQuake (PPSA99010) with LibreQuake data. Each build has its own run directory, so run 1 is cold and later runs replay that directory's journal. Data, gdb stacks and summary lines: https://gist.github.com/orishamir/921d32e578048a87ee791f94cd82713aSuperTuxKart exits with 0xC0000374 (heap corruption) on the first run that replays the journal.
APS5_NO_SUBMIT_LOOKAHEAD=1, ran 100 s.APS5_NO_PIPELINE_JOURNAL=1on the warm run: 0 of 3.main: 0 of 7 warm runs. Later warm runs on the same journal: 1 of 5 (the one right after a crash)._endthreadexfrom libwinpthread). There,libSceAgcDriver.prx's TLS callback runsrun_dtor_list, MinGW's list ofthread_localdestructors, and itsfreereports the corruption. This build uses emulated TLS, andCachedPipeline's newthread_local std::vector<std::byte> key(Pipeline.cpp:944) is one of those variables. A replay thread that builds a graphics pipeline goes throughCachedPipelineand creates it, and those threads exit when the replay ends.keya plain local. The first warm run then crashed in 0 of 3 tries.agc_pipeline_journal,agc_driver_pipeline_journal,agc_pipeline_cacheand the threeagc_pipeline_library*tests.vkQuake's NVIDIA compile stall (#4977) stays. Every run with every build hits
radv/ps5: the GPU has not reached submission 19 (at 18) in 10 sthree times and then quits withvkWaitForFences failed with code -4. With this PR the warm runs replay the journal (15 pipelines, 20 modules, 4.3 MiB, built in 137 ms on 16 threads), so 4 of the 5 large compute modules are built before the demo. The fifth, program 0x20bf92000 (349,278 SPIR-V words), is still created at its dispatch, not by the replay, and the stall follows it in every run.Frame rate: no difference on SuperTuxKart's start screen. In presents per second from 30 s on:
main5.51 cold and 5.79 warm (the session's firstmainarm was slower, 4.42 and 5.14), this PR 5.49 cold, #5925 5.81 cold, #5925 with the lookahead off 5.67 cold and 5.88 warm.AI-assisted: yes (Claude Code Opus 5.5)
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-14T23:22:27Z.
Windows Server 2025, RTX 3060 (NVIDIA 591.86), WinLibs GCC 15.2.0 r7, Release. Head
569ff84ea, controlmain0ae1deb85. This reproduces the 0xC0000374 from the comment above without a title.prx_thread_local_destructors(Windows only, added by #4029; this PR'swindowsCI job was skipped) fails on569ff84ea:libSceAgcDriver.prx: ...CachedPipeline... registers a thread_local destructor. It passes on main.Critical error detected c0000374in libSceAgcDriver.prx'srun_dtor_list<-tls_callbackas a thread exits:agc_driver_pipeline_journal_tests: 10 of 10 (a replay thread)agc_driver_draw_cache_reuse_testswithAPS5_NO_PIPELINE_JOURNAL=1: 10 of 10 (threadqueue worker 0x0); main: 0 of 10. So the journal is not required: any thread that ranCachedPipelinehits it when it exits.auto& key = HostThreadLocal<std::vector<std::byte>, PipelineKeyStorage>();, the #4029 pattern. Both tests: 0 of 10 under gdb, and the check passes.ctest --repeat until-fail:10passes 10 of 10 on the head and with the experiment foragc_pipeline_journal,agc_driver_pipeline_journal,agc_pipeline_cacheandagc_pipeline_library{,_off,_fast_only}.Not tested: a title, Linux, AMD.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T09:01:45Z.
A title measurement of the hitch this PR targets, taken without the PR. I can't run the PR itself on this title yet: our working branch for it sits before a black-screen regression on
main(#5983), and the PR doesn't cherry-pick onto it cleanly. I'll post the with/without numbers once one base runs both.Onimusha: Way of the Sword (PPSA27836), Windows 11, RTX 5070 (NVIDIA 617.42), warm shader cache (0 misses),
APS5_TRACE_SECONDS=5:40across the first settings screens (language, brightness, gamma), commit317b85f04:Frame times: 270 presents. Frame ms p50 17.1, p90 359.0, p99 1209.8, max 3312.9. GPU busy 8.2 ms per present.
Per frame, top phases:
Driver.Packet269.0 ms,Driver.Packet.memory_wait131.9,Shader.PrepareArtifact124.2,Driver.Packet.dispatch81.8,Vulkan.Dispatch.shader_resources65.9.The slowest frames are the screen changes. Each one is dominated by pipeline creation on a warm cache:
Shader.PrepareArtifact20.2 s summed over the prepare threads,Vulkan.GraphicsPipelinePrebuild1.3 s,Vulkan.GraphicsPipeline1.3 s,Vulkan.GraphicsPipelineLibrary1.3 s.Vulkan.GraphicsPipelinePrebuild722 ms,Vulkan.GraphicsPipeline714 ms,Vulkan.GraphicsPipelineLibrary543 ms.The other slow frames (1.0 to 1.5 s) mix
Shader.PrepareArtifact(0.5 to 1.1 s) withDriver.Packet.memory_waiton one queue worker (0.4 to 1.0 s).So on this title the warm-run hitch the description names ("the remaining first-use hitch") is real and large. It's worth up to seconds per screen change. Trace and summary line available on request.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:54Z.
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/tests/Graphics.cppL3629-3632core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppL318core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL3-4, L7, L713core/shader/recompiler/ShaderDiskCache.cppL89core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL6-7, L713core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL4447-4500core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL4447-4500core/libs/prx/libSceAgcDriver/tests/Graphics.cppL7266core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL7core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL4447-4500docs/dev/debt/libSceAgcDriver.mdL66core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL8-9, L1930core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL3-4, L7, L713core/shader/recompiler/ShaderDiskCache.cppL89Some 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.
core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/user/USAGE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppdocs/dev/debt/libSceAgcDriver.mddocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/CMakeLists.txtdocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppdocs/dev/ARCHITECTURE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Graphics/include/PipelineLibrary.hppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineLibrary.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T14:32:38Z.
Rebased onto main
940eba9a2and fixed what the Windows runs found:VulkanDevice::computePipelinekeeps #5989's in-flight futures, now keyed onComputePipelineKey(module identity + push constants) instead of the variant id; its body iscreateComputePipeline, shared with the journal replay and recording the pipeline in the journal.ReplayComputePipelineskips a key that a preparation is already building. Since programs that recompile to the same module now share one pipeline,agc_driver_compute_pipeline_outside_gpu_mutex's "new" program (the old one behind ans_nop) reused the first pipeline and the test timed out. Its new program now also stores to the second word, so it gets its own module. TheAPS5_VERIFY_SET_LAYOUTScheck andPreparedDispatch::objectsfrom main are kept.CachedPipeline'sthread_local std::vector<std::byte> keyis nowHostThreadLocal<..., PipelineKeyStorage>()(the #4029 pattern). This fixes the 0xC0000374 on thread exit that @orishamir and @fdfawef324 reported, andprx_thread_local_destructors. Thanks to both of you for the gdb stacks and the experiment.FileLock: as @fma-rc pointed out, a failedopen/flock(CreateFileW/LockFileEx) used to append without taking turns. The journal now records nothing while it cannot lockpipelines.journal.lock, and reports it once. USAGE.md says so.instancePatches/drawParameters). The recipe now carries them andCanonicalPipelineStatecopies them,FileFormatis 2, and the layout guards match the new sizes.pipeline_journalround-trips a masked 4-sample state and checks that it keys the same pipeline again.ShaderDiskCache.cppsize guards set to main's layouts (232/200/440); the docs and the test dispatch (--unused-stencil-reference/--pipeline-journal) keep both sides.Linux build and ctest of libSceAgc + libSceAgcDriver on the rebased head: build OK, 630 of 633 tests green. The 3 that fail are unrelated:
agc_driver_tessellationalso segfaults on main with this RADV, andstore_over_untracked/preparation_scope_settleare flaky (they pass on rerun). The full Build (Windows included) runs before the merge.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T09:31:54Z.
The full Build's Windows job failed 11 tests that
mainpasses (guest_shader_link,agc_shader_helpers,guest_video_out_*,video_out_*), all withC++ exception St12system_error ... libSceAgcDriver.prx has no unwind dataright after a test finished.Driver::ShutdowncalledFlushPipelineJournal(), which instantiated theJournalsingleton and started its writer thread while the process was exiting, even on a run that recorded nothing.FlushPipelineJournalnow only flushes a journal that already exists. Pushed as cb73747b2 (rebased on main5d9dcc42d).Linux build and ctest of libSceAgc + libSceAgcDriver: green except
agc_driver_tessellation, which also segfaults on main with this RADV; the lavapipe rerun passed 608/608. The Windows job has to confirm the fix; the full Build runs again before the merge.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T09:57:48Z.
Rebased onto main
332b0b1b7(after #6371 and #6372). The only conflict was the include list ofDriver/Lifecycle.cpp; bothAsyncLog.hppandPipelineJournal.hppare kept, nothing else changed.Linux build and ctest of libSceAgc + libSceAgcDriver (639 tests): green except
agc_driver_tessellation, which also segfaults on main with this RADV. The full Build (Windows included) runs before the merge and has to confirm theFlushPipelineJournalshutdown fix.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T11:01:17Z.
Rebased onto main
72c5eed1f. The only conflict was theRecompileResultsize guard inShaderDiskCache.cpp(main's layout is 496 bytes, this PR's change to it brings it to 464); nothing else changed.Linux build and ctest of libSceAgc + libSceAgcDriver (649 tests): green except
agc_driver_tessellation, which also segfaults on main with this RADV. The full Build (Windows included) runs before the merge and has to confirm theFlushPipelineJournalshutdown fix.