@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 820d7815eb
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 7, 22:45 UTC

[Core] Minor structured-output related scheduler optimization (#34765)

Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>

Nick Hill committed Feb 21, 2026 at 01:38 UTC 820d7815ebd5e88118e5be02870af9ce49a314b1
1 file changed +6 -6
vllm/v1/core/sched/scheduler.py
+6 -6
@@ -945,7 +945,7 @@ class Scheduler(SchedulerInterface):
945 request.num_tokens + request.num_output_placeholders
946 )
947 scheduler_output.has_structured_output_requests |= (
948 - request.use_structured_output
948 + request.use_structured_output and not request.is_prefill_chunk
949 )
950
951 # NOTE: _free_encoder_inputs relies on num_computed_tokens, which
@@ -1232,14 +1232,14 @@ class Scheduler(SchedulerInterface):
1232 ) -> GrammarOutput | None:
1233 # Collect list of scheduled request ids that use structured output.
1234 # The corresponding rows of the bitmask will be in this order.
1235 - # PERF: in case of chunked prefill,
1236 - # request might not include any new tokens.
1237 - # Therefore, we might introduce some additional
1238 - # cycle to fill in the bitmask, which could be a big no-op.
1235 + if not scheduler_output.has_structured_output_requests:
1236 + return None
1237 +
1238 structured_output_request_ids = [
1239 req_id
1240 for req_id in scheduler_output.num_scheduled_tokens
1242 - if (req := self.requests.get(req_id)) and req.use_structured_output
1241 + if (req := self.requests.get(req_id))
1242 + and (req.use_structured_output and not req.is_prefill_chunk)
1243 ]
1244 if not structured_output_request_ids:
1245 return None