Skip to content

fix(agc): preserve pipeline caches on immediate guest exit - #7474

Open
Dripl1x wants to merge 2 commits into
boykopovar:mainfrom
Dripl1x:codex/ui-lab-immediate-exit-cache
Open

Dripl1x wants to merge 2 commits into
boykopovar:mainfrom
Dripl1x:codex/ui-lab-immediate-exit-cache

Conversation

@Dripl1x

@Dripl1x Dripl1x commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What

This follows the ten-item AnyPS5 graphics and memory-management performance series as item 11: a separate startup/cache correctness fix. It does not contribute to the FPS table.

Homebrew UI Lab can hit its submission-retirement timeout during a cold pipeline compile and exit immediately. Immediate guest exit terminates the host process without unwinding the Vulkan device, so its pipeline cache can be lost and the next launch repeats the failure. Register one host exit-drain callback, save the existing device's pipeline cache through SaveNow before process termination, and bound the drain to eight seconds. Reject null/conflicting registration, consume the callback once, report exceptions and preserve the final trace flush/termination path. The general immediate-exit behavior is tested independently of this title.

Tested

Rebased onto main 5057673804b28d217559010d7ac1f702824f240b; current head 2f5282560358c1485c593bdbde7bc2691ca3dde0. The constructor conflict is resolved by preserving main's MapDriverMemory() initialization and registering the cache-saving exit callback immediately after it. The owned seven-file change is retained. Runtime and title evidence below predates this rebase; no fresh build/test or FPS result is claimed for the rebased head.

Windows 11 Pro build 26300 and native Ubuntu 26.04 on the ext4 mirror: 9/9 targeted exit tests passed on each OS. The new drain case covers delayed completion before final flush, a throwing callback and a callback that blocks past the eight-second bound. Existing requested/system/immediate/quick/nested exits, main return and finalizer-before-shutdown cases pass. The negative control without the callback drain fails. Conventions and whitespace checks pass.

Controlled UI Lab cache-state comparison on the pinned base: without the fix, two cold-start attempts fail; with it, the first run still exits with code 1, preserves completed cache work, and the second reaches rendering (28.63 seconds, 255 recorded presents). This fixes cache preservation across the initial failure; it does not remove the guest's cold-start timeout or make the first launch continue into the UI. Work that cannot finish its cache save inside eight seconds can still be lost. No FPS gain or complete startup-failure cure is claimed. GPU: NVIDIA RTX 3070 Laptop, NVIDIA 617.42, Windows 11 Pro build 26300.

Base 6447ed1ed7fd11c7eef60df336e8d66fac271188, local topic head cf0615a3c1a0f758628e4d75a7d1ae33ec8cadab. Runtime evidence predates this commit and is tied to its saved module hashes and the same owned seven-file source change. The Windows/Linux tests above were rerun before committing.

Dependencies, series and overlap

No dependency on the ten performance patches; place this after them in the publication order. #6958 changes periodic cache snapshots and leaves SaveNow blocking; this fix calls SaveNow during a bounded immediate-exit drain. #6771 changes the cache file's versioned location, not immediate-exit persistence. Neither is claimed as this fix. The item-10 resident-import/artwork repair is a different bug and remains in item 10.

The overlap audit checked 787 open PRs and this branch merges cleanly into main e5c2b3c325e485ba7fd417c47c46f48aa2c89115. #6160 inserts driver-memory initialization at the same constructor site; manual inspection shows a separate AGC FS-table implementation. Keep both initializers when resolving that textual conflict. #6248 supplies macOS executable-path handling in the shared exit test; #6044 relocates tests. These are integration overlaps, not exit-drain dependencies. Related issue #4399 describes the cold compile exceeding the guest retirement budget; this PR preserves cache work rather than removing that budget.

The dedicated overlap report is retained in the common series evidence package. Measurements and focused tests refer to the pinned source revision above; no full-suite CI run is claimed. A Game bring-up discussion/title ID link has not been verified, so none is invented on the checklist.

Checklist

  • Rebased onto main 5057673804b2; constructor conflict resolved preserving both initializers; historical validation scope is listed above
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none (UI Lab cold-cache relaunch recovery)
  • GPUs tested: NVIDIA RTX 3070 Laptop, NVIDIA 617.42, Windows 11 Pro build 26300
  • AI-assisted: yes

The historical test snapshot above predates the current rebase; its results are not presented as tests of the rebased tree.

Series index

These are the ten performance topics from the same profiling effort, followed by a separate UI Lab cache-preservation fix. Membership in the series does not imply a dependency.

Item Pull request Required dependency
01 #7464: perf(agc): keep unimported label stores on the CPU #6658
02 #7465: perf(agc): defer small host imports until first GPU use none
03 #7466: perf(agc): validate host imports through their registered owner none
04 #7467: perf(libc): avoid repeated Windows path component scans none
05 #7468: perf(libkernel): find direct-memory aliases through the physical index none
06 #7469: perf(libkernel): find free direct-memory ranges in allocation order none
07 #7470: perf(libc): release exact resident mappings without repeated queries none
08 #7471: perf(libc): collect resident writes directly into the output buffer none
09 #7472: perf(libc): reuse saved direct-memory buffers when unreferenced none
10 #7473: perf(libc): skip write-watch queries for proven clean resident ranges #7471
11 #7474: fix(agc): preserve pipeline caches on immediate guest exit none

Reproduction evidence

Series traces, summary lines, module hashes, focused-test logs and UI contact sheets. Game measurements use the pinned base and source revisions described above; assets contain no game binaries.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 1395 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5431 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6044 core/libs/prx/libSceSystemService/CMakeLists.txt
core/libs/tests/GuestSystemExit.cpp
PR 6146 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6290 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6683 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6788 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6887 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6960 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6965 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6973 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6987 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6989 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6995 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7201 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/tests/GuestSystemExit.cpp
PR 7233 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7292 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7332 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7484 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7622 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libc/src/Process.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7827 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp

@github-actions github-actions Bot added libc build prx agc libSceAgc* needs rebase Conflicts with main, rebase needed labels Oct 18, 2026
Complete the publication checklist and series cross-links for boykopovar#7474.
No source or test changes.
@savvaniss

Copy link
Copy Markdown
Contributor

Intel and AMD Windows data: the 10 tests built from tests/GuestSystemExit.cpp pass with this PR on an Intel UHD 770 and an AMD RX 9070 XT.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head 2f5282560 merged into main f3059421f.

Tests, ×3 UHD 770 RX 9070 XT
This head: the 10 tests built from tests/GuestSystemExit.cpp 10 of 10 pass 10 of 10 pass

The test files don't build on main without the rest of the PR, so there is no before-run.

I also ran full CTest with this PR and the 14 other open AGC PRs I tested in the same batch merged together (#7647, #7641, #7630, #7627, #7603, #7600, #7591, #7579, #7535, #7533, #7462, #7050, #7048, #7650). Neither GPU showed a failure beyond main's own, except #7650's new test.

AI-assisted: yes (Claude Code)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants