Skip to content

perf(agc): reuse readonly fallback copies - #5469

Closed
Sanjaysrinivas wants to merge 1 commit into
boykopovar:mainfrom
Sanjaysrinivas:perf/agc-readonly-fallback-reuse
Closed

Sanjaysrinivas wants to merge 1 commit into
boykopovar:mainfrom
Sanjaysrinivas:perf/agc-readonly-fallback-reuse

Conversation

@Sanjaysrinivas

Copy link
Copy Markdown
Contributor

What

Retain immutable raw copies of tracked read-only fallback buffer regions through the recorder's existing storage-snapshot cache. Unchanged readers can bind the same buffer; writes are flushed and freshly collected before lookup so a CPU store within the same collection epoch cannot serve stale bytes. The existing cache supplies its entry/byte budgets and preserves buffers held by older consumers.

Reuse is limited to uploads holding the GPU mutex, using the active recorder on the same device, with a nonzero write-watch generation and a fully committed, live, non-addressable region that no descriptor writes. Writers, sparse regions, untracked memory and unlocked preparation keep separate copies. APS5_NO_READONLY_FALLBACK_REUSE=1 disables reuse for comparison; APS5_PROFILE_DRAW reports avoided logical copy footprints.

Related open #1364 includes immutable buffer reuse alongside upload batching and shader-data streaming. This is a draft alternative for the reuse portion using current main's existing cache, with no batching or streaming redesign. Ordering with #1364 has not been agreed and needs maintainer/author coordination before this becomes ready for review. The checklist explicitly records that overlap rather than asserting its absence. No title FPS or frame-time improvement is claimed by this PR.

Tested

Fresh Release build against main a0f5916a293067ca840e835e58a8a55a0b764b4b, Windows 11 Pro / MinGW-w64, SPIRV-Tools disabled, native NVIDIA Vulkan with Khronos validation and shader cache disabled.

The new native fixture passes (0.556 s): unchanged-handle reuse, a CPU overwrite within one explicitly established collect epoch, queued GPU consumers retaining old bytes, writer bypass, a real GPU fill published before the next reader, generation-zero bypass, unlocked preparation, cache eviction with a live consumer, private recommit, shared-section CPU writes/remap at the same virtual address, and sparse descriptor clipping/bypass. Mapping changes use the existing allocation invalidation callback without registering the fallback memory for import. Disabling reuse in the identical binary fails at the expected unchanged-handle assertion (0.460 s).

CTest: 5/5 passed, covering the new fixture, unchanged CPU stamps, written-buffer ordering, copied-direct ordering and the draw snapshot cap (3.74 s total, each test below 1 s). The dedicated draw descriptor writes and snapshot override check also passed (0.450 s). No cases skipped or Vulkan validation errors reported. Linux/lavapipe and other hardware vendors have not been tested.

Checklist

  • Based on current main; open-PR overlap reviewed and disclosed: perf(agc): reuse immutable buffer copies and batch uploads #1364 (draft alternative; ordering remains pending as described above)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no new stubs
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (no new dependencies)
  • Generic behaviour, not specific to one title
  • Depends on: none (perf(agc): reuse immutable buffer copies and batch uploads #1364 is an alternative, not a build prerequisite)
  • Unblocks: none (generic fallback-copy retention; no title bring-up claim)
  • GPUs tested: NVIDIA GeForce RTX 4070 Laptop GPU, Windows driver 32.0.16.1692, Windows 11 Pro 10.0.26300
  • AI-assisted: yes

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

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

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants