Skip to content

vllm.distributed.ec_transfer.ec_connector.cpu.scheduler

ECCPUScheduler — CPU offload scheduler delegate.

Owns the mmap region and the embedding cache, and handles the producer (GPU->CPU offload) and consumer (CPU->GPU reload) scheduler-side logic for the ECCPUConnector.

Modules:

  • embedding_cache –

    EmbeddingCache — named-entry block cache with FIFO eviction.

Classes:

ECCPUScheduler

Scheduler delegate for the ECCPUConnector.

Methods:

_admit_item(request, input_id, num_computed_tokens, now)

Check one encoding, starting a remote read if needed.

Returns:

  • bool –

    True if already computed, cached, or not remotely sourced. False

  • bool –

    while waiting for a read or cache space, including across retries.

Raises:

  • _RemoteUnavailable –

    The remote source is invalid, the read failed, or the item's total wait budget expired.

_create_data_transport(engine_id)

Build the P2P data plane named by ec_transport (default nixl).

_fail_or_fallback(request, feature, why)

Resolve an unavailable remote encoding and clear its wait budget.

Returns:

  • bool –

    True if local media or embeddings are available, removing this

  • bool –

    item's remote announcement so subsequent steps do not retry it.

  • bool –

    False if only placeholder metadata (or no input) is available,

  • bool –

    recording the request for take_unavailable_requests() to drain.

_nixl_consumer_admit(request, num_computed_tokens)

Admit a request once its required remote encodings are ready.

Each item has a per-request wait budget that survives transfer retries. Unavailable items fall back to local input; without it, the request is reported by take_unavailable_requests() for the scheduler to abort.

Returns:

  • bool –

    True if no item needs to wait for a remote encoding. False if any

  • bool –

    item is pending or the request must be aborted.

_promote_completed_reads()

Drain the just-completed set built during _poll_step.

Reads are marked ready in _process_session_results, so a deferred request is re-admitted by ensure_cache_available and loaded through the same local path as a natively cached entry (update_state_after_alloc -> _pending_loads). No explicit pin/load bookkeeping is needed here beyond clearing the set.

_start_xfer(mm_hash, info, size_bytes, shape)

Allocate a not-ready cache entry and start a NIXL READ into it.

Returns True if the transfer was started. Returns False when the cache cannot accommodate the encoding; admission will retry it.

_teardown_nixl()

Close the control sockets and release the NIXL agent.

Guards each step and clears what it releases, so it is safe on a scheduler whose NIXL setup failed part-way and safe to call twice. The shared region is not touched — shutdown() owns that.

has_pending_push_work()

Keep the engine stepping so this connector's polls keep running.

With NIXL enabled the engine tick is the only driver of ProducerSession.poll_step(), and a producer's work arrives from a remote consumer, so nothing local would otherwise wake it. Without NIXL this only has to outlive dispatched saves and loads, so the engine can quiesce once the worker has confirmed them.

take_unavailable_requests()

Return and clear IDs of requests that cannot obtain their encodings.

The scheduler must abort these requests rather than leave them waiting. Requests that can fall back to local input are not included, and each recorded failure is returned only once.

update_connector_output(connector_output)

Apply the worker's memcpy-completion report to the cache.

Completed saves become safe to mark ready. A load is unpinned once every participating rank has reported its transfer id; reports for a transfer that has already been released, or for one this scheduler never dispatched, are ignored.

_RemoteUnavailable

Bases: Exception

An item cannot be fetched within its request's remote wait budget.