Skip to content

Improving Total Token Throughput by 1%: Reducing CPU Overhead in Zero-Overhead Scheduling #4790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions python/sglang/srt/managers/tp_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ def forward_batch_generation(
) -> Tuple[LogitsProcessorOutput, Optional[torch.Tensor]]:
forward_batch = ForwardBatch.init_new(model_worker_batch, self.model_runner)
logits_output = self.model_runner.forward(forward_batch)
if launch_done:
launch_done.set()

if skip_sample:
next_token_ids = None
Expand Down
4 changes: 1 addition & 3 deletions python/sglang/srt/managers/tp_worker_overlap_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def forward_thread_func_(self):
batch_pt += 1

# Create event
self.launch_done = threading.Event()
copy_done = torch.get_device_module(self.device).Event()

# Resolve future tokens in the input
Expand All @@ -141,7 +140,7 @@ def forward_thread_func_(self):

# Run forward
logits_output, next_token_ids = self.worker.forward_batch_generation(
model_worker_batch, self.launch_done
model_worker_batch
)

# Update the future token ids map
Expand Down Expand Up @@ -171,7 +170,6 @@ def forward_thread_func_(self):
def resolve_batch_result(self, bid: int):
copy_done, logits_output, next_token_ids = self.output_queue.get()
copy_done.synchronize()
self.launch_done.wait()

if logits_output.next_token_logprobs is not None:
logits_output.next_token_logprobs = (
Expand Down