perf: SuperTuxKart (PPSA69421) race on Windows at 20-24 FPS: a serial chain of label round trips, measured ceilings and a direction #25912
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 LeandroLP23 on 2026-11-22T20:57:45Z.
Title and scene
PPSA69421 (SuperTuxKart 00.001.000), the tutorial race at 1920x1080, driving straight from the start (scripted pad timeline below), 10 s window starting 80 s after the first present.
What is slow or what changed
On Windows the race runs at about 20 FPS on
main8c254da48band about 24 FPS with the open #10442, #24445 and #24869 merged on top (682a512644, a local merge). Both are far from the title's 60. This report shows where the frame goes, gives ceilings measured with local prototypes, and asks for the same run on other machines. It also proposes a direction. The short version is that the frame is a serial chain of label round trips. That is the same mechanism #24728 found on macOS, and a different shape from the many-draws case in #17533.Machine. Windows 11 (10.0.26300), NVIDIA GeForce RTX 5060 Ti (NVIDIA 621.24, PCIe 3.0 x8), Intel i5-10600K, WinLibs GCC 15.2.0 r7, Release.
The frame is a chain. The title submits work about 33 to 35 times per frame (
Recorder.SubmitandRecorder.Synccounts) and polls a label until each submission completes before it builds the next (#24728 found the same on macOS). From the traces (per frame; committer recording is the committer's busy time minusRecorder.Sync):mainRecorder.SyncThe GPU sits idle between batches for more time than it works. That idle time is the latency of each round trip: recording the draw, submitting it, starting it, and the title waking on the label. It is paid about 34 times in series. The wake-up itself is not the problem:
Recorder.Syncends a median of 48 to 55 us after the last batch it waited for (p90 80 to 89 us).The title's own thread (sampled with
APS5_SAMPLE_THREADSon an earlier stack at about 38 ms per frame):clock_gettimecalled about 5,000 times per frame, and the arena reset.Even with every wait gone, the CPU side alone is about 16 ms per frame on this CPU, and the chain adds the GPU time of each draw on top. So 60 FPS would need both the chain and the CPU cost reduced.
What the GPU time is.
APS5_PROFILE_GPU, per present, on an earlier local stack with these changes (a separate run, since the capture form excludes profile switches):The write-backs are
StoreDrawnLinear("label"). It stores two linear 1920x1080 RGBA8 targets in full at every label, about three times each per frame. The CPU then clears them withrep stosat the start of the next frame, and later draws sample them through their guest addresses.Ceilings measured with local prototypes (not proposed as they are; frame p50 over the race window, two alternated rounds in one session on the earlier local stack with
APS5_PROFILE_GPU=1, so compare within the table, not with the capture above):pendingLookupSourcePAGE_NOACCESSat the label, a vectored handler that restores protection and runsFlushGpuWritesThe trap keeps about half of the gain. Its cost is not the protection: there were about 18,000
VirtualProtectcalls over the whole run, and the regions are large. The cost is the title's clear at the next frame. That clear faults once per target per frame, and the faulting thread then waits for the store. Removing that store safely would need to know that the CPU only writes, which a page trap cannot tell.Asking for the same run elsewhere. SuperTuxKart is free homebrew, so anyone can reproduce this. The recipe:
tools/title_run.py PPSA69421 --profile performance --trace-seconds 80:10 --seconds 110 --warmup-seconds 110 --scene "...", which warms up, restarts the title and captures with warm caches;tools/titles.json;The most useful data:
The questions are whether the per-batch idle gap (a median of 440 to 460 us on
mainand 280 to 290 us with the three PRs here) is similar across drivers, and how much the 6 write-backs cost on each.Direction proposed.
trapReadsAtLabelinStoreDrawnLinearis macOS-only today, and #19054 ports theStoreReadbackBeforeLabelside to Linux. I have a design for a Windows backend inWindowsMappingsand can post it: trap state, resolve-first in every protection writer, a resolver thread, and the three waits #19054 hit. Like #16372, it would be off by default and safe only on titles relinked with--frame-red-zoneand #16371's relocation. About 13 % here.Summary lines
Traces
GitHub does not let me attach files from the command line, so the four traces (run order main-r1, stack-r1, main-r2, stack-r2, one session) are assets of a release on my fork:
The full digests and the four summary lines are in the same release (summary-lines.jsonl).
Digest
main-r1 (full digest)
seconds 80:10 from present 1737: 207 presents, frame p50 48.3 / p90 49.9 / p99 53.8 / max 57.2 ms, GPU busy 20.7 ms per present
NVIDIA GeForce RTX 5060 Ti, NVIDIA 621.24, Windows 10.0.26300, 1920x1080, commit
8c254da48b, dropped: noThreads (ms per frame)
stack-r1 (full digest)
seconds 80:10 from present 2124: 238 presents, frame p50 41.7 / p90 43.5 / p99 48.5 / max 53.8 ms, GPU busy 14.1 ms per present
NVIDIA GeForce RTX 5060 Ti, NVIDIA 621.24, Windows 10.0.26300, 1920x1080, commit 682a512644ad, dropped: no
Threads (ms per frame)
Capture
title_run.py --profile performance: a 110 s warm-up run of the same route, then a restart and the capture)Pad timeline (race-pad.json)
AI-assisted: yes (Claude Code)