perf(windows): since #5596, Sword of the Sea's title drops from ~7.4 to 2.4 FPS: direct host imports are compared (~1.5 TB per 10 s) #5692
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 AlxcBTW on 2026-10-14T06:58:59Z.
Title and scene
Sword of the Sea (PPSA25344, UE5), the title screen (static scene, the same hold in every run), Windows 11, RTX 5070 Laptop 8 GB, NVIDIA 617.42, Ryzen AI 9 365, on AC, warm caches,
APS5_PROFILE_DRAW=1.What changed
On
mainf40b6930f(which includes #5596) the title runs at 2.4 FPS. Our lab base from before #5596 (mainof 2026-10-12 plus the depth-array store fix that has since merged ascc3b47dda) runs the same title at 7.3–7.5 FPS, mean 7.44 over four rows.mainf40b6930f(2 rows)mem.compare_ms169–170 per frameBoth
mainruns log:and
[guestmem]per 10 s:compare 390283 calls 1490544 MiB 67.4 s. That is about 1.5 TB of guest memory compared every 10 s. DISPATCH_DIRECT on queue 0 rises to ~4 s per 10 s (161 ms per frame), with the device call at ~147 ms.So the comparison fallback for direct host imports looks like it costs this title about two thirds of its frame rate. It may be worth keeping write tracking (or a cheaper dirty signal) for imported direct memory that the GPU reads every frame.
Caveats
main. I haven't runmainwith only #5596 reverted yet. @johnmaia's revert run on #361 suggests that is the decisive change, for the throw at least.APS5_RESOURCE_CACHE_ENTRIES,APS5_HOST_IMPORT_JOIN,APS5_HTILE_STORE_BACK,APS5_EXP_BDA_SWEEP_SKIP). They were the same on both sides.mainruns still ended onFAsyncLoadingThread(one 0xc0000005 at t197). That's the #361 class through another path, likely what #5052 covers. The storage-image debt throw from #5024 that @johnmaia reported shows up on our stack-on-main rows as well.I can run
mainwith #5596 reverted on the same scene if that helps. Logs are available.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T07:05:51Z.
Yes, a same-current-main control with only #5596 reverted would help isolate the regression. Please keep the scene, switches, cache state, and run duration fixed, and compare the per-frame
mem.comparebytes/time alongside queue-0, GPU time, and FPS. That will show whether #5596 is driving the comparison increase before anyone changes the write-tracking path.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T07:35:47Z.
Resident Evil Village (PPSA01556, 01.210.000) pays the same comparison cost.
First, a note on reading the
[guestmem]line: its counters are running totals since start.TimedAccessadds to per-thread counters,FoldMemoryCounterssums them for each report, and nothing resets them (GuestMemory.cpp). Socompare 390283 calls 1490544 MiB 67.4 sis everything compared up to that line, and the rate per 10 s is the difference between two consecutive lines. The per-framemem.compare_msabove is a separate measure and isn't affected.Village, the last three
[guestmem]reports of a 5-minute boot that reached the title screen, withAPS5_PROFILE_DRAW=1:So per 10 s there it compares about 54,000 MiB and spends about 5.5 s comparing; by then the totals are about 1.16 million MiB and 125.5 s. The log has the same line:
Setup: Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS, 15.4 GB.
main0b6d033b8, which includes #5596. Added to it:APS5_RE8_LAZY_PREPARE=1, withAPS5_NO_GPL=1); plainmainheads for the commit limit here preparing them all at registration;None of them change the counted comparison code or its callers. I don't have a Village run with #5596 reverted yet, so this shows the size of the cost, not how much of it #5596 added.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T09:23:52Z.
Both runs are from before #4878 (merged 06:20Z), which compares these unwatched direct imports only after a write-watch mark instead of at every epoch. Please use current main for the run with only #5596 reverted, and for the plain main row next to it.
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-14T13:19:30Z.
A run on current
main(131171e77, includes #4878), with homebrew anyone can run: the same comparison cost shows up in the render-target refresh of every draw.Setup: Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Ryzen AI 7 350, WinLibs GCC 15.2.0, Release. Catalog releases relinked with
--windows(SuperTuxKart also--trap-sdk-syscall-stubs), warm caches, 60 s each, the same start-up screen in every run. All three log[write-watch] Windows direct host imports use comparisons.SuperTuxKart (PPSA69421), with
APS5_NO_HOST_IMPORT=1as the control (I couldn't revert #5596 alone: on thismainthe revert conflicts incore/libs/prx/libc/include/WindowsMappings.hpp):mainmain,APS5_NO_HOST_IMPORT=1readTargetper 10 s[guestmem]compare per 10 s (difference of the last two reports)readTargetisrefreshResidentTarget→StorageTexture::Refresh(Draw.cpp), which collects writes over the colour target's pages for every draw. It walks the same 4320 pages either way. With the imports it compares them; without them it reads write-watch and is 23 times faster per lookup. The title is CPU-bound here (the GPU is idle most of each frame), so that's most of the 2.4× frame rate difference.ProsperoLichess (PPSA99009) and ProsperoTV (PPSA99003) pay the comparisons too: per 10 s, 68577 calls / 17.7 GiB / 1.5 s and 80860 calls / 21.2 GiB / 1.6 s. But on this iGPU they are GPU-bound (134.6 and 105.7 ms GPU busy per frame), and
APS5_NO_HOST_IMPORT=1doesn't change their frame rate (4.72 → 4.50, 4.96 → 4.62 FPS).Note for anyone repeating this with homebrew: titles that redirect their own stdout/stderr (these three do) take the
APS5_PROFILE_DRAWoutput with them, so it lands in the title's log (app0/stk.log,download0/prosperolichess/app.log,data/prosperotv/profiles/*/logs/app.log), not in the emulator's console.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-14T13:41:44Z.
ASTRO BOT (PPSA21564 01.007.000) on Windows with an AMD GPU, with the comparison asked for above: current
main(which already has #4878), the same build with only #5596 reverted, the same scene (title screen,title_controller_ship), warm shader cache,APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1 APS5_NO_SNAPSHOT_CHECK=1.Host: Windows 11 Pro 26200, Ryzen 7 5800X3D (Zen 3, no AVX-512), Radeon RX 9070 XT (driver 32.0.23033.1002), 32 GB RAM, WinLibs GCC 15.2.0, Release.
maina3aeaf884(includes #4878 and #5596) + #5671 + #5679 + #5707. Without those three, A stops at the first flip onstoring storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented.git revert -m 1 3e4fe4ce3(#5596) + #5640, relinked with--frame-red-zone(39 of 665 red-zone leaves framed).[guestmem]compare, delta[draw]packetsGraphics::Draw, us per packet[gputime]batch spanSo #4878 does not cover what this title compares. In A, the queue 0 worker's samples (
APS5_SAMPLE_THREADS) sit mostly inGuestMemory::EqualsCommittedUnsyncedandmemcmp, belowShaderResources::PrepareDrawBindings. That is the sampled-texture snapshot lookup incachedTexture: over excluded blocks its generation stays 0, soUnchangedSincenever holds andEqualsCommittedruns over the whole surface at every lookup.As a check, I gave that lookup the same
UntrackedHintkeycompareUntrackeduses: hint,NewestStamp,ForgetSerial, newest write note, taken before the read or compare, and only trusted with no recorded write pending over the surface. Then 7,324 snapshot hits were kept by the key and 11 compared, andGraphics::Drawdropped from 2,349 to ~1,150 us per packet. The title only reached ~2 FPS, though. What is left with #5596 is mostly storage-image traffic over the same ranges:StorageTexture::captureGuestBytesreads (4.6 M of 5.0 M[guestmem]read calls);B ran through the title, NEW GAME and into
intro_nextwith audio for 6 minutes on this Zen 3 host, and a later session played for ~30 minutes, without aSceSndzAudioOutMainfault. #5640 framed only 39 of 665 leaves, so that says nothing about #361 itself.AI-assisted (Claude Code); the builds and runs are on my machine.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T14:49:53Z.
Current
mainthis time. This replaces our earlier Village figure, which was from before #4878.Resident Evil Village (PPSA01556, 01.210.000) on
main23be5a02b, the last 5 minutes at the title, warm shader cache,APS5_PROFILE_DRAW=1, Windows 11, RTX 3070 Laptop (driver 617.42):[guestmem]compare: about 11,000 MiB and 1.2 s per 10 s;With #5851, which keeps imported resident direct memory write-tracked, the same tree compares nothing in either place, and the title runs about 6.6 times as many frames: https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6171130227
Both runs add #5703, #5815 and local commits that prepare shaders at their first draw (
APS5_RE8_LAZY_PREPARE=1, withAPS5_NO_GPL=1) and fix later stops. The measuredmainside also has #5688, which fixes #5596's heap-mirror abort; the #5851 side doesn't need it. Differences between consecutive running-total reports, in MiB as printed.Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-14T20:53:54Z.
The control asked for above, on current code without a revert. As noted above, reverting #5596 conflicts in
WindowsMappings.hppsinceb14d84485,2af88da01and8cc20401a. Instead I made the one call that chooses the new path switchable, and compared the same binary with and without it.GuestArenaMapDirect_nid_postfix(core/libs/prx/libc/src/GuestArena.cpp):With
resident == false, singly mapped direct memory goes through the shared section and a separate import alias, as before #5596.ASTRO BOT (PPSA21564),
-lvl hub_crashsite, no input, no profiler, warm caches. FPS comes from the window's present counter over 120 s, after a 120 s settle once the hub has started. Windows 11 Pro 26200, Ryzen 7 5800X3D, RX 9070 XT (driver 32.0.23033.1002). The build ismaine34c47921+ that switch + #5640, relinked with--frame-red-zone, withAPS5_NO_SNAPSHOT_CHECK=1 APS5_RESOURCE_CACHE_ENTRIES=4096.APS5_NO_RESIDENT_DIRECT=1The same binary runs the hub 8.6× faster when direct memory stays on the shared, alias-imported path. In my earlier profile with #4878 and a sampled-snapshot hint like #5892's, what remained with #5596 was mostly storage-image traffic over the unwatched imports (
StorageTexture::captureGuestBytesreads and write-back compares, see my comment above). That is where a fix would need to go to keep #5596's fault-free tracking without this cost.The switch brings back the write faults that #5596 removed, so it is a diagnostic, not a fix for #361. On this Zen 3 host, ~15 launches with it (and
--frame-red-zoneframing 39 of 665 leaves) had noSceSndzAudioOutMainfault. One of them stopped with an access violation on the title'sRoomLoad_ATQTthread while loading, read of 0x140 at eboot+0xd86cbb, which I have not tied to either cause.AI-assisted (Claude Code); the builds and runs are on my machine.
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-15T17:53:00Z.
A third machine for the two candidates, on Astro Bot (PPSA21564, title intro) rather than Sword of the Sea: Windows 11, Ryzen 7 5800X, RTX 4090 (NVIDIA 616.92), 3840x2160, one executable,
libs/swapped, three alternating rounds,APS5_TRACE_SECONDS=120:40.maina077a88df6c6a6c85a)22091410a)Both recover the #5596 cost here, by about 5x; neither stopped in 200 s. Details and summary lines in https://github.com/boykopovar/AnyPS5/pull/6060#issuecomment-6198650709.
Tested with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by m335671 on 2026-10-18T21:04:54Z.
The original title after #6060 merged: Sword of the Sea (PPSA25344, 01.510.000), title screen, warm caches,
APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1. Same machine for both rows: Windows 11 Pro 26200, Ryzen 9 7900, RTX 4070 12 GB (NVIDIA 616.92), WinLibs GCC 15.2.0.maind7a455a90(includes #6060fcaa43284)[write-watch]lineWindows direct host imports use comparisonsdirect host imports of private memory are settled and stay watched[guestmem]compare, difference of the last two reportsSo on this title the comparisons are gone after #6060. Caveat: the two builds are about 2,700 commits apart, so the FPS gap isn't all #6060. Only the compare line isolates it. One long run per side.
AI-assisted: yes (Claude Code). The builds, the runs and this comment were done and written by Claude Code on my machine.