Skip to content

Perf: Fix sparse queue residency stalls - #988

Merged
uuuvn merged 1 commit into
mainfrom
residency_fix
Oct 19, 2026
Merged

uuuvn merged 1 commit into
mainfrom
residency_fix

Conversation

@CC-Yeh

@CC-Yeh CC-Yeh commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Remove the model residency set from the sparse queue, avoiding a ~3-second prefill stall on base M5.

Unmap/event batches unnecessarily prepared model resources. With insufficient wired-memory headroom, mach_vm_wire_level_monitor checks failed, triggering costly GPU mapping eviction and rebuilding.

Sampled driver stacks (intermediate frames omitted):

Eviction:
IOGPUCommandDescriptor::prepare
  → IOGPUScheduler::freeToWireSysMemory
  → IOGPUMemory::evict
  → release_mappings
  → AGXSecureGart::unmapFromThisGart
  → pmap_iommu_unmap

Preparation:
IOGPUCommandDescriptor::prepare
  → IOGPUMemory::prepare_memory_slow
  → commit_mappings
  → AGXSecureGart::mapInThisGart
  → pmap_iommu_map

The compute queue keeps model residency for prefill/decode. Sparse operations, events, and resource lifetimes are unchanged.

@CC-Yeh
CC-Yeh marked this pull request as ready for review October 19, 2026 15:31
@CC-Yeh
CC-Yeh enabled auto-merge (squash) October 19, 2026 15:32
@uuuvn
uuuvn disabled auto-merge October 19, 2026 17:58
@uuuvn
uuuvn merged commit e6399cb into main Oct 19, 2026
9 of 10 checks passed
@uuuvn
uuuvn deleted the residency_fix branch October 19, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants