perf: Hello Neighbor 2 (PPSA07426) gameplay stays at 2.5-4 FPS because 1 MiB buffers are not registered and are recopied every frame #5529
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 ivica00 on 2026-10-13T22:40:28Z.
Title and scene
Hello Neighbor 2, PPSA07426, Unreal. Gameplay after Continue, 3840x2160, warm shader and pipeline caches, no ProcDump and no GPU frame readback. The picture in these runs is still wrong (black scene, a visible crosshair, green/yellow/magenta blocks,
mixed DCC keys). That is a separate correctness problem. The numbers below were taken with that picture, and a performance change should not try to fix DCC in the same pull request.The runtime for the first trace was a dirty tree at
307767675(#4216), before #4698. #4698 has since merged and is included in the later windows. Both are the same scene.What is slow
The GPU is waiting on the CPU. It is busy for about 39 ms per present in every window. The rest of the frame is the queue workers.
Control trace,
APS5_TRACE_SECONDS=180:30, presents 1516–1595 (79 presents in 30.3 s), before #4698:Driver.Packet.memory_wait373.7 ms/frame.Resources.Completeis 163.5 ms/frame. InclusiveDriver.Packetacross both workers is larger than the frame and should not be read as the frame time.After #4698 (shared registry snapshot). This is the only change that has moved this scene:
inflight_waitp50 is 0.38 ms, so the present is not waiting on the swapchain.A later window of the same scene, with the counters below, was a bit slower (32–33 presents / 10 s, GPU busy 38.3–40.2 ms, idle gaps 267–275 ms) and is the source of the phase split. If the CPU wait disappeared and the GPU work stayed 39 ms, the present rate would be about 25/s. Nothing measured here gets there.
The loop that fills the frame
About 19% of draws miss the resource cache, and those misses are builds that are never inserted.
Raising
APS5_RESOURCE_CACHE_ENTRIESfrom 1024 to 4096 left the miss rate at 18.5% → 18.6–19.6% across four windows. The misses are not evictions. In a 41,333-draw window: 33,204 template hits, 7,483 builds, and the draw-insert split was 23 inserted, 0 unrecorded, 7,358 unreusable.HasCachedStorageImagesskips were 0. Late windows of the same counter were 8,433 and 8,915 unreusable per 10 s.ShaderResources::noteReusableleavesreusablefalse whenGuestBufferMemory::DirectRegions()returns nothing.DirectRegions()returns nothing as soon as any region has no host import, no fixed read-only mirror, and no staged GPU copy. One outside-import region in a build throws away the whole build: it is rebuilt on the next draw and the guest bytes are read again.Those regions are copied on the CPU, not bound. A cumulative
[buffers] copied regions on the CPUline from gameplay:The counts are cumulative for the process. The per-10 s fact is the align-cover probe below, not "28 GiB copied every 10 s". GPU copies of ranges that are imported are already happening beside this (about 15,800 regions and ~2.1 GiB copied out and back on the GPU). The CPU path is only the ranges
findImportmisses. Regions outside an import never take the GPU copy path.Why they are not imported
Host alignment on this machine is 4096. Storage-buffer offset alignment is 4, so a 1 MiB page-aligned range could be bound in place if it were in the registry. It is not.
A local probe widened an import to host alignment only through bytes that no other registered range owns (
runCovers/importRuninGuestBufferMemory.cpp). Over gameplay windows it recorded:So the hot 1 MiB range is not inside any
GuestAllocationslease.runCoversfails before the alignment check. The earlier theory, that the guest heap registers the user pointer 32 bytes past a page-aligned block, is wrong for this class: there is no registered block to extend. There is also no host-import budget message. The texture cache sat around 378 MiB against a ~6116 MiB budget. Misaligned-in-import copies were 0 MiB.The open question a pull request has to answer: why a buffer region at
0x20d0000000(256 MiB granule; the logged prefix isaddress >> 28) is absent from the lease. Either the mapping is never registered, or the bound range starts outside the registered object.0x2080000000is a second outside-import class (hundreds of regions, several MiB each, still growing slowly) and should not be assumed to be the same cause.What a pull request should change, and how to show it
Register those ranges and import them on Windows, or otherwise make
DirectRegions()succeed for a build whose only defect is one of these regions. An environment flag is appropriate for the first cut. Please do not skip the copy of data the guest rewrites every frame; that was checked and it is real traffic.Same scene, warm caches, no ProcDump, no frame readback,
APS5_PROFILE_DRAW=1. Compare gameplay with gameplay:0x20doutside-import regions stop accumulating one 1 MiB region at a timedraw insertsunreusable falls, and the ~19% miss rate falls with ituploadms / 10 s fallsA build that becomes reusable only by dropping a guest read of data that changed is not a fix.
Measured, and not this bug
These showed up in the same 10 s windows. They are real CPU time, and they are separate changes:
NeverReusablefor a BDA pagetable is by design; do not fold that into the import fix.c47~400,fc4~330, others ~150–190 per 10 s) havesameKey 0. The resource cache cannot hit them. Staging was 791–897 regions and 185–212 MiB copied in and back per 10 s, 0 atomics, and only ~25% of the bytes came from a reused build. The other 75% is a fresh guest write.RecordStagingCopiescopies again on every use on purpose, and the copy-back is the whole written range because store extents are not known. Skipping that copy without a write watch keeps stale data.Open pull requests that do not match this profile
runCoversfinds no registered range under0x20d.0x20ddata is rewritten, and untracked memory is outside that pull request.guest readon the upload path, not a multi-secondmemcmp.Machine
AMD Radeon RX 9070 XT (vendor 0x1002, device 0x7550, subgroup 64), AMD proprietary driver 26.9.2 (LLPC), Windows 10.0.19045, 3840x2160. Working set of the process climbed to about 20–22.5 GiB on a 32 GiB machine. That is pressure worth watching. It is not, by itself, evidence of a leak.
AI-assisted analysis: yes.
Summary line
Imported from boykopovar/AnyPS5. Originally posted by ivica00 on 2026-10-13T23:41:05Z.
@AlxcBTW if you have agents free overnight, this is the one worth picking up.
The open question is why the hot 1 MiB buffers at
0x20d0000000are missing from theGuestAllocationslease.runCoversfails before the alignment check, so they are recopied on the CPU every frame and the draw is never reusable. A first cut behind an environment flag that gets those ranges imported on Windows, measured on the same Hello Neighbor 2 gameplay scene, is the change that would move the 2.5–4 FPS number. The broken picture (mixed DCC keys) is a separate problem and should stay out of that pull request.Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-13T23:42:00Z.
@ivica00 @CnRJay thanks for the tag and the write-up. I'm taking it tonight. Sword of the Sea (UE5, Windows) shows the same class: draws copy moved buffers outside imports on the CPU (earlier lab runs measured hundreds of GB per load), and an agent is already on that draw copy path. The first step is to check in SotS whether those regions are absent from the
GuestAllocationslease the same way, and which guest mapping path creates them without registering them. If it's the same cause, the first cut registers those ranges so they import and bind in place, behind an env flag, without dropping copies of data the guest rewrites. I can't run Hello Neighbor 2 here, so I'd need your numbers on the same scene for the PR. I'll post what we find here.Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-14T00:44:01Z.
First finding, plus a branch to try on your scene. Untested in a game so far.
In Sword of the Sea the same class exists but is small (~95 outside-import regions, 25 MiB per 10 s in loading, near zero in gameplay). Reading the code, the prime suspect is memory a title maps for the GPU only: prot 0x10/0x20 without the CPU bits 0x1/0x2. The host maps those pages readable (
LinuxProtFromSce), but the allocation registry records them as not readable, so the readable lease never holds a run over them.runCoversfails, and they're copied on every bind.Branch
AlxcBTW/AnyPS5:exp/import-gpu-only(f9d780325, one commit on currentmain; fork CI run 38491783977 running):APS5_PROFILE_DRAW=1, every outside-import region is classified: unregistered / GPU-only / no access / crosses registrations / covered but not imported. The cumulative[buffers]CPU-copy line gets the tallies plus the first four samples of each cause. That alone should tell us what0x20d0000000is.APS5_IMPORT_GPU_ONLY=1(off by default), the registry's readable and writable bits also count the GPU bits, so GPU-only mappings join the lease and are imported and bound in place. The protection the title queries stays the recorded one.If the classifier says
0x20d…is GPU-only, the flag row is the A/B you described:0x20dregions stop accumulating, unreusable builds and upload ms fall, presents rise. If it says unregistered or something else, the samples show which mapping path to follow next.Imported from boykopovar/AnyPS5. Originally posted by m335671 on 2026-10-18T23:15:23Z.
Hello Neighbor 2 (PPSA07426, 01.000.000) on your branch
f9d780325, Windows 11 Pro 26200, Ryzen 9 7900, RTX 4070 12 GB (NVIDIA 616.92), WinLibs GCC 15.2.0. Gameplay, standing still,APS5_PROFILE_DRAW=1, warm caches, one run without and one run withAPS5_IMPORT_GPU_ONLY=1. The picture is wrong here too (dark scene, wrong colours, missing models), as in the original report.The classifier answers the open question for this title: every outside-import region is
crosses registrations, and none is GPU-only.So the hot
0x20d0000000regions (1 MiB each, as in the report) do sit inside registered memory, but they span more than one registration, andrunCoversrefuses them for that reason. The GPU-only flag has nothing to act on here.Frame rate in the same spot (last 8 windows each):
I wouldn't read the drop as the flag's doing. GPU busy also went up by about 60 ms, and the flag changes nothing in the classifier, so the camera most likely wasn't framed identically between the two runs. That's one run per side with manual positioning.
AI-assisted: yes (Claude Code). The builds, the log analysis and this comment were done and written by Claude Code on my machine; I played to the spot and held still.