Residency sets are re-wired after the GPU idles: 0.3 s kernel stalls on several queues, about every 25 s #466
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#466
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?
@lautarocherro on GitHub · 2026-11-27 21:12 UTC · original
What happens
@Olima34 measured it (handoff on #258, M5 Pro 48 GB): about every 25 s, a few command buffers take 0.31 to 0.36 s of kernel time each, on 3 queues at once, and hold the queues for 1.5 to 3.3 s with GPU time near 0. An unchanged set costs 0.03 ms per buffer in an isolated test, so it isn't the set's size alone.
docs/native-host.md ("Why the wired memory flips") already found part of the cause. During CPU stalls (pipeline creation, the title waiting), the system un-wires an idle device's memory, whatever
requestResidencyasks. The slow residency calls come right after, when the set is made resident again. So the episodes are probably that re-wiring of the ~18 GB heap set after each idle gap.Plan
VICTORY_TRACE_RESIDENCY=1and wired memory sampled, and check that each episode follows a gap with nothing committed.Counts only. This is only the re-wire cost, not the GPU time-outs of #79 (@Tarraga). Say if it overlaps your work.
@lautarocherro on GitHub · 2026-11-27 21:12 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-27 21:12 UTC · original
Claimed by @lautarocherro. Open a draft pull request with
Refs #462in its description within 24 hours, or the claim expires.@lautarocherro on GitHub · 2026-11-27 22:22 UTC · original
Results. M5 Pro 48 GB, macOS 27.2.1, Series X, headless, 300 s each, main
b998bb65plus one trace change: the commit trace'scb doneline also gives kernel time. Four runs with each setting, alternated.The churn is real. In the world, an allocation leaves the heap's set with a commit of its own each time its last entry is overwritten. That is about 5,000 commits a second (2,900 to 5,800), with the set at 24 GB and 50,000 to 90,000 allocations.
It is not what stalls. I tried keeping unnamed allocations in the set and removing them in one commit every 2 s (a local switch). That cut the commits to about 24 a second, but nothing else moved:
So I won't open a PR for it.
What the kernel time likely is. Many command buffers show
gpu_ms=0.0with 100 to 280 ms of kernel time. Metal's kernel start and end times cover scheduling, so this is probably time spent waiting for other queues' shared events (title fences, order events), not residency work. The idle un-wiring in docs/native-host.md isn't involved either: no episode followed a gap of more than 1.9 s in commits.I'm releasing this issue. If the kernel time on the
cb doneline is useful to someone (it measures it withoutVICTORY_TRACE_GPU_FAILS), I can open that as a small PR.@lautarocherro on GitHub · 2026-11-27 22:22 UTC · original
/release
@github-actions[bot] on GitHub · 2026-11-29 00:42 UTC · original
The claim by @lautarocherro has expired: no pull request referenced it within 24 hours. This issue is free to claim.