vllm_omni.diffusion.offloader.module_residency ¶
On-demand module staging backed by immutable pinned CPU storage.
BoundedAllocatorCache ¶
Retain reusable allocator blocks without monopolizing device memory.
Component offload normally calls empty_cache after every stage. That makes the next stage return to the device allocator even though PyTorch's cached blocks are immediately reusable. This policy keeps the cache while both of these bounds hold:
- cached-but-unallocated memory is at most 25% of device capacity; and
- at least 5% of device capacity is physically free.
Missing memory telemetry is handled conservatively by releasing the cache. Failure paths can force release; normal executor shutdown keeps its own unconditional device-cache cleanup because this policy is not global.
PinnedModuleStager ¶
Stage immutable module groups without copying device weights to CPU.
nn.Module.to("cpu") performs a device-to-host copy for every parameter after each forward. In inference the weights are immutable, so retain one pinned CPU master instead. load materializes device storage from that master; offload only rebinds Parameters and buffers to the master.
A module iterable is treated as one staging group. It uses one copy stream and one reusable completion event. Tensors sharing storage keep their shapes, strides, offsets, dtypes, and aliases across every transition.
copy_stream instance-attribute ¶
copy_stream = (
copy_stream
if copy_stream is not None
else current_omni_platform.Stream()
)