Skip to content

Commit 310037b

Browse files
committed
Self-review: clean up stream synchronization
1 parent 39cd9ff commit 310037b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

megatron/core/inference/text_generation_controllers/text_generation_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ async def async_generate_output_tokens_dynamic_batch(
16961696
# Forward pass produces only base logits. When speculative decoding is
16971697
# active, MTP logits are computed serially after verification.
16981698
self._dynamic_step_forward_logits(input_ids, position_ids)
1699+
torch.cuda.current_stream().wait_event(self._pre_forward_bookkeeping_event)
16991700

17001701
# Commit Mamba intermediate states before update_requests, which
17011702
# may swap request indices. The Python lists tracking EOS block IDs
@@ -1716,7 +1717,6 @@ async def async_generate_output_tokens_dynamic_batch(
17161717
# NOTE [TDE]: This will be moved once CPU and GPU methods are separated.
17171718
await asyncio.sleep(0)
17181719

1719-
torch.cuda.current_stream().wait_event(self._pre_forward_bookkeeping_event)
17201720
with torch.inference_mode():
17211721
return_log_probs, return_top_n_logprobs = self._dynamic_step_log_probs_bookkeeping()
17221722
if self.num_speculative_tokens > 0:

0 commit comments

Comments
 (0)