-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fix Overlap R3 #23349
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
Fix Overlap R3 #23349
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -91,10 +91,8 @@ def copy_to_cpu(self, return_logprob: bool, return_routed_experts: bool): | |||||||||||||||||
| if self.accept_lens is not None: | ||||||||||||||||||
| self.accept_lens = self.accept_lens.to("cpu", non_blocking=True) | ||||||||||||||||||
|
|
||||||||||||||||||
| if self.routed_experts_output is not None and return_routed_experts: | ||||||||||||||||||
| if self.routed_experts_output is not None: | ||||||||||||||||||
| self.routed_experts_output.copy_to_cpu() | ||||||||||||||||||
| else: | ||||||||||||||||||
| self.routed_experts_output = None | ||||||||||||||||||
|
|
||||||||||||||||||
|
Comment on lines
+94
to
96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parameter
Suggested change
|
||||||||||||||||||
| if (x := self.expert_distribution_metrics) is not None: | ||||||||||||||||||
| x.copy_to_cpu() | ||||||||||||||||||
|
|
||||||||||||||||||
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.
copy_to_cpu()now always callsself.routed_experts_output.copy_to_cpu()whenever the capturer is enabled, even when no request asked for routed experts. In overlap mode,batch.return_routed_expertsis computed asany(req.return_routed_experts for req in reqs)(seeschedule_batch.py), so this removed guard turns an optional D2H path into a per-batch cost. For MoE models this can add large host transfers and finalize work on every step, materially reducing throughput/latency for workloads that enable routed-expert support but only occasionally request it.Useful? React with 👍 / 👎.