Skip to content

[Misc]: Why not sort the waiting queue before popleft waiting queue? #15091

Open
@zh-jp

Description

@zh-jp

Anything you want to discuss about vllm.

The current logic is to popleft the seq in the waiting queue first, then compare it with the lowest priority seq in the running queue.

vllm/vllm/core/scheduler.py

Lines 988 to 997 in 437f916

if waiting_queue:
seq_group = waiting_queue.popleft()
num_new_seqs = seq_group.get_max_num_running_seqs()
num_new_tokens_uncached, _ = \
self._get_num_new_uncached_and_cached_tokens(
seq_group, SequenceStatus.WAITING, False, budget)
# Only preempt if priority inversion exists
while running_queue and self._get_priority(
running_queue[-1]) > self._get_priority(seq_group):

However, the step of sorting the waiting queue is placed later.

waiting_queue = deque(sorted(waiting_queue, key=self._get_priority))

Shouldn't the waiting queue be sorted first then popleft?

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    miscstaleOver 90 days of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions