Skip to content

perf(agc): upload a storage image spanning two host imports on the GPU - #3949

Closed
CnRJay wants to merge 1 commit into
boykopovar:mainfrom
CnRJay:perf/agc-gathered-storage-upload
Closed

CnRJay wants to merge 1 commit into
boykopovar:mainfrom
CnRJay:perf/agc-gathered-storage-upload

Conversation

@CnRJay

@CnRJay CnRJay commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

What

A storage image upload with no DCC keys goes through the host import of its memory when one import covers the whole surface. A surface that straddles two registered allocations has no single import (HostImportFor fails), so StorageTexture::upload fell back to the CPU path: GuestMemory::ReadCommitted of the whole surface (which first waits for the GPU writers of that memory), a staging copy, and a waited batch.

PPSA28416 (STAR WARS: Galactic Racer, UE5) has 3840x2160 surfaces (formats 36 and 56) that cross from a 2 MiB allocation into the 848 MiB heap right after it. At the main menu that is ~54 uploads and ~1.5 s per 10 s on the CPU path.

When every part of the surface is served by an existing import, each import's piece is now copied into one device buffer and detiled from there, recorded in the open batch like the single-import path: shadows published, stores flushed, the pending read noted, the image kept until the batch completes. When any piece has no import, the CPU path runs as before. APS5_NO_GATHERED_UPLOAD=1 turns the new path off.

Tested

Windows 11, WinLibs GCC 15.2.0, Release, RTX 4080.

  • The 78 add_test_executable targets of libSceAgcDriver that build on Windows: all pass.
  • PPSA28416 (on the testing branch): main menu 5.3 -> 5.6-5.7 fps, no crash in 420 s. A 400 s run under VK_LAYER_KHRONOS_validation (~3000 uploads through the new path) reports no errors from it.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

A surface straddling two registered allocations has no single import, so it fell back to a CPU read (waiting for the GPU) and a waited batch. Its pieces are now copied from each import into one device buffer and detiled in the open batch. APS5_NO_GATHERED_UPLOAD=1 restores the CPU path.
@github-actions github-actions Bot added the agc libSceAgc* label Oct 11, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Could you add a test for the gathered path: a storage surface that crosses two registered allocations, uploaded with host imports on, its texels compared, and a check that the upload did not go through the CPU path? No test in the tree reaches the new branch of StorageTexture::upload.

@CnRJay

CnRJay commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Yea I'll do that

@CnRJay CnRJay closed this Oct 12, 2026
@CnRJay
CnRJay deleted the perf/agc-gathered-storage-upload branch October 12, 2026 17:40
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.

2 participants