fix(agc): own a storage texture view before its cache entry can fail #28291
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28291"
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 chitters2004 on 2026-11-29T19:27:40Z.
What
StorageTexturecaches its extra image views (per mip, first layer, UINT, atomic, element layer and attachment) in maps, and each lookup created the view and then inserted it. The insertion allocates a map node; when it threw, the view was owned by nothing and was never destroyed. A depth surface bind whose allocations failed while it stored a displaced single-sample owner's plane through its storage mirror leaked one image view this way, reported asVUID-vkDestroyDevice-device-05137when the device was destroyed.cachedView(c8f856396b). The lookups now go throughcachedView, which inserts the entry first, creates the view into it, and erases the entry again when the creation throws. A view is in the cache as soon as it exists, sorelease()destroys it.New test
agc_driver_storage_view_cache(30 s timeout,VUID-fails it,APS5_ASSERT_GPU_LOCK=1) counts the device's image views throughvkCreateImageViewandvkDestroyImageView.agc_driver_storage_view_cache_no_importruns it again withAPS5_NO_HOST_IMPORT=1, where the element-view case must report itself as not run instead of failing.The failed allocations come from the driver's wrapped allocator (the allocation-failure hook of #28290), which the MinGW and Linux x86-64 test builds link, so both run the insertion failures; other platforms run the failed view creations and the balance checks.
Tested
Red first: without this change every failed map insertion left one view behind (
agc_driver_storage_view_cache, as stated by the commit message).Local gate (Windows 11, RTX 3080, under a GPU claim) on the A to D integration 901ada780ff: A, B and C merged with D on main
6f6f6c8e6b(the later integration head 1ca50acf71a only changes debt wording). Of the 2411^agc_andwindows_mappings_releasetests on the RTX 3080, none fails (2384 pass, 27 skip). On lavapipe 26.2.6, of the 200 tests in the series' set 169 pass and 28 skip; the other 3 (agc_driver_depth_fewer_samples,agc_driver_native_depth_fill_over_pending_import,agc_driver_recorder) fail on main6f6f6c8e6bas well.Fork CI 46289914386 built and ran the same integration 901ada780ff and main
6f6f6c8e6bside by side, with the same test selection:agc_driver_pipeline_journal,agc_driver_alpha_to_coverage_sample_mask_export,agc_driver_runtime_formatted_store_x1,_x2,_x3_d16) andagc_driver_storage_read_during_idle_store, which has failed on main in earlier runs.agc_linked_code_dependencies_data-hit-verify-stale-datareached its expected verifier abort and then hit its 30 s timeout. All 7 pass 5 of 5 times on lavapipe 26.2.6 locally at this head.agc_driver_host_import_settle_retireskips on lavapipe on both platforms, and the report counts a new test that skips as not passing. It needs the MinGW production device; it passes in the local RTX 3080 gate.python3 tools/check_conventions.py --base origin/mainandpython3 tools/debt_fold.py --checkpass.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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T19:37:33Z.
Review: COMMENTED
Reviewed — comments
The review is incomplete: I inspected the cache helper and selected recorder changes at the pinned head, but did not read every changed file.
What I ran
I used the review reader for head
c8f856396bf56b9d9d5eedfaa9a7691280e0f725. No tests or build commands were run. I readdescription.md,commits.md, portions ofmanifest.jsonanddiff.patch, plus the changedTexture.cppcache implementation and selectedRecorder.cpplines. Other changed files and the remainder of the diff were not read.Results
Negative control
Not run; no tests were executed.
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
I did not read all changed files or all changed hunks, so I cannot assess the full change or claim there are no blocking defects.
files.jsonwas not available through the review reader. The author-reported test and CI results in the description were not independently verified.To get this to a good state
Complete review of the unread changed files and hunks before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T19:38:18Z.
Review: COMMENTED
Actionable comments posted: 3
70105635-7270-4cb7-8aff-4d4f79011201Reviewing files that changed from the base of the PR and between
1f27e2abfaandc8f856396b.core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/AllocationCounter.cppcore/libs/prx/libSceAgcDriver/tests/AllocationCounter.hppcore/libs/prx/libSceAgcDriver/tests/RecorderBatchFences.cppcore/libs/prx/libSceAgcDriver/tests/RecorderKeptBytes.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_retention_tests.cmakecore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_storage_view_cache_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/RecorderRetention.cppcore/libs/prx/libSceAgcDriver/tests/execution/StorageViewCache.cppdocs/dev/debt/changes/agc-recorder-failed-teardown.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T07:18:18Z.
Review: COMMENTED
Actionable comments posted: 3
Architecture findings (1)
Advisory architecture findings (1)
ccc37077-c722-4dbc-940b-6f40d79f496fReviewing files that changed from the base of the PR and between
c8f856396bande79e3252b7.core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DeferredDestruction.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DeferredDestruction.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Resources.cppcore/libs/prx/libSceAgcDriver/tests/DeferredDestruction.cppcore/libs/prx/libSceAgcDriver/tests/RecorderBatchFences.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_recorder_batch_fences_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/RecorderRetention.cppcore/libs/prx/libSceAgcDriver/tests/execution/StorageViewCache.cppdocs/dev/debt/changes/agc-recorder-failed-teardown.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T07:24:03Z.
Review: COMMENTED
Reviewed — no blocking findings
The review covers the storage view cache change and selected recorder changes at head
e79e3252b7ac633d339ffa45b445f0ffd77e1fe1; the broader change set was not fully inspected, so a formal decision is not justified.What I ran
Read the prepared description, commit list, manifest and selected diff hunks, then used the repository reader to inspect targeted source and test ranges. No test or build commands were run. The author-reported test results were not independently verified.
Results
Negative control
Not run; the reported red-first test was not independently reproduced.
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Sources
Not verified
Read changed source files:
Texture.cpp,Recorder.cpp,DeferredDestruction.cpp, andResources.cpp; also read the relevant portion oftests/execution/StorageViewCache.cpp. The manifest lists 20 changed files. The remaining changed files, other test files, and the unread portions of the diff were not inspected. No tests, build, or CI results were verified by this review.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and run the relevant checks at this head before making a formal review decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T09:59:06Z.
Review: COMMENTED
Reviewed — comments
This review sampled the storage-view cache and recorder teardown changes at head
753f8bb7fe813393c8a074034856b95254a06c22; the broad recorder changes and most changed files were not fully reviewed, so a formal decision is not justified.What I ran
Read the prepared description, commits, manifest, and diff. Read targeted head ranges in
Texture.cpp,Recorder.cpp, andDeferredDestruction.cpp; no commands or tests were run.Results
Findings
Blocking
None verified in the sampled code.
Non-blocking
Not verified
Only three changed source files were sampled, and none was read in full. The remaining changed files, including
VulkanDevice.cpp, test sources, and most changed lines inRecorder.cppandTexture.cpp, were not reviewed.files.jsonwas not available through the review reader; the manifest and file listing show 20 changed files, including two excluded from the bundle as too large. No tests or builds were run.To get this to a good state
Nothing is required. The optional point above is to complete review of the remaining changed code and tests before making a formal decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T13:13:38Z.
Review: COMMENTED
Reviewed — no blocking findings
The targeted code review found no verified blocking defect, but the full change and its reported checks were not independently verified.
What I ran
Reviewed head
fbf9f555acc4431e80ea24c6a35e715b16765032. No commands or tests were run.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
The
cachedViewhelper inserts a null cache slot before creating the view and erases it if creation throws. This addresses the described map-allocation ownership gap in the inspected path.Not verified
Read the PR description, commit list, manifest, and the first 1,600 lines of the prepared diff. Inspected targeted ranges in
Texture.cpp,Recorder.cpp, andVulkanDevice.cpp. The full text ofVulkanDevice.cppandTexture.cppwas excluded from the review bundle; only targeted ranges were read through the reader. Most changed files, remaining diff hunks, build results, and test results were not verified.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and independently verify the reported checks before relying on them.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T13:19:52Z.
Review: COMMENTED
Actionable comments posted: 1
Architecture findings (1)
Advisory architecture findings (1)
b4a60d63-4810-4217-9271-25814a764ca6Reviewing files that changed from the base of the PR and between
753f8bb7feandfbf9f555ac.core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/execution/StorageViewCache.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T16:30:18Z.
Review: COMMENTED
Reviewed — comments
This static review inspected the storage-view cache path at head
445012f72622a569cbae6fbcbc929513161a0bb4; most changed files and runtime checks remain unverified, so it does not support a merge decision.What I ran
Static inspection only; no commands, builds, or tests were run. The review reader was
repo_read.py.Results
Negative control
Could not run; this was a static review.
Findings
Blocking
None verified in the inspected cache path.
Non-blocking
None.
Sources
cachedViewinserts before view creation and erases the entry on exceptions.Not verified
Read partially at the pinned head:
Texture.cpp,Recorder.cpp,VulkanDevice.cpp,tests/execution/StorageViewCache.cpp, andtests/cmake/agc_driver_storage_view_cache_tests.cmake. The review-folder description, commits, manifest, and the beginning of the diff were also read.The other 16 changed files were not read at the pinned head. The full review-folder copies of
Texture.cppandVulkanDevice.cppwere excluded as too large; only targeted ranges were read through the reader. Tests, builds, and CI results were not independently verified.To get this to a good state
Nothing is required. Optional: inspect the remaining changed files and run the relevant checks before treating this as a merge decision.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T16:35:21Z.
Review: COMMENTED
Actionable comments posted: 3
8e6a9452-1e63-47a5-b5e2-4f3a224bd9c4Reviewing files that changed from the base of the PR and between
fbf9f555acand445012f726.core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T02:43:59Z.
Review: COMMENTED
Reviewed — no blocking findings
The storage-view cache change and recorder teardown changes are inspectable, but I did not finish reading all changed test code, so this review is incomplete and does not justify approval.
What I ran
Reviewed head
87f02e20f30f994372994b273269e841047d5844against basemain; no merged-preview check. I used the prepared diff and files, plusrepo_read.pyat the pinned head. No build or tests were run.Results
Negative Control
Not run; no test or source changes were made during this review.
Findings
Blocking
None verified.
Non-blocking
None recorded; this review is incomplete.
Sources
Not verified
Texture.cpp,VulkanDevice.cpp,Draw.cpp,Recorder.cpp,DeferredDestruction.cpp,Resources.cpp, andAllocationCounter.cpp.tests/execution/RecorderRetention.cppandtests/execution/StorageViewCache.cpp;tests/RecorderBatchFences.cppwas only inspected in part. Other changed headers and test files were not exhaustively checked.files.jsonlists no files excluded by rule. Full text was unavailable infiles/forExecution/src/VulkanDevice.cppandGraphics/src/Texture.cpp; I read only relevant ranges throughrepo_read.py.To get this to a good state
Nothing is required from the author based on the findings recorded here. Optional: complete review of the remaining changed test code before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T03:59:45Z.
Review: COMMENTED
Reviewed — no blocking findings
The targeted review found no verified blocking defect, but the full changed-file review is incomplete, so a formal decision is not justified.
What I ran
Reviewed head
564b4ceb72ccadf799d6ba23c618eefdc3d9cb3b. Read the prepared description, commits, manifest, diff, and files list; usedrepo_read.pyfor targeted source context. No checks or tests were run.Results
Negative control
Not run; no tests were run.
Findings
Blocking
None verified in the code inspected.
Non-blocking
The review is incomplete, so this is not a formal approval.
Sources
Targeted pinned-head context:
Recorder.cpp,DeferredDestruction.cpp,VulkanDevice.cpp, andRecorderRetention.cpp. The prepareddiff.patchwas also inspected.Not verified
The manifest lists 22 changed files; I read targeted head context for 4, not every changed file in full. The full text for
VulkanDevice.cppandTexture.cppwas not infiles/; I did not read their complete head versions. The remaining changed files were not fully reviewed.files.jsonlists no rule-excluded files.To get this to a good state
Nothing is required. Optionally, complete review of the remaining changed files before making a formal decision.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-01T14:16:09Z.
Review: COMMENTED
Reviewed — comments
The targeted inspection found no verified blocking defect, but the full change was not audited, so a formal approval is not justified.
What I ran
Reviewed head
232dc99bd3d7c2d7c6004408526b896d862a7894. I inspected the prepared description, commit list, manifest, and diff, plus targeted source ranges from the included files andrepo_read.pycontext. No tests or build commands were run.Results
Negative control
Not run; no tests were executed.
Findings
Blocking
None verified in the inspected ranges.
Non-blocking
The review is incomplete. A full audit of the recorder retention, teardown, and storage-view changes is still needed before approval.
Sources
Inspected source at the pinned head: Recorder.cpp, Texture.cpp, and DeferredDestruction.cpp.
Not verified
Read selectively:
Recorder.cpp,Texture.cpp,DeferredDestruction.cpp,AllocationCounter.cpp, and the two storage-view-cache and recorder-retention CMake test files. The remaining 15 included changed files were not read.VulkanDevice.cppandTexture.cppwere excluded from the prepared full-text folder; only targetedTexture.cppcontext was obtained throughrepo_read.py. No test output or author-reported CI result was independently checked.To get this to a good state
Nothing is required to address a verified defect. Complete the audit of the remaining changed files and run relevant non-compiling checks before requesting approval.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:44:28Z.
Review: COMMENTED
I checked the six extra-view caches and their common
cachedViewpath.try_emplacecompletes the allocation before Vulkan creates the view. A creation exception erases the placeholder, leaving the same key retryable, and a successful handle is immediately reachable byrelease(). The fixture covers creation failures, allocation failures on supported builds, and retry. Please include the fixture's case counts with the validation results, particularly the import-dependent element-view case, so a passing CTest run identifies which ownership paths actually ran.Source review at
232dc99bd3. A trial merge onto484e8e6b77succeeds. Vulkan execution on that base is pending.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:32:27Z.
Review: COMMENTED
The storage-view changes are unchanged from the prior review. The new allocation hook skips checking thread-local state when
armedThreadsis zero. If a thread exits with counting or a failure still armed, the thread-local hooks disappear while the global count stays positive. Could the hook balance that contribution on thread exit, or enforce that every caller disarms before exit?Source review at
e4de228324. The branch trial-merges onto700fae9438. Paired checks on the revised head are queued.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T20:50:41Z.
Review: COMMENTED
Reviewed — comments
This review is incomplete: I checked targeted ranges in
Recorder.cppandTexture.cpp, but not the full changed-file set, so I cannot make a merge recommendation.What I ran
Reviewed head
e4de2283244edc4c2caecb1e718bc35a6aeff003. I read the prepared description, commit list, manifest, file list, and portions of the diff. I usedrepo_read.pyto inspect targeted ranges inRecorder.cppandTexture.cpp. No tests or other checks were run.Results
Negative control
Not run; no tests were run.
Findings
Blocking
None verified in the inspected ranges.
Non-blocking
None.
Sources
The inspected texture cache inserts a cache slot before creating the view and erases the slot if creation throws: Texture.cpp at the reviewed commit. The recorder submission path and batch completion handling were also inspected in targeted ranges: Recorder.cpp at the reviewed commit.
Not verified
I read targeted ranges from
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppandcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp; I did not review either file in full. I did not inspect the source text of the other files listed underreviewedinfiles.json:core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp,core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp,core/libs/prx/libSceAgcDriver/Graphics/include/DeferredDestruction.hpp,core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp,core/libs/prx/libSceAgcDriver/Graphics/src/DeferredDestruction.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp,core/libs/prx/libSceAgcDriver/tests/AllocationCounter.cpp,core/libs/prx/libSceAgcDriver/tests/AllocationCounter.hpp,core/libs/prx/libSceAgcDriver/tests/DeferredDestruction.cpp,core/libs/prx/libSceAgcDriver/tests/RecorderBatchFences.cpp,core/libs/prx/libSceAgcDriver/tests/RecorderKeptBytes.cpp,core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_graphics_tests.cmake,core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_retention_tests.cmake,core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_storage_view_cache_tests.cmake,core/libs/prx/libSceAgcDriver/tests/cmake/agc_recorder_batch_fences_tests.cmake,core/libs/prx/libSceAgcDriver/tests/execution/RecorderRetention.cpp,core/libs/prx/libSceAgcDriver/tests/execution/StorageViewCache.cpp, anddocs/dev/debt/changes/agc-recorder-failed-teardown.md.files.jsonlists no excluded files; the manifest marksVulkanDevice.cppandTexture.cppas not included in the prepared full-text folder due to size. I also did not inspect every diff hunk.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:21:40Z.
Review: COMMENTED
On current head
57510b19c4, I compiled the exact allocation-counter implementation and exercised wrapped allocations on Linux. Counting and one-shot failure both worked, and threads that exited while counting, failing, or doing both left the armed-thread count at zero. The revised head merges cleanly ontoa1b75b0947; paired Vulkan and Windows FLS execution are pending.For comparison, the earlier head
232dc99bd3passed the two shared scalar/recorder controls on maina9cbd48cb0and the change, plus the branch-only recorder-retention and two storage-view cases. Those Linux lavapipe logs show the validation layer loaded and no VUIDs. They apply to the earlier head.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T23:36:14Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
57510b19c44759ca1a67eb8782622092df300ef0using targeted reads withrepo_read.py; no tests or builds were run.Results
Negative control
Not run; no tests were run.
Findings
Blocking
None verified in the inspected paths.
Non-blocking
None.
Sources
Not verified
The manifest lists 23 changed files for review and no rule-excluded files. Targeted source ranges were read in 9 files:
VulkanDevice.cpp,Recorder.cpp,Texture.cpp,DeferredDestruction.cpp,Resources.cpp,DepthSurface.cpp,HostThreadLocal.hpp,AllocationCounter.cpp, andStorageViewCache.cpp. Those files were not read end-to-end, and the remaining changed files were not inspected. Tests, builds, and runtime behavior were not verified. The reader output was available, but its attempt to append a read log failed because the environment is read-only.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.