Skip to content

fix(agc): reapply pipeline cache persistence with guarded key queries - #15169

Merged
adriadam10 merged 5 commits into
boykopovar:mainfrom
liskeee:fix/agc-pipeline-binaries-reland
Nov 9, 2026
Merged

adriadam10 merged 5 commits into
boykopovar:mainfrom
liskeee:fix/agc-pipeline-binaries-reland

Conversation

@liskeee

@liskeee liskeee commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What

I reapply #13931, reverted in #14839: driver pipeline caches survive source updates, and eligible compute pipelines are captured and restored with VK_KHR_pipeline_binary, with ordinary driver-cache fallback. Against merged main 6773f91a7e I keep main's recorder error handling, debt entries, APS5_HEADLESS_PIPELINE_CACHE loading condition and portability-subset test features, and link the store test against libSceAgcDriver because DeviceProcLookups moved out of the header. The binary layout key also tells main's scratch-pool layouts apart (0, 1 or 2 additional descriptor sets); layouts without a scratch pool keep the same contribution to the key.

New in this PR: global and per-pipeline key queries write into separate, 64-byte-aligned heap scratch followed by a 64-byte guard filled with 0xa5, and a key is accepted only after VK_SUCCESS, an intact guard, the expected sType, a null pNext and a size from 1 to VK_MAX_PIPELINE_BINARY_KEY_SIZE_KHR.

 PipelineBinaryStore(...)
   resolve vkGetPipelineKeyKHR ...
-  getKey(device, nullptr, &globalKey)
-  enable if VK_SUCCESS and 1 <= keySize <= 32
+  getKey(device, nullptr, &guardedScratch.key)
+  enable only if VK_SUCCESS, guard intact, sType unchanged, pNext null, 1 <= keySize <= 32
+  copy the validated key into globalKey
+  else: stay disabled, log once, use the driver pipeline cache

A rejected per-pipeline key falls back to an ordinary build for that pipeline. I have not found the cause of the NVIDIA Linux startup crash in the code: the call uses the Khronos function-pointer type from the device resolver, the output structure is initialised, and the feature is enabled before the call. These checks detect malformed keys and writes that reach the guard; they cannot contain arbitrary driver corruption or clobbered registers, and they cannot stop a crash inside the call. APS5_NO_PIPELINE_BINARIES still turns the store off before the call.

Tested

Windows, NVIDIA GeForce RTX 4080, driver 610.88, and the affected Linux RTX 4090 (run by @oneandonlydean). No title or performance claim.

  • RTX 4090, the machine from revert(agc): keep driver pipeline caches and costly compute pipeline binaries across updates (#13931) #14839 (Linux, NVIDIA 610.57.04, result): @oneandonlydean ran the command from the previous description at c8244e0269 merged with the main of that day and reports 28/28 passing with VK_LAYER_KHRONOS_validation and 28/28 without it, no VUID- line and no crash, with the startup test reporting store ready on that device. I treat this as startup and store coverage, not a full game boot.
  • main vs this PR, RTX 4080, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -j 1 -V, the 139 existing tests registered in the files this PR touches (pipeline cache, recorder and Vulkan test-device tests): main 6773f91a7e 139/139, this PR 1202ace37c 139/139 (the later be14e4c25e changes only the debt entry's coverage sentence). The validation layer loaded in both logs, neither reports a missing requested layer, and neither has a VUID- or SYNC-HAZARD- line.
  • Store tests: 12/12 pass. The new cases cover the query arguments, zero, oversized and maximum key sizes, a changed sType or non-null pNext for global and per-pipeline keys, a corrupted guard and the fallback after a rejected global key. The new tests require the added scratch type and IsReady. With the startup test, agc_pipeline_binary_vulkan and three agc_pipeline_cache_allocation modes, all 17 tests this PR adds pass under the settings above.
  • agc_driver_pipeline_binary_startup (new): creates the production device with the shader cache enabled in a temporary directory and requires the store to be ready when the device has VK_KHR_pipeline_binary (exit 77 with skipped, the device lacks VK_KHR_pipeline_binary otherwise). On the RTX 4080 it prints pipeline binary startup: global-key query completed successfully; store ready; device=NVIDIA GeForce RTX 4080; driver=NVIDIA 610.88.
  • Cache enabled (neither ANYPS5_NO_SHADER_CACHE nor APS5_NO_PIPELINE_BINARIES set, validation layer loaded), RTX 4080: 103/103 pass: the startup test, the binary-store and pipeline-cache tests, agc_driver_small_copy_sync, both agc_driver_address_passes tests, the other agc_driver tests that do not disable the cache, and the automatically added agc_driver_pm4_replay fixture (which disables the shader cache itself). No VUID- line. agc_pipeline_binary_vulkan saves binary records for two pipelines and restores both in the next process. On main 6773f91a7e, the 85 of these tests that exist there, plus the fixture, pass 86/86. The binary round-trip test uses trivial shaders and an empty layout, so it does not test scratch-pool layouts.

Checklist

  • Based on current main; no other open PR implements the same functions
    Merged with main 6773f91a7e, without a force-push. tools/pr_overlap.py --branch on 11-09: of the 295 open PRs that share files or exports with this branch, none of those it could compare has conflicting lines; 94 conflict with main themselves, so it could not compare them and failed closed (mostly VulkanDevice.cpp, Recorder.cpp, CMakeLists.txt, ENVIRONMENT.md and the debt file). A GitHub search found no open PR implementing driver pipeline caches or pipeline binaries.
  • 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 unimplemented exports or silent stubs are added.
  • 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
    No third-party code is added.
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4080, driver 610.88, Windows; NVIDIA GeForce RTX 4090, driver 610.57.04, Linux (startup and store tests, by @oneandonlydean)
  • AI-assisted: yes

🤖 Generated with Claude Code

liskeee and others added 2 commits November 2, 2026 20:06
…naries across updates

Re-apply boykopovar#13931, reverted in boykopovar#14839, including the maintainer's
architecture notes and pipeline-binary skip message.

Preserve main's Recorder TestConfigurationError handling while restoring
the binaryTest constructor argument. Retain main's debt entries.

Link the binary-store test against libSceAgcDriver after main moved
DeviceProcLookups out of the header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On an NVIDIA Linux driver, device creation crashed right after the global
pipeline-binary key query returned VK_SUCCESS, so boykopovar#13931 was reverted in
boykopovar#14839. The cause is not established. Key queries now write into a guarded
scratch output, and the store is enabled only when the result, sType, pNext,
key size and guard are all valid; otherwise it stays disabled with one log
line and the driver pipeline cache is used. This catches bounded output
overruns and malformed keys, not a driver that corrupts registers.

agc_driver_pipeline_binary_startup creates the production device with the
shader cache enabled and requires the store to be ready where the device
has VK_KHR_pipeline_binary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the descriptor-layout conflict in VulkanDevice.cpp: keep main's
scratch pool layouts and let the binary key tell 0, 1 or 2 extra sets
apart, so keys of layouts without a scratch pool stay the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xuZ6BonuXDhiVUjiuoLx2
@liskeee

liskeee commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean I merged main d893997f1a into this branch and updated the results in the description. When you have time, could you run the command from the description on the affected RTX 4090 and share the startup line or the crash backtrace? I'll keep this as a draft until then.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8212 docs/dev/ARCHITECTURE.md L144
PR 9508 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L6062-6064, L6104
docs/dev/ARCHITECTURE.md L144
docs/user/USAGE.md L484
PR 9875 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp L55
PR 12840 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L428, L6062-6063
PR 15792 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp L620, L669
PR 15917 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp L82
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L4568
PR 16572 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L2031, L2263

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 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/user/USAGE.md
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/ARCHITECTURE.md
docs/dev/debt/libSceAgcDriver.md
docs/user/USAGE.md
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ARCHITECTURE.md
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6804 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6924 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/ENVIRONMENT.md
PR 7464 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_pipeline_cache_allocation_tests.cmake
docs/dev/ARCHITECTURE.md
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
docs/user/USAGE.md
PR 7643 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 7684 docs/dev/ARCHITECTURE.md
PR 7689 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8004 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/ENVIRONMENT.md
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8707 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/debt/libSceAgcDriver.md
PR 9289 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
PR 9345 docs/dev/ENVIRONMENT.md
docs/user/USAGE.md
PR 9356 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ARCHITECTURE.md
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 9387 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ARCHITECTURE.md
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9748 docs/dev/debt/libSceAgcDriver.md
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 9884 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9915 docs/dev/debt/libSceAgcDriver.md
PR 9950 docs/dev/debt/libSceAgcDriver.md
PR 10049 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_pipeline_cache_allocation_tests.cmake
docs/dev/ARCHITECTURE.md
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
docs/user/USAGE.md
PR 10359 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
docs/dev/ENVIRONMENT.md
PR 10652 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 10757 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 11435 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 11436 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 11551 docs/dev/debt/libSceAgcDriver.md
PR 11587 docs/dev/debt/libSceAgcDriver.md
PR 12324 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/ENVIRONMENT.md
PR 12544 docs/dev/ENVIRONMENT.md
PR 12678 docs/user/USAGE.md
PR 12828 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 12849 docs/dev/ENVIRONMENT.md
PR 12904 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13148 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 13251 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
PR 13809 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 13863 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 13920 core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_pipeline_cache_allocation_tests.cmake
docs/dev/ARCHITECTURE.md
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
docs/user/USAGE.md
PR 13929 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
core/libs/prx/libSceAgcDriver/tests/cmake/agc_pipeline_cache_allocation_tests.cmake
docs/dev/ARCHITECTURE.md
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
docs/user/USAGE.md
PR 14212 docs/dev/debt/libSceAgcDriver.md
PR 14262 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
PR 14298 docs/user/USAGE.md
PR 14344 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 14561 docs/dev/debt/libSceAgcDriver.md
PR 14944 docs/dev/debt/libSceAgcDriver.md
PR 14964 docs/dev/debt/libSceAgcDriver.md
PR 15136 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md
PR 15570 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake
docs/dev/ENVIRONMENT.md
PR 15621 docs/dev/debt/libSceAgcDriver.md
PR 16260 docs/dev/debt/libSceAgcDriver.md
PR 16501 docs/dev/debt/libSceAgcDriver.md
PR 16831 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
docs/dev/ENVIRONMENT.md
PR 16880 docs/dev/debt/libSceAgcDriver.md
PR 17024 docs/dev/ENVIRONMENT.md
docs/dev/debt/libSceAgcDriver.md

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @liskeee,

Ran your command on the affected RTX 4090 machine (NVIDIA driver 610.57.04, Linux), at head c8244e0269 merged with current main, one test at a time.

  • With the validation layer loaded (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation): 28/28 passed, no VUID- line, no crash.
  • Same command without the layer: 28/28 passed.
  • Startup line in both runs: pipeline binary startup: global-key query completed successfully; store ready; device=NVIDIA GeForce RTX 4090; driver=NVIDIA 610.57.04
  • The [pipeline-binary] disabled: ... lines in the logs come from two of the store tests, which exercise the disabled paths (old validation layer, unusable key); the startup test itself reports store ready.

So vkGetPipelineKeyKHR did not crash here and the store came up on both runs. This only covers the startup/store tests in your command, not a full game boot.

liskeee and others added 2 commits November 9, 2026 14:02
Resolve two conflicts with main 6773f91. VulkanDevice.cpp: keep
main's APS5_HEADLESS_PIPELINE_CACHE loading condition and the binary
store creation. tests/Recorder.cpp: keep main's portability-subset
features next to maintenance5, pipeline binaries and the internal
cache control, both in the device feature chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@liskeee

liskeee commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Thank you for running it on the RTX 4090. 28/28 with and without the validation layer and store ready at startup is the result I was waiting for.

I merged main 6773f91a7e into the branch to clear the conflicts (VulkanDevice.cpp, tests/Recorder.cpp) and re-ran the comparison on my RTX 4080: main 139/139, this PR 139/139, cache enabled 103/103, no VUID-. The description has the updated numbers. As you noted, your run covers the startup and store tests, not a full game boot, and the description says so.

I'm marking it ready for review.

AI-assisted: yes (Claude Code)

@liskeee
liskeee marked this pull request as ready for review November 9, 2026 13:41
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 9, 2026
@adriadam10 adriadam10 self-assigned this Nov 9, 2026
@adriadam10
adriadam10 merged commit 7259cce into boykopovar:main Nov 9, 2026
15 of 16 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the key-query guards, the fallback paths (rejected key, missing/corrupt/rejected binary, capture failure), the device extension list, the legacy cache import and the docs against the diff. @oneandonlydean's RTX 4090 run (28/28 with and without validation, store ready) covers the startup crash path; the missing disk eviction is recorded in the debt entry. Merged.

oneandonlydean added a commit that referenced this pull request Nov 10, 2026
This reverts merge commit 7259cce,
reversing the changes made to 3cd86e6.

Main crashes at boot with SIGSEGV in PipelineBinaryStore::queryKey
(PipelineBinaryStore.cpp:42), called from the PipelineBinaryStore
constructor in VulkanDevice::VulkanDevice during Driver::AttachWindow.

Two-point check on one title (PPSA31246), RTX 4090, NVIDIA proprietary
driver, 10 alternating 25 s boots per build:
- 3cd86e6 (main just before the merge): 0 of 10 crashed
- 7259cce (the merge): 6 of 10 crashed at 2.1-2.5 s, before any present

The crash is intermittent, so one clean boot proves nothing. The root
cause in queryKey is not investigated here; this is an exact inverse
of the merge so the change can come back once it is fixed.
oneandonlydean added a commit that referenced this pull request Nov 10, 2026
revert(agc): revert #15169 pipeline binary store reland
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @liskeee,

Thanks for the reland. We've had to revert it in #17982 for now: main started crashing at boot, and a bisect points at this merge.

What we saw (RTX 4090, NVIDIA proprietary driver, Linux, one title, 10 alternating 25-second boots per build):

  • main just before the merge (3cd86e6): 0 of 10 crashed
  • the merge (7259cce): 6 of 10 crashed 2.1-2.5 s in, before the first present

Every crash has the same stack:

PipelineBinaryStore::queryKey (PipelineBinaryStore.cpp:42)
PipelineBinaryStore::PipelineBinaryStore
VulkanDevice::VulkanDevice
Driver::AttachWindow
VideoOutDriver::presentLoop

It is intermittent, so a single clean boot doesn't rule it out. We haven't dug into why queryKey faults there (for example whether vkGetPipelineKeyKHR can be unresolved at that point, or what the call is given during device construction).

The revert is an exact inverse, so the change can come straight back. A reland with a fix for queryKey is very welcome, and we're happy to run the same boot loop on it before it lands.

@Tamalero

Tamalero commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The cause of the queryKey boot crash, from a machine where it reproduces every time: NVIDIA's vkGetPipelineKeyKHR returns VK_SUCCESS with the low 32 bits of rbx set to zero. rbx is callee-saved, and queryKey holds the guard pointer in it across the call, so the guard check right after the call reads through 0x....00000000.

Setup: Linux, RTX 4090, NVIDIA 620.70.06 (libnvidia-glcore.so.620.70.06), Release, main 561fb7672f (has 7259cce111).

Reproduces without a title. With no Vulkan layers (VK_LOADER_LAYERS_DISABLE='~implicit~'), 4 of the 16 tests matching pipeline_binary|agc_driver_pipeline_journal fail, the same 4 in 3 of 3 runs:

  • agc_driver_pipeline_journal: SIGSEGV
  • agc_driver_pipeline_journal_undecodable_module: SIGSEGV
  • agc_driver_pipeline_binary_startup: SIGSEGV
  • agc_pipeline_binary_vulkan: capture failed: Segmentation fault

Registers around the call, from gdb on agc_driver_vulkan_test_device_tests --pipeline-binary-startup, with breakpoints on the call *%r12 in queryKey and on the next instruction. This is the global-key query (pPipelineCreateInfo == NULL):

rbx rbp r12 r13 r14 r15 rsp eax
before 0x555555dc97b8 0x555555dc9780 0x7ffff493fa40 0x55555598a1c0 0 0x7fffffff340c 0x7fffffff3390
after 0x555500000000 same same same same same same 0
  • r12 (the function pointer) is inside libnvidia-glcore.so.620.70.06. Only rbx changes.
  • The 0xa5 guard bytes after the key are all intact, so the driver did not write past the key.
  • If gdb puts rbx back to rbp + 0x38 after the call, the test prints global-key query completed successfully; store ready; device=NVIDIA GeForce RTX 4090; driver=NVIDIA 620.70.06 and exits normally.

Where it faults. In the Release build, queryKey keeps output + 0x38 (the start of guard) in rbx across the call, then runs:

call   *%r12                 ; vkGetPipelineKeyKHR
...
cmpb   $0xa5,(%rbx)          ; guard check, faults here

Why it is intermittent. After the call, rbx is the heap pointer's upper half with zeros below it.

  • When nothing is mapped there, the boot gets SIGSEGV in queryKey, as in your stack. The kernel line shows the zeroed address: segfault at 7fc400000000 … error 4 in libSceAgcDriver.prx[62e9d9, …].
  • When something is mapped there, the check reads unrelated bytes and the store disables itself with a false [pipeline-binary] disabled: unusable global key (result=0, output overrun). One of our six titles booted that way.

Titles, start-up sweep on 561fb7672f, 240 s each:

  • Guardians of the Galaxy (PPSA01748) ran first, logged the false output overrun and ran normally.
  • High on Life (PPSA15388), LEGO Batman (PPSA16833), Ratchet & Clank: Rift Apart (PPSA01474), Spider-Man Remastered (PPSA01467) and Spider-Man 2 (PPSA03016) all got SIGSEGV 4 to 8 s in, at the same queryKey offset.
  • With APS5_NO_PIPELINE_BINARIES=1, those five reached their usual point from the previous sweep on main d03beaf110.

Driver versions. This is a known NVIDIA driver bug, not a new one.

For a reland: those projects avoid the call on this driver. unicorn_overlord_pc leaves VK_KHR_pipeline_binary off on NVIDIA's proprietary driver, and SpartanPort users turn the binary cache off or hide the extension. NVIDIA hasn't named a public driver with the fix, so a version gate has no known cutoff yet. A thunk that saves and restores the callee-saved registers around vkGetPipelineKeyKHR would also get past it. Restoring rbx in gdb was enough here, but that only covers what this driver build overwrites.

Edited 2026-11-10: the "Driver versions" paragraph said the bug was new in 620 (610 OK, 620 broken, 615 untested). That was wrong. It is a known NVIDIA bug, present since at least 610.47, so the earlier 610 passes were luck. I added the NVIDIA forum report, the other projects that hit it, and their workaround, and updated the reland suggestion to match. The measurements above are unchanged.

Tested and written by Claude (AI assistant) on a contributor's machine.

@liskeee

liskeee commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Thank you, @oneandonlydean, for the crash report and the revert, and @Tamalero for the register trace.

I opened #18082 to re-land the store with VK_KHR_pipeline_binary off by default on NVIDIA's proprietary driver. APS5_UNSAFE_PIPELINE_BINARIES=1 turns it back on for testing, and ordinary persistent pipeline caching stays under its existing controls. On Windows I see the same kind of change: on an RTX 4080 with 610.88 and no Vulkan layers, the global-key query changes rdi from 183a5c7e8d6b4927 to 183a5c7e00000001 in 3 of 3 runs. With the validation layer loaded I saw no register change. The PR lists the commands. I'd be glad if you could run the boot loop on it on the RTX 4090.

AI-assisted: yes

liskeee added a commit to liskeee/AnyPS5 that referenced this pull request Dec 1, 2026
…s off

With an active validation or gfxreconstruct layer older than 1.3.294
on a driver that is not gated, the device leaves VK_KHR_pipeline_binary
off on purpose, and the test failed its check that an allowed driver
enables the extension. It skips there again, as boykopovar#15169 did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants