Skip to content

Conversation

ByronHsu
Copy link
Collaborator

@ByronHsu ByronHsu commented Jun 14, 2025

Motivation

Upstream the latest prefill code to minimize conflicts without functionality changes

Modifications

Checklist

@ByronHsu ByronHsu force-pushed the byron/prefill-sync branch from eb0acce to a9eb917 Compare June 14, 2025 21:25
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ByronHsu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the prefill disaggregation component to align with open source standards and minimize conflicts. The changes introduce more detailed configuration options for distributed setups (TP, DP, PP), add a safeguard against oversized requests, and refine the request handling flow within the prefill disaggregation queues, including support for pipeline parallelism coordination.

Highlights

  • Disaggregation Configuration: Added new parameters to KVArgs and ServerArgs to support specifying decode TP/DP sizes and prefill PP size, allowing for more flexible disaggregation setups.
  • Request Capacity Check: Implemented a check in the prefill disaggregation queue to prevent processing requests that exceed the maximum configured KV capacity, logging an error and aborting the request if necessary.
  • Prefill Bootstrap/Inflight Queue Enhancements: Modified the prefill bootstrap and inflight queues to handle failed requests more explicitly and added logic for pipeline parallelism (PP) coordination, including checking request IDs against previous ranks.
  • Code Alignment and Refactoring: Renamed the FakeBootstrapHost constant to FAKE_BOOTSTRAP_HOST for better naming conventions and added KVArgs as a recognized class type in the disaggregation utilities.
  • Typo Correction: Corrected a consistent typo in comments and variable names related to the 'inflight' queue, changing it to 'infight'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the prefill disaggregation logic, introducing new parameters and refining existing functionalities. There are a few issues regarding attribute naming and type consistency that need to be addressed to prevent runtime errors.

max_total_num_tokens: int,
# TODO(OSS): [x] add server args
decode_tp_size: int,
decode_dp_size: int,
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Typo: bootstarp_port should be bootstrap_port.

Suggested change
decode_dp_size: int,
bootstrap_port: int,

assert token_id >= 0, f"token_id: {token_id} is negative"
output_id_buffer = self.metadata_buffers[0]
output_id_buffer[idx] = token_id
self.max_total_num_tokens = max_total_num_tokens
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Use bootstrap_port instead of bootstarp_port to align with the corrected parameter name.

Suggested change
self.max_total_num_tokens = max_total_num_tokens
self.bootstrap_port = bootstrap_port

@ByronHsu ByronHsu marked this pull request as ready for review June 14, 2025 21:39
@ByronHsu ByronHsu force-pushed the byron/prefill-sync branch from 6247a60 to 4c8b7ae Compare June 14, 2025 21:50
@ByronHsu ByronHsu force-pushed the byron/prefill-sync branch from 4c8b7ae to bcc5943 Compare June 14, 2025 21:53
@ByronHsu
Copy link
Collaborator Author

The tests failed due to huggingface connectivity. Disaggregation test passed locally.

@ByronHsu ByronHsu merged commit 7d31699 into main Jun 14, 2025
6 of 54 checks passed
@ByronHsu ByronHsu deleted the byron/prefill-sync branch June 14, 2025 22:59
coco-alen pushed a commit to jinleic/sglang that referenced this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant