chore(agc): report heap budgets on buffer allocation failure #7119
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7119"
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 MarcZX10 on 2026-10-17T12:17:31Z.
What
Append
VK_EXT_memory_budgetusage and budget for every physical-device heap to failed AGC buffer allocations when the extension query is available. Keep allocation and retry policy unchanged; omit heap details when the extension is unavailable.Tested
BufferPool.cppandtests/BufferPool.cpppassedc++ -std=c++20 -fsyntax-onlywith the repository include paths.agc_buffer_poolcheck exposed incorrect query-count assertions: allocation type selection queries the enabled budget extension, and a failed allocation then queries it again for diagnostics. The test now expects both calls and resets its counter before checking the missing-extension path.d9ccae5fd:agc_buffer_pool,agc_buffer_pool_small_device_sharedandagc_buffer_pool_small_device_no_stagingall passed, three runs each. The full^agcselection passed 649/649 on both an RTX 3070 and lavapipe. WithBufferPool.hppandBufferPool.cppfrommain, the new diagnostic assertions failed as expected. These tests use mocked Vulkan functions; a real allocation failure and Windows were not tested.python3 tools/check_conventions.py --base upstream/main: passed.python3 tools/pr_overlap.py --branch codex/agc-allocation-heap-budget: no overlap with open pull requests.git diff --check: passed.agc_buffer_pool_testsbuild stopped before reaching the changed test at the unrelated GCC parse error incore/shader/recompiler/Optimization/src/SrtWalker/SrtDescriptorEvaluation.cpp:183; no local runtime result is claimed.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 repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T12:42:51Z.
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.
core/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hppcore/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cppcore/libs/prx/libSceAgcDriver/tests/BufferPool.cppcore/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hppcore/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hppcore/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hppcore/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cppcore/libs/prx/libSceAgcDriver/tests/BufferPool.cppImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T12:55:31Z.
Full CI on 4b770187f (run 39032496156) fails
agc_buffer_poolon both Linux and Windows. The same two checks from this PR's test fail on each:agc_buffer_poolpasses on main (c9e6c45de). So the budget query either runs a different number of times than the test expects on the failure path, or it still runs when the extension is missing. Could you take a look? We'll rerun full CI on the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:05:06Z.
Thanks for the failure report. I traced the counts: when the extension is enabled,
Context::DeviceMemoryTypequeries the heap budget during memory-type selection, thenBufferPool::AllocateMemoryqueries it again only when reporting the failed allocation. The regression expected one total call instead of two. The fallback assertion also carried the first case’s counter into the second case. I corrected both in commitd9ccae5fdand updated the Tested section; the new hosted run is pending. Local Release configuration succeeded, but the focused build is blocked before this test by an unrelated GCC parse error inSrtDescriptorEvaluation.cpp:183, so I do not claim a local test pass.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:07:47Z.
Follow-up: on Linux, the updated
tests/BufferPool.cppand productionGraphics/src/BufferPool.cpptranslation units both compile with the repository C++20 command. The fullagc_buffer_pool_teststarget cannot link locally because the unrelatedSrtDescriptorEvaluation.cpp:183GCC parse error stops the driver build. The automatic checks ond9ccae5fdpassed conventions/eligibility/report, but skipped Linux and Windows tests. I tried the documented manual Build workflow with the focused changed-test selection; GitHub rejected dispatch with HTTP 403 (Must have admin rights to Repository). Could a maintainer dispatch it on this head to verifyagc_buffer_pool?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:43:04Z.
I tried a focused local build of the PR test target at head
d9ccae5fdd346bcb3031247e120c2020fee15a8a, but the build stops earlier inSrtDescriptorEvaluation.cpp:183: GCC requires the dependent call to be writtenread.read->template Flags<MemoryFlags>(). That is outside this PR and prevents me from reproducingagc_buffer_poollocally at this head. I have not changed the branch or inferred which budget-query assertion is wrong from the hosted failure alone; the two CI failures remain actionable and need a corrected test expectation or implementation before the PR is ready.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:50:40Z.
Local validation update at the exact head
d9ccae5fdd346bcb3031247e120c2020fee15a8a: theagc_driver_teststarget now builds successfully on Linux after applying the unrelated dependent-template keyword fix only in the temporary review worktree; that file was restored afterward and the worktree is clean. Runningagc_driver_tests --buffer-pool-onlythen stops before test selection because this host CPU lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA. So the target compilation is confirmed locally, but this machine cannot provide a runtime result for the buffer-pool test. The new hosted run remains needed for runtime confirmation.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T15:09:14Z.
Review: COMMENTED
@MarcZX100 here is the runtime result you could not get locally. The Linux and Windows CI jobs were also skipped on
d9ccae5fd.Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Headd9ccae5fdmerged ontomain47a266cf9(clean). The full tree builds with GCC 15.2, includingSrtDescriptorEvaluation.cpp.agc_buffer_pool,agc_buffer_pool_small_device_shared,agc_buffer_pool_small_device_no_stagingBufferPool.hppandBufferPool.cppfrommainagc_buffer_poolfails:allocation failure omitted the first heap's memory budget,... a later heap's memory budget,... did not query the memory budget for both type selection and its diagnostic^agc(649 tests) on the RTX 3070 and on lavapipemainSo the two checks @oneandonlydean reported on
4b770187fpass on this head, and the new checks fail without the change. The missing-extension case passes in both runs, as expected, becausemainnever queries the budget there.These tests use the mocked Vulkan functions.
ANYPS5_GPU(RTX 3070 or lavapipe) does not change the result.Not run: Windows, a real allocation failure on a device.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T15:15:53Z.
Thanks for running the native test matrix. Your result confirms the two original assertions pass on
d9ccae5fd, the new allocation-failure diagnostics are covered by the mocked Vulkan tests, and all 649 AGC tests pass on both the RTX 3070 and lavapipe. I’ve added your exact Linux validation to the PR description; Windows and a real device allocation failure remain untested.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T01:13:39Z.
Rebased the PR onto current upstream main at
5229b5b82; the updated head isdd81b1129. The rebase preserves the heap-budget diagnostic and corrected query-count assertions.check_conventions.pyandgit diff --checkpass. A local Linux Release build ofagc_driver_testssucceeds when the unrelated dependent-template parse fix inSrtDescriptorEvaluation.cppis applied only in the temporary review worktree and then restored; the focused tests cannot run on this Xeon E5-1620 v2 host because the executable exits at its CPU feature guard (LZCNT/BMI1/BMI2/MOVBE/AVX2/FMA). Current GitHub conventions, eligibility and report checks pass; the Linux/Windows and relinker jobs are skipped for this pull request. I manually checked the overlap warnings from #4472/#5987/#6553: those change buffer pooling or host-memory fallback policy, while this PR only adds heap diagnostics after allocation failure, so the behavior does not overlap.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:37:41Z.
Thanks for running the focused tests and full AGC suite on
d9ccae5fd; that independently validates the allocation diagnostic and its negative control. I also tried the three focused tests at current headdd81b1129on Linux, but each process aborted at the host CPU feature guard before assertions (this Xeon E5-1620 v2 lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA). The current head adds the follow-up test commit, so a focused rerun there on a supported host would close that small validation gap if convenient.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T17:10:47Z.
Windows run:
agc_buffer_poolfails with this PR, onmain6efb7261bwith only this PR (dd81b1129) merged, 3 runs of 3. On the samemainwithout it, it passes. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,BUILD_TESTING=ON.With a local print, since removed,
diagnosticBudgetQueriesis 3 at that check, not 2.mainhas not changedBufferPool.cpp,BufferPool.hppor anymemoryProperties2caller since this branch's base5229b5b82, so this does not look like drift. One candidate for the third query isBufferPool::deviceBudget(BufferPool.cpp:229), which queries the budget wheneverDeviceTierEnabled(), the default withoutAPS5_STAGING_POOL_MIB. I could not confirm it withAPS5_STAGING_POOL_MIB=0: the suite then stops earlier, at the device buffer size class check. The test mocks every Vulkan call, so the GPU should not matter. I have not run it on Linux to compare.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T17:20:44Z.
Thanks for tracing the extra call. The pool constructor does query the budget once to size its device tier, which made the test count include setup. In e6fb74fd7 the test explicitly initializes and stores the mock BufferPool before taking its allocation-path count, then asserts exactly two calls for DeviceMemoryType and the allocation-failure diagnostic. The changed test translation unit compiles, and conventions pass. I could not run the focused executable here: it exits at startup because this Xeon E5-1620 v2 lacks the AVX2/LZCNT/BMI/MOVBE/FMA features required by the project. Please rerun the Windows/Linux focused check on this head.
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T17:27:19Z.
Rechecked
e6fb74fd7on the same Windows machine (Radeon 860M, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release), merged alone ontomain6efb7261b.agc_buffer_pool,agc_buffer_pool_small_device_no_stagingandagc_buffer_pool_small_device_sharednow pass, 3 runs of 3.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T22:09:28Z.
Thanks for rerunning the updated head on Windows. The three buffer-pool tests passing 3/3 each complements the Linux run, where the new checks fail with the production files reverted and the 649-test AGC suite matches main. The Linux/Windows focused behavior is now covered; real allocation failure on a device remains untested.
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-18T23:16:01Z.
I am updating #6553 after #5987 merged, retaining only the host-room placement guard and its tests while preserving main's allocation/refusal/reclaim routing. This PR's allocation-failure diagnostics are a separate topic.
Both branches already conflict with newer main in the buffer-pool test area. Proposed landing order: #6553 first, then preserve its budget and allocation-attempt assertions alongside this PR's failure diagnostics. No combined build is claimed; if this PR should land first, I can rebase the guard afterward and rerun that composition.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:52:24Z.
Thanks for clarifying the proposed landing order. I agree that #6553 should land first, then this PR should retain its allocation-failure diagnostics together with the guard’s budget and allocation-attempt assertions. Since no combined build has been run, I’ll keep the composition unverified until that combined validation is available.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T18:10:52Z.
Checked the heap-budget diagnostic against
main: the production code merges cleanly and the only conflict was adjacent blocks intests/BufferPool.cpp. Rebased onto currentmainkeeping both, full build and ctest 805/805 green (agc_buffer_pool*included), consistent with the Linux (jotitadev) and Windows (LeandroLP23) runs; merged.