-
-
Couldn't load subscription status.
- Fork 10.8k
[perf] Use CPU tensor to reduce GPU->CPU sync #25884
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
Conversation
Signed-off-by: Lehua Ding <lehuading@tencent.com>
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 a performance optimization to reduce GPU-to-CPU synchronization during speculative decoding. The change replaces a call to .max() on a GPU tensor (seq_lens) with its CPU counterpart (seq_lens_cpu) within a conditional check. This avoids a blocking operation, which is particularly beneficial for asynchronous scheduling. The change is correct and aligns with the stated goal of improving performance. I have no further comments.
|
Which introduce by this pr(#24662), @AlonKejzman can you help review this too? thanks. |
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.
LGTM, thanks!
Signed-off-by: Lehua Ding <lehuading@tencent.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com> Signed-off-by: yewentao256 <zhyanwentao@126.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com> Signed-off-by: Tomer Asida <57313761+tomeras91@users.noreply.github.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com>
Signed-off-by: Lehua Ding <lehuading@tencent.com> Signed-off-by: xuebwang-amd <xuebwang@amd.com>
Use
seq_lens_cpuinstead ofseq_lensto reduce GPU->CPU sync.Purpose
Reduce unnecessary GPU->CPU sync, since it will affect the perf of Async Scheduling+MTP.

Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.