Skip to content

perf(agc): keep a smaller staging pool on system-memory heaps - #5893

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
ThatsLeo:perf/agc-unified-memory-budgets
Oct 15, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
ThatsLeo:perf/agc-unified-memory-budgets

Conversation

@ThatsLeo

Copy link
Copy Markdown
Contributor

What

The staging pool's device tier (BufferPool::DeviceBudget, #1147) retains up to max(512 MiB, heap / 8) of idle buffers, sized from the largest device-local heap as if it were video memory. On an integrated GPU that heap is system RAM: 1.4 GiB of idle buffers on an Arc iGPU whose heap is 11.5 GiB, taken from the title.

When every memory type of that heap is host-visible, which is how integrated GPUs report their memory and never true of a discrete GPU (it always has a device-only type), the tier now retains a sixty-fourth of the heap, at least 128 MiB: 180 MiB on that Arc. Discrete GPUs keep today's budget, and APS5_STAGING_POOL_MIB still overrides it.

The storage image cache has the same problem (max(2 GiB, heap / 4), 2.9 GiB there), but #5483 already changes that budget, so it is left to it.

Tested

Fedora 44, GCC 16.2.1, Release, Intel Arc (Meteor Lake iGPU, Mesa 26.2.3 ANV), 15 GiB RAM.

{"commit":"9a3e2ac4daf8","dirty":false,"env":{"APS5_TRACE_SECONDS":"20:20"},"gpu":"Intel(R) Arc(tm) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 26.2.3","os":"Linux 7.2.8-200.fc44.x86_64","resolution":"3840x2160","window":{"spec":"seconds 20:20","first_present":1125,"ms":20003.169},"presents":1190,"frame_ms":{"p50":16.683,"p90":17.586,"p99":19.886,"max":55.982},"gpu_busy_ms_per_present":8.298,"worker_busy_pct":{"queue worker 0x0":34.096},"top_phases_ms_per_frame":{"VideoOut.Flip":10.108,"Driver.Present":7.714,"VideoOut.Flip.present":7.711,"Driver.Packet":5.730,"Driver.Packet.draw":5.304,"Driver.Draw":5.296,"Driver.Draw.draw_and_resource_release":5.073,"Driver.Present.render_fence_wait":4.679},"trace_dropped":false,"trace":"aps5-trace-9a3e2ac4daf8-92548.json.gz"}
{"commit":"9a3e2ac4daf8","dirty":false,"env":{"APS5_TRACE_SECONDS":"20:20"},"gpu":"Intel(R) Arc(tm) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 26.2.3","os":"Linux 7.2.8-200.fc44.x86_64","resolution":"3840x2160","window":{"spec":"seconds 20:20","first_present":970,"ms":20007.991},"presents":943,"frame_ms":{"p50":20.995,"p90":23.802,"p99":26.318,"max":29.293},"gpu_busy_ms_per_present":13.019,"worker_busy_pct":{"queue worker 0x0":26.652},"top_phases_ms_per_frame":{"VideoOut.Flip":14.634,"Driver.Present":14.610,"VideoOut.Flip.present":14.594,"Driver.Present.render_fence_wait":11.791,"Vulkan.Retire":11.791,"Vulkan.Retire.wait":11.787,"Driver.Packet":5.654,"Driver.Packet.draw":5.331},"trace_dropped":false,"trace":"aps5-trace-9a3e2ac4daf8-95836.json.gz"}
{"commit":"0f58cb53b74e","dirty":false,"env":{"APS5_TRACE_SECONDS":"20:20"},"gpu":"Intel(R) Arc(tm) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 26.2.3","os":"Linux 7.2.8-200.fc44.x86_64","resolution":"3840x2160","window":{"spec":"seconds 20:20","first_present":1014,"ms":20005.118},"presents":982,"frame_ms":{"p50":20.074,"p90":22.910,"p99":25.465,"max":29.588},"gpu_busy_ms_per_present":12.228,"worker_busy_pct":{"queue worker 0x0":27.346},"top_phases_ms_per_frame":{"VideoOut.Flip":13.858,"Driver.Present":13.827,"VideoOut.Flip.present":13.818,"Driver.Present.render_fence_wait":11.007,"Vulkan.Retire":11.006,"Vulkan.Retire.wait":11.002,"Driver.Packet":5.570,"Driver.Packet.draw":5.251},"trace_dropped":false,"trace":"aps5-trace-0f58cb53b74e-94080.json.gz"}
{"commit":"0f58cb53b74e","dirty":false,"env":{"APS5_TRACE_SECONDS":"20:20"},"gpu":"Intel(R) Arc(tm) Graphics (MTL)","driver":"Intel open-source Mesa driver Mesa 26.2.3","os":"Linux 7.2.8-200.fc44.x86_64","resolution":"3840x2160","window":{"spec":"seconds 20:20","first_present":1102,"ms":20003.429},"presents":1195,"frame_ms":{"p50":16.683,"p90":17.548,"p99":19.880,"max":25.269},"gpu_busy_ms_per_present":8.170,"worker_busy_pct":{"queue worker 0x0":34.042},"top_phases_ms_per_frame":{"VideoOut.Flip":10.115,"VideoOut.Flip.present":7.341,"Driver.Present":7.341,"Driver.Packet":5.697,"Driver.Packet.draw":5.324,"Driver.Draw":5.315,"Driver.Draw.draw_and_resource_release":5.090,"Graphics.Draw":4.496},"trace_dropped":false,"trace":"aps5-trace-0f58cb53b74e-99828.json.gz"}

The PR lines are from 0f58cb53b, the first form of this branch, which also shrank the storage image cache; Dreaming Sarah reaches neither budget.

Checklist

  • Based on current main; no other open PR implements the same functions
  • 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
  • Unblocks: none on its own
  • GPUs tested: Intel Arc (Meteor Lake iGPU), Mesa 26.2.3 ANV, Fedora 44; lavapipe (Mesa 26.2.3, LLVM 22)
  • AI-assisted: yes

On a device whose largest device-local heap has only host-visible memory
types (integrated GPUs), the staging pool's device tier holds system RAM:
it now retains a sixty-fourth of the heap, at least 128 MiB.
@ee6aba54

Copy link
Copy Markdown
Contributor

#6174 changes BufferPool::DeviceBudget as well (it takes the reported memory budget into account). I will rebase it onto this one once merged; nothing to change here.

@oneandonlydean
oneandonlydean merged commit db4e4b0 into boykopovar:main Oct 15, 2026
9 checks passed
TheBlenDed pushed a commit to TheBlenDed/AnyPS5 that referenced this pull request Oct 25, 2026
Main brings the pipelined-draw stack (boykopovar#1193/boykopovar#1201/boykopovar#1202), boykopovar#6316 after boykopovar#6060, boykopovar#5893, boykopovar#5910 and depth/HTILE work (boykopovar#454, boykopovar#5496, boykopovar#5554, boykopovar#5524, boykopovar#5627, 626cff7). Our SharedSpirv / cold-SPIR-V storage is replaced by main's mapped cache entries (CreateFileMappingW on Windows), so cached variants' words are views into the cache files instead of heap copies; APS5_COLD_SPIRV, APS5_COLD_SPIRV_FILE and APS5_CACHE_SPIRV_BACKING are gone. Kept local: lane hang fixes, boykopovar#5815, boykopovar#6227, table stores and storage tables, option 1 substitutes (.slots), stencil remap and alias path (a written storage view our alias path serves seeds from the depth surface instead of retiring it), 10_11_11 blending next to main's reversed-order blending, VRAM share/spill/fallbacks, diagnostics. Versions: FormatVersion 43, RuntimeAbi 17, request serializer v31. Notes in work/sync-20261013/*-4.md.

AI-assisted: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants