-
Notifications
You must be signed in to change notification settings - Fork 460
[Disagg][Perf] Use NPU event sync instead of blocking tolist to avoid unintentional copy ops blocking across different NPU streams, improving disagg TTIT/TTFT #2788
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
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
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 valid performance optimization by replacing a blocking .tolist()
call with a non-blocking D2H copy and an NPU event synchronization. This is a good approach to avoid device-wide stalls. However, there is a critical bug in the implementation where the pre-allocated pinned memory tensor is sized incorrectly and uses an undefined attribute, which will cause a runtime error. I've provided a fix for this issue.
Signed-off-by: jesse <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2788 +/- ##
==========================================
+ Coverage 74.76% 75.36% +0.59%
==========================================
Files 150 155 +5
Lines 20891 21350 +459
==========================================
+ Hits 15620 16091 +471
+ Misses 5271 5259 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
nice work, can you print the benchmark result with/without this PR to make sure it works as expect? |
added to the beginning |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Signed-off-by: jesse <[email protected]>
6de8951
to
5be58d5
Compare
Signed-off-by: jesse <[email protected]>
Signed-off-by: jesse <[email protected]>
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Signed-off-by: jesse <[email protected]>
return False | ||
|
||
def _to_list(self, sampled_token_ids: torch.Tensor) -> list[list[int]]: | ||
# This is a short term mitigation for issue mentioned in |
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.
can you rewrite the comment to ascend case?
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.
updated
Signed-off-by: jesse <[email protected]>
This PR is based on top of vllm-project/vllm#22760
What this PR does / why we need it?
When we copy the sampled valid token ids from device to host, avoid using tolist which would trigger a CUDA wise stream sync if the source is on device. We change it to use non-blocking copy followed by an explicit CUDA event sync.
Does this PR introduce any user-facing change?
How was this patch tested?
Bring up vLLM server
Before:
After
As shown in the figure, the TTFT decreased