Repository navigation
[Perf] [NVIDIA] dspark: Stage draft DP-MoE token counts through persistent buffers #47677
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?
Changes from 3 commits
7fc04f8
0eba5d0
c2a44f0
5d3d618
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 |
|---|---|---|
|
|
@@ -50,6 +50,10 @@ def test_draft_counts_are_not_scaled_twice(self): | |
| proposer = object.__new__(DraftBlockProposer) | ||
| proposer._dp_moe_sync = True | ||
| proposer._num_token_non_padded = None | ||
| proposer._dp_meta_host = None | ||
| proposer._dp_meta_device = None | ||
| proposer._dp_meta_copied = [] | ||
| proposer._dp_meta_slot = 0 | ||
| proposer.draft_model_runner = SimpleNamespace(device="cpu") | ||
| proposer._draft_block_spec_info = SimpleNamespace( | ||
| num_tokens_per_req=width, num_tokens_for_logprob_per_req=1 | ||
|
|
@@ -64,6 +68,13 @@ def test_draft_counts_are_not_scaled_twice(self): | |
| self.assertEqual( | ||
| forward.global_num_tokens_for_logprob_cpu, [0, 3 * width, 0] | ||
| ) | ||
| self.assertEqual( | ||
| forward.global_num_tokens_gpu.tolist(), [0, 3 * width, 0] | ||
|
Collaborator
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. [by Claude Code] Severity: style | Confidence: High Issue These new GPU-count assertions cannot catch a row mix-up in Example I changed Fix In |
||
| ) | ||
| self.assertEqual( | ||
| forward.global_num_tokens_for_logprob_gpu.tolist(), | ||
| [0, 3 * width, 0], | ||
| ) | ||
| self.assertTrue(forward.dp_spec_prefill_coordination_applied) | ||
| self.assertTrue(forward.is_extend_in_batch) | ||
| self.assertFalse(forward.can_run_decode_cuda_graph) | ||
|
|
||
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.
Why does here need sync? Could we remove this?
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.
This is a double buffer (note self._dp_meta_slot ^= 1), so it waits for the copy from two iterations ago. That copy has typically finished already, so it doesn't actually wait, but we still need the barrier to guarantee it.
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.
note here we are reusing the two slots, so we need to make sure its data is transferred already and then rewrite again
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.
could we use
write_host_intsto transfer this?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.
that one seems default off by SGLANG_ENABLE_MLP_SYNC_METADATA_FILL, even using that we may still need this branch for default. only keep one path look cleaner, the the wait is mostly no-op, does that make sense?