[Common][PyTorch] EP dispatch with unfused MXFP8 quantization - #3270
[Common][PyTorch] EP dispatch with unfused MXFP8 quantization#3270phu0ngng wants to merge 4 commits into
Conversation
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
Greptile SummaryAdds unfused MXFP8 quantization to NCCL expert-parallel dispatch and combine backward.
Confidence Score: 4/5The MXFP8 implementation appears safe to merge, with only the previously reported repository ignore-file deletion still requiring attention. The EP data-and-scale paths are consistently represented across the Python frontend, binding layer, common backend, and distributed tests; however, the repository ignore configuration remains entirely deleted, leaving generated and local artifacts visible to Git. Files Needing Attention: .gitignore Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant EP as PyTorch EP
participant Quant as MXFP8 Quantizer
participant Bind as C++ Binding
participant Backend as NCCL EP Backend
User->>EP: ep_dispatch(bfloat16 tokens)
EP->>Quant: Quantize to E4M3 + E8M0 scales
Quant-->>EP: Data and compact scale-inverse
EP->>Bind: Dispatch data and scales
Bind->>Backend: Block-scaled dispatch
Backend-->>EP: Expert-major data and scales
EP-->>User: Per-expert GroupedTensor
User->>EP: ep_combine(expert outputs)
EP-->>User: High-precision combined result
User->>EP: Backward(result gradient)
EP->>Quant: Quantize result gradient
EP->>Backend: Reverse dispatch data and scales
Backend-->>User: Per-expert grouped output gradient
Reviews (3): Last reviewed commit: "Separate EP dispatch-forward and combine..." | Re-trigger Greptile |
| alignment: int = 0, | ||
| payload_dtype: torch.dtype = torch.bfloat16, | ||
| device: Optional[torch.device] = None, | ||
| dispatch_quant_recipe: Optional["Recipe"] = None, |
There was a problem hiding this comment.
Let me separate the recipe for dispatch fwd and combine bwd, in case users want to use different quantization for fwd and bwd in the future.
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
|
/te-ci L1 pytorch |
Description
This PR adds MXFP8 support to the dispatch op of the NCCL EP path. The dispatch op is used in two places, and MXFP8 applies to both:
GroupedTensor.GroupedTensor.Type of change
Changes
PyTorch frontend (
transformer_engine/pytorch/ep.py,distributed.py,csrc/extensions/ep.cpp)**dispatch_quant_recipeis set (MXFP8BlockScalingonly for now); dispatch-forward recv is returned as a per-expertGroupedTensor. A pre-quantized input is rejected.GroupedTensor. Combine forward is unchanged (high-precision).Common backend (
common/ep/ep_backend.cpp,include/.../ep.h,comm_window.h)**NCCL EP submodule**
3rdparty/nccl-extensionsto the revision providing block-scaled dispatch.Tests (
tests/cpp_distributed/test_ep.cu,tests/pytorch/distributed/run_ep.py,run_test_ep.sh)**NVTE_EP_MXFP8_PASSrun since the grouped path pins the per-expert alignment process-wide.Checklist: