Skip to content

vllm.v1.kv_offload.tiering.fs.thread_pool

Thread pool: Two queues (load, store) and two sets of threads: - Load-priority threads: drain the load queue first, then the store queue. - Store-priority threads: drain the store queue first, then the load queue. Load jobs are enqueued to the load queue; store jobs to the store queue.

Classes:

  • DualQueueThreadPool –

    Thread pool with two task queues (load and store) and two thread groups.

  • JobState –

    Thread-safe completion tracker for a set of per-block I/O tasks.

DualQueueThreadPool

Thread pool with two task queues (load and store) and two thread groups.

Load-priority threads drain the load queue first, then fall back to the store queue. Store-priority threads do the reverse. Both queues share a condition variable. Idle waiters have a separate condition under the same lock so job completion does not wake workers looking for tasks.

Methods:

  • enqueue_load –

    Enqueue load tasks for a job (high-priority for load-priority threads).

  • enqueue_store –

    Enqueue store tasks for a job (high-priority for store-priority threads).

  • wait_idle –

    Block until there are no in-flight jobs.

enqueue_load(job_id, n_tasks, tasks)

Enqueue load tasks for a job (high-priority for load-priority threads).

enqueue_store(job_id, n_tasks, tasks)

Enqueue store tasks for a job (high-priority for store-priority threads).

wait_idle()

Block until there are no in-flight jobs.

After this returns, every submitted job has had its last task finish, so no worker thread is still copying data. Note: completed jobs may still be sitting in _finished_q waiting for get_finished() to drain them.

If shutdown has started, use shutdown(wait=True) to join workers instead; queued tasks may have been discarded.

JobState

Thread-safe completion tracker for a set of per-block I/O tasks.

Each task calls task_done(success) when it finishes.

Methods:

  • task_done –

    Returns if job completed and success flag.

task_done(success, transfer_time)

Returns if job completed and success flag.