Expand description
2026-09-25: Which host buffers are page-locked, so the CUDA backend’s
copy_h2d_async can keep its promise that the caller may drop the source on
return.
From pageable memory the driver stages the bytes before the call returns; from
page-locked memory the DMA engine reads the caller’s pages after it returns.
MetraleCudaBackend::alloc_host_pinned registers each buffer it allocates and
free_host_pinned unregisters it before the free. copy_h2d_async asks
is_pinned and, for a pinned source, synchronises the stream before
returning and logs a warning once per process.
Owner: gpu-runtime. Invariants:
- Only memory from
alloc_host_pinnedis tracked. Page-locked memory from another route, such as thecudaHostAllocworkspace inflashinfer.rs, is not seen. - Entries stay sorted by base, with at most one entry per base.
Functions§
- is_
pinned - 2026-09-25: Whether all of
srclies inside one live registered region. An empty slice is never pinned. - live_
count - 2026-09-25: Number of live registered regions.
- register
- 2026-09-25: Record a page-locked region. A repeated base replaces the stored length; a null pointer or a zero length is ignored.
- unregister
- 2026-09-25: Forget a region.
free_host_pinnedcalls it before the free, so a reused address is not reported as still pinned.