-
Notifications
You must be signed in to change notification settings - Fork 272
Support Qwen models' dp>1 in PD #999
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 @zhhangBian, 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 significantly enhances the system's capability by introducing robust support for data parallelism (dp > 1) in the KV cache management, particularly benefiting Qwen models. It moves beyond the previous limitation of single data parallel replicas per node by implementing specialized data transfer kernels and adapting the KV cache handling logic to efficiently operate across multiple GPUs within a node.
Highlights
- Data Parallelism Support: The core change enables support for data parallelism (
dp_size_in_node > 1
) within the KV cache management system, specifically for Qwen models. Previously, the system was restricted to a single data parallel replica per node. - New KV Transfer Kernels: Introduced and integrated new KV transfer kernels (
kv_trans_v2_for_d_node
andkv_trans_v2_for_p_node
) to efficiently handle KV cache data movement across multiple data parallel replicas on a single node. - Refactored KV Cache Transfer Logic: Modified the
send_to_decode_node
,receive_from_prefill_node
,send_to_decode_node_p2p
, andreceive_from_prefill_node_p2p
functions to conditionally dispatch to the new data parallel logic. This includes managingmem_ptrs_dict
(pointers to KV buffers across replicas) andtoken_dp_indexes
(mapping tokens to their respective data parallel replicas) during data transfers.
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 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 or fill out our survey 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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this 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 introduces support for data parallelism (dp > 1
) in the prefill/decode (PD) architecture, specifically for Qwen models. The changes primarily focus on updating the KV cache transfer mechanism between prefill and decode nodes to handle multiple data-parallel groups.
The approach involves new Triton kernels (kv_trans_v2
) for efficiently gathering KV cache from various data-parallel groups on the prefill side and scattering it to the correct group on the decode side. The logic correctly branches to use these new p2p transfer functions when dp_size_in_node > 1
.
My review has identified two critical bugs that will cause a NameError
when dp_size_in_node
is not greater than 1, due to a variable being used before assignment. I have provided code suggestions to resolve these issues. Other than these critical issues, the logic for handling dp > 1
appears sound.
af7213c
to
deb2321
Compare
No description provided.