Skip to content

hybrid_ep_cpp extension hardcodes -std=c++17; should inherit torch's C++ standard like deep_ep_cpp #698

Description

@janbernloehr

Describe the bug

DeepEP's hybrid-ep branch hardcodes -std=c++17 for the hybrid_ep_cpp CUDAExtension in setup.py (get_extension_hybrid_ep_cpp()). Recent PyTorch builds require C++20 — their headers emit #error C++20 or later compatible compiler is required to use PyTorch when included from a C++17 translation unit. As a result, building hybrid_ep_cpp against a current-PyTorch environment fails at compile time.

The sibling deep_ep_cpp extension (get_extension_deep_ep_cpp()) sets no explicit -std flag — its nvcc_flags = ['-O3', '-Xcompiler', '-O3'] — and therefore inherits torch's default standard (now c++20). That is why deep_ep_cpp still builds while hybrid_ep_cpp does not.

To Reproduce

  1. Install a recent PyTorch whose headers require C++20 (e.g. a current nightly).
  2. Build DeepEP hybrid-ep with the hybrid-EP multinode extension enabled:
    HYBRID_EP_MULTINODE=1 CUDA_HOME=/usr/local/cuda pip install --no-build-isolation .
    
  3. Compilation of hybrid_ep_cpp aborts with the C++20 #error shown below.

Expected behavior

hybrid_ep_cpp builds against current PyTorch, the same way the sibling deep_ep_cpp extension already does.

Actual behavior

Building the hybrid_ep_cpp extension aborts at compile time. nvcc invokes the host compiler with -std=c++17 for the hybrid_ep_cpp sources, which include PyTorch headers (torch/all.h:5, ATen/ATen.h:5); those headers hard-#error under C++17:

error: #error C++20 or later compatible compiler is required to use PyTorch.
error: #error C++20 or later compatible compiler is required to use ATen.
...
ERROR: Failed building wheel for deep_ep

The build log shows a mix of -std=c++17 invocations (for hybrid_ep_cpp) and -std=c++20 invocations (for the sibling deep_ep_cpp, which inherits torch's standard); only the C++17 ones fail. pip install . then exits with code 1, so DeepEP is not installed and every downstream consumer is blocked.

Proposed fix

Remove the hardcoded -std=c++17 entry from the hybrid_ep_cpp nvcc compile args in setup.py, so the extension inherits torch's C++ standard from CUDAExtension/BuildExtension — exactly like deep_ep_cpp. This is portable: it builds against both C++17 torch (older) and C++20 torch (current), rather than swapping one hardcoded standard for another (a hardcoded -std=c++20 would instead break users still on a C++17 torch). The runtime JIT compiler (csrc/hybrid_ep/jit/compiler.cu) can keep -std=c++17, since its JIT-compiled kernels do not include torch headers and it relies on std::any.

Validated experimentally: with the hardcoded flag removed, the extension compiles cleanly and a DeepSeek-V3 MXFP8 expert-parallel (EP=8) training run completes end-to-end with healthy convergence (loss 12.02 decreasing to 6.60 across 50 steps) and no runtime regressions on GB200-class hardware (CUDA arch 10.0/9.0, PyTorch built for C++20).

Environment

  • DeepEP: hybrid-ep branch, commit 17cfb817bccec3a9c247013360cc550c2bac441e
  • PyTorch: current build requiring C++20 (arm64/aarch64)
  • CUDA arch list: 10.0 9.0
  • OS/arch: Linux aarch64

This issue was drafted with assistance from the opus AI model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions