perf: PPSA12544 on Legion Go (Ryzen Z1 Extreme, Windows): queue worker 99 % busy, mostly import comparisons and GpuMutex waits #6045
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 keravyn-ops on 2026-10-14T20:29:27Z.
Title and scene
PPSA12544 (Hollow Knight: Silksong) v01.000.010 (master 01.02), gameplay right after loading a save at a bench (Moss Grotto area), standing still, no input, 1920x1080 window.
What is slow or what changed
Device: Lenovo Legion Go (83E1, BIOS N3CN40WW), AMD Ryzen Z1 Extreme (8C/16T) with Radeon 780M graphics (shared memory, 16 GiB, 12.7 GiB visible to Windows), AMD driver 25.10.20.01 (Windows 32.0.21020.1007), Windows 11 Home 10.0.26100. AnyPS5
maine27ff7c545built locally with WinLibs GCC 15.2.0 r7, relinked with--windows --module-dir Media/Modules --module-dir Media/Plugins.Frame p50 34.2 ms (about 29 fps). The queue worker is the limit:
worker_busy_pct99.2 %; the GPU is busy 24.3 ms per present. The native PC version of the same game on the same device runs with its busiest thread at 18 % of a core and the GPU at 40 %.Where the queue worker's time goes (
APS5_SAMPLE_WORKER, 7686 samples in the same scene, frames symbolized against my local build ofe27ff7c):GuestMemory::EqualsCommittedUnsyncedGuestMemory::GpuMutexType::lock()GuestMemory::ReadCommittedUnsyncedRecorder::KeepDriverDetail::PollSleepThe log says
[write-watch] Windows direct host imports use comparisons, andAPS5_WRITE_WATCH_IMPORTSis Linux only, so this looks like the Windows comparison path plus contention on the GPU mutex. The digest also showsDriver.Draw.gpu_mutex_waitwaits of up to 11 ms on the queue worker.The host import budget is small on this APU: the default comes out at 1056 MiB (the largest host heap is about 3 GiB, less the 2 GiB reserve), it is full within seconds and imports are refused (
[gpu] host import budget: 1053 MiB live of 1056 MiB (APS5_HOST_IMPORT_MIB); 46 imports (618 MiB) refused so far). Raising it does not help:APS5_THREAD_PRIORITY=highAPS5_STORE_AT_FLIP=1APS5_STORE_AT_FLIP=1 APS5_THREAD_PRIORITY=highAPS5_STORE_AT_LABEL=1 APS5_THREAD_PRIORITY=highAPS5_STORE_AT_FLIP=1 APS5_HOST_IMPORT_MIB=2560APS5_STORE_AT_FLIP=1 APS5_HOST_IMPORT_MIB=256(The fps column is the window title's counter, sampled four times after the scene settled.)
APS5_STORE_AT_FLIP=1is needed on this device: without it the title crashed while the save loaded in 7 of 13 runs (2 of 7 without any trace or sampling switch), and in none of 7 runs with it. Details and crash logs are in #726.Summary lines
Traces
aps5-trace-e27ff7c545cb-16016.json.gzis in the attached zip, together withaps5-summary.jsonl,digest.txt, the worker stacks and the crash logs referenced in #726.APS5_PAD_INPUT_FILEonly loaded the save (two presses before the window). The queue worker's event buffer filled after 9 s. Shorter windows (90:8) would have avoided that, but those runs crashed while the save loaded, so this is the capture I have.anyps5-report-attachments.zip
Digest
Full output in
digest.txt(in the zip), frompython tools/trace_digest.py. Excerpt:Worker stacks
worker.collapsed.txtandworker.txt(in the zip), from a separate run of the same scene withAPS5_SAMPLE_WORKER,APS5_STORE_AT_FLIP=1andAPS5_THREAD_PRIORITY=high. Module offsets are from my local build ofe27ff7c(WinLibs GCC 15.2.0 r7).Capture
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T20:41:10Z.
I traced the reported
memcmpframes toGuestMemory::EqualsCommittedUnsyncedin the current tree. Before changing the Windows comparison path, one useful discriminator is anAPS5_PROFILE_DRAW=1capture for the same scene: it emits per-site GPU-mutex wait totals, hold times, and which holder/site those waits occurred behind (with additional profiler overhead). If comparisons account for most of the lock hold, that points to a different fix than a long draw/present/flush critical section. I do not have a Windows reproduction here, so this is a profiling suggestion rather than a diagnosis.Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-15T16:49:46Z.
Update on
main0c4816f611: about 45 fps instead of 29, and the comparisons are goneSame device, scene and capture method as in the report. AnyPS5 built locally from a clean
main0c4816f611, and the title relinked with that relinker.e27ff7c(report)0c4816f611APS5_THREAD_PRIORITY=highAPS5_STORE_AT_FLIP=1On this AMD driver the startup log now says
host imports of write-watched memory keep the write watch: yes, and[guestmem]counts 35 compares (4 MiB) since start. So #6060 removed the comparison cost reported above. Pipelined draws are on (the default).APS5_PROFILE_DRAW=1in the same scene, as @MarcZX100 suggested. This is a separate run with profiler overhead (42-44 fps). The figures are per 10 s, the same in each window from 50 s to 90 s:[draw] pipelined: about 94,000 commits at 101 µs each on the committer, so it is busy about 9.5 s of every 10 s. The queue worker enqueues behind about 5 items (depth 8) and waits 36 µs per draw for room. Packet drains take 5.0 s.[lock], untagged threads: the GPU mutex is held 9.3 s, 9.07 s of that at the draw site (64k holds, max 105 ms), withlocked GPU waits 2161 / 5424 ms.[hooksync]: 1271 pending-write syncs waited 5512 ms. All of them are listed under queue 0DRAW_INDEX_2, over ranges of about 139K.[draw] driver phaseson the queue worker: lock wait 49.7 of 63.9 µs per draw packet.untagged/draw.So the limit is now the draw committer under the GPU mutex, and comparisons play no part. More than half of the committer's lock time is reported as GPU waits.
The lines of one 10 s window (80-90 s) and the cumulative [guestmem] line
Summary line of the trace run (no profiler):
I can attach the trace (2.3 MB) and the full profile log if they help.
Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-15T17:05:23Z.
Follow-up: the GPU waits under the lock come from the HTILE read in
storeBackClearedHtileAll pending-write syncs in the profile above come from one caller.
[recorder]lists a single top sync site,pending-write@+0x1be2a9, which resolves toFlushForAccess(against my local build of the same commit), and[hooksync]charges all 1271 per 10 s to queue 0DRAW_INDEX_2. The[guestmem]read callers of that run put the matching reads inDepthSurfaceView(+0x12c5, about 1,500 per 10 s, with its writes at +0x17db). That is theGuestMemory::Readof the HTILE words instoreBackClearedHtile(DepthSurface.cpp), inlined.The title clears its depth targets with buffer fill kernels (
fill HLEin[packets], about 300 per second), which are recorded as GPU fills and noted throughNoteDepthMetadataFill. At the next bind of the target,storeBackClearedHtilefinds a pending write over the HTILE and reads the words on the CPU. The hook then submits the batch and waits for it: 1237 of the 1271 targets were the open batch. Each wait takes about 4.3 ms, three times a frame, under the GPU mutex.To confirm it, I ran a local experiment that makes
storeBackClearedHtilereturn 0 whilePendingWriteOverlaps(htileAddress, bytes)holds. This is not a fix, because it would miss a clear that the read is there to find.main0c4816f611[hooksync]locked GPU waits(untagged)[draw] pipelinedThe frames dumped at the bench look the same.
A fix along the lines of the DCC key path (
KeysAfterPendingWrites/StoreUncompressedOnGpu) looks possible: work out the HTILE words from the pending fills and store the expanded words as a GPU fill recorded behind them, instead of reading.VulkanDevice::FillBuffernotes only byte-uniform patterns today, so the notes would also need the 32-bit word. I'm trying that locally and will open a PR if it holds up, unless someone closer to this code would rather take it.