Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/sglang/srt/managers/schedule_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,7 @@ def merge_batch(self, other: "ScheduleBatch"):
self.has_stream |= other.has_stream
self.has_grammar |= other.has_grammar
self.return_hidden_states |= other.return_hidden_states
self.is_prefill_only = self.is_prefill_only and other.is_prefill_only
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using the &= operator for consistency with the other boolean flag updates in this method (lines 2265-2268).

Additionally, the is_prefill_only flag (and potentially return_hidden_states) should be re-evaluated in the filter_batch method (around line 2206). Currently, filter_batch re-evaluates flags like has_stream and has_grammar but omits is_prefill_only, which could lead to stale state if generation requests are filtered out of a mixed batch, causing the scheduler to incorrectly attempt decode steps for prefill-only requests.

Suggested change
self.is_prefill_only = self.is_prefill_only and other.is_prefill_only
self.is_prefill_only &= other.is_prefill_only


if self.spec_info:
self.spec_info.merge_batch(other.spec_info)
Expand Down
Loading