In this article
Discard releases selected GPU backing without saving tensor contents; waking storage and restoring correct model state are separate responsibilities.
The name CuMemAllocator.discard describes a narrower operation than a complete model switch. In the reviewed vLLM source, it releases mapped GPU allocations selected by tags without creating CPU backups of their contents. Understanding that difference is essential when deciding what a later wake-up can restore and what the serving runtime must rebuild.
Separate the historical proposal from current source
The original roadmap discussion describes a contributor’s model-switching work and proposes a tag-selective discard primitive. Its reported switching timings concern a broader orchestration system. They are not measurements of the allocator function alone.
The reviewed upstream source now contains a discard method. We inspected a dated source snapshot rather than assuming the earlier proposal was still the complete implementation status. A current branch can change, and the presence of a method there does not establish which packaged release or installed deployment contains it.
Follow the allocation tags and policy
The allocator records tagged allocations and their sleep state. The discard method selects matching active allocations, waits for device work and releases their mapped backing through the sleep helper. Other tags are not selected by that call.
Already sleeping allocations require separate interpretation. The reviewed implementation does not silently change the policy of an allocation that already has a CPU backup. This matters for repeated calls and mixed sleep/discard workflows: the requested tag list alone is not a complete description of the resulting allocation state.
Distinguish address availability from restored contents
Wake-up recreates mappings and copies back data when a CPU backup exists. An allocation discarded without a backup has no such saved content to restore. Recreating storage therefore differs from recovering the old tensor values.
A higher-level system must know which discarded state can be reinitialized and which needs an external source. Model weights, cache backing, graph-related buffers and runtime metadata have different lifecycles. A function that releases selected memory does not automatically reconstruct model configuration, reload a tokenizer or validate a live request after an architecture change.
Keep correctness and memory accounting together
Useful checks include live-work synchronization, repeated discard and wake cycles, allocation-state transitions and output correctness after reinitialization. Measuring only free VRAM can miss a broken dependency or stale tensor content. Conversely, keeping an address reservation does not mean the original physical backing remains resident.
The original discussion’s complete-switch timings should remain attributed to that contributor’s setup. They should not become a universal restart time for every vLLM model or accelerator. Device synchronization, weight loading and other reconstruction work can dominate the operation around the allocator call.
Record the exact reviewed version
A reproducible investigation needs the source revision, platform, allocation tags and the caller’s reconstruction procedure. It should also identify which bytes are backed up and which are deliberately discarded. Memory release is a resource-management action, not evidence that every higher-level state transition or data-erasure property has been validated.
We read the upstream discard, sleep helper and wake-up paths together with the original discussion without running vLLM or changing inference settings. The reproducible-stack guide covers version records, and the document-split guide covers a separate evaluation-data issue. The practical distinction is between freeing storage, recreating storage and restoring usable model state.
Sources
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.