[GH-ISSUE #404] Request for CUDA Graph Integration Example with low_latency_dispatch in MoE Workflow #274

Closed
opened 2026-10-26 09:57:48 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @tarjen on GitHub (Sep 14, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/404

Description

I'm trying to use CUDA Graph with low_latency_dispatch but getting incorrect results. The README mentions buffer status restoration for CUDA Graph replay, but I need clarification on:

How to properly initialize the buffers for CUDA Graph?

Could you provide a complete working example?

Current Issues
Tensor lifetime management with from_blob

Handling async operations during graph capture

Buffer restoration process during replay

Specific Questions

How should I initialize the buffers for CUDA Graph compatibility?

Can you provide a complete CUDA Graph integration example with low_latency_dispatch?

Pseudo-code Example

# Pre-allocate input buffers  
input_ptr = pre_allocated_memory  
topk_idx_ptr = pre_allocated_indices  

# Start graph capture  
graph.begin_capture()  

# Create tensors via from_blob  
input_tensor = torch.from_blob(input_ptr, [token_count, hidden_dim], dtype=torch.bfloat16)  
topk_idx_tensor = torch.from_blob(topk_idx_ptr, [token_count, topk], dtype=torch.int64)  

# Call low latency dispatch  
recv_states, expert_count, handle, event, hook = low_latency_dispatch(  
    input_tensor, topk_idx_tensor, max_tokens_per_rank, num_experts  
)  

# Perform expert computations (GEMM) and result combination  
# ...  

# End capture  
graph.end_capture()  

Specific Issues

  1. The results after graph replay are incorrect, suggesting potential issues with:
    • Tensor lifetime management using from_blob
    • Asynchronous operations during graph capture
    • Buffer restoration during graph replay

Request

Could you provide:

  1. A complete example showing proper CUDA Graph integration with low_latency_dispatch?
  2. Any limitations or constraints when using this approach?

Thank you for your support!

Originally created by @tarjen on GitHub (Sep 14, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepEP/issues/404 ### Description I'm trying to use CUDA Graph with low_latency_dispatch but getting incorrect results. The README mentions buffer status restoration for CUDA Graph replay, but I need clarification on: How to properly initialize the buffers for CUDA Graph? Could you provide a complete working example? Current Issues Tensor lifetime management with from_blob Handling async operations during graph capture Buffer restoration process during replay ### Specific Questions How should I initialize the buffers for CUDA Graph compatibility? Can you provide a complete CUDA Graph integration example with low_latency_dispatch? ### Pseudo-code Example ```python # Pre-allocate input buffers input_ptr = pre_allocated_memory topk_idx_ptr = pre_allocated_indices # Start graph capture graph.begin_capture() # Create tensors via from_blob input_tensor = torch.from_blob(input_ptr, [token_count, hidden_dim], dtype=torch.bfloat16) topk_idx_tensor = torch.from_blob(topk_idx_ptr, [token_count, topk], dtype=torch.int64) # Call low latency dispatch recv_states, expert_count, handle, event, hook = low_latency_dispatch( input_tensor, topk_idx_tensor, max_tokens_per_rank, num_experts ) # Perform expert computations (GEMM) and result combination # ... # End capture graph.end_capture() ``` ### Specific Issues 1. The results after graph replay are incorrect, suggesting potential issues with: - Tensor lifetime management using `from_blob` - Asynchronous operations during graph capture - Buffer restoration during graph replay ### Request Could you provide: 1. A complete example showing proper CUDA Graph integration with `low_latency_dispatch`? 2. Any limitations or constraints when using this approach? Thank you for your support!
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#274
No description provided.