Skip to content

Commit 4f075b5

Browse files
njhillshreyankg
authored andcommitted
[V1] Simplify GPUModelRunner._update_states check (vllm-project#13265)
1 parent 3268893 commit 4f075b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vllm/v1/worker/gpu_model_runner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ def _update_states(self, scheduler_output: "SchedulerOutput") -> bool:
347347
self.input_batch.block_table.append_row(req_index, start_index,
348348
req_data.new_block_ids)
349349

350+
batch_changed = len(removed_req_indices) > 0 or len(req_ids_to_add) > 0
351+
350352
# Add the new or resumed requests to the persistent batch.
351353
# The smaller empty indices are filled first.
352354
removed_req_indices = sorted(removed_req_indices, reverse=True)
@@ -363,8 +365,8 @@ def _update_states(self, scheduler_output: "SchedulerOutput") -> bool:
363365
# Condense the batched states if there are empty indices.
364366
if removed_req_indices:
365367
self.input_batch.condense(removed_req_indices)
366-
return (len(unscheduled_req_ids) > 0 or len(req_ids_to_add) > 0
367-
or len(scheduler_output.finished_req_ids) > 0)
368+
369+
return batch_changed
368370

369371
def _prepare_inputs(self, scheduler_output: "SchedulerOutput"):
370372
total_num_scheduled_tokens = scheduler_output.total_num_scheduled_tokens

0 commit comments

Comments
 (0)