Files
shunyadandClaude Opus 5.5 aad1fc611a build(sm120): one NCCL (2.30.7) and no DeepEP on SM120
The SM120 build installed NCCL 2.32.3, built DeepEP against it, then
replaced it with the 2.30.7 Cake MegaMoE needs, leaving a DeepEP compiled
for a newer NCCL than the process loads. Nothing on SM120 uses DeepEP any
more (no deepep backend, and deep_ep is imported only where it is used), so:

- build_vendor.sh builds only DeepGEMM (nv_dev) on SM120.
- build.sh installs NCCL 2.30.7 once, before building, on SM120, and 2.32.3
  (for DeepEP) on the other NVIDIA families, as before.
- scripts/check_sm120_nccl.py keeps only the warning when torch loads
  another NCCL than the pin; there is no deep_ep to check.
- tests/test_build_nccl_pin.py checks that the SM120 vendor build has no
  DeepEP and covers the simplified check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 23:44:10 -08:00

64 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
case "${DEEPINFER_ACCELERATOR:-}" in
nvidia|ascend) ;;
*)
echo "Usage: DEEPINFER_ACCELERATOR=nvidia|ascend $0" >&2
exit 1
;;
esac
REQUIREMENTS="requirements-${DEEPINFER_ACCELERATOR}.txt"
SM120=0
if [ "${DEEPINFER_ACCELERATOR}" = nvidia ]; then
# A separate assignment so that a detection failure stops the build (set -e) before any pip install;
# exported so build_vendor.sh builds for the same family.
NVIDIA_ARCH="$(bash ./scripts/nvidia_arch.sh)"
export DEEPINFER_NVIDIA_ARCH="${NVIDIA_ARCH}"
fi
if [ "${NVIDIA_ARCH:-}" = sm120 ]; then
REQUIREMENTS=requirements-nvidia-sm120.txt
SM120=1
# FlashInfer is built from source: skip its optional EP backends and its build-time pip installs.
export BUILD_NVEP=0 FLASHINFER_BUILD_NO_PIP=1
fi
# Install other Python dependencies
pip install -r "${REQUIREMENTS}"
if [ "${SM120}" = 1 ]; then
# The pinned FlashInfer commit reports the same version as a release, so pip keeps an installed
# build of another commit; reinstall unless the pinned commit is already installed.
FLASHINFER_REQUIREMENT="$(grep -E '^flashinfer-python' "${REQUIREMENTS}")"
if [ "$(python -c 'import flashinfer; print(flashinfer.__git_commit__)' 2>/dev/null)" != "${FLASHINFER_REQUIREMENT##*@}" ]; then
pip install --no-deps --force-reinstall "${FLASHINFER_REQUIREMENT}"
fi
fi
if [ "${SM120}" = 1 ]; then
# One NCCL for the whole SM120 build and runtime: FlashInfer's Cake MegaMoE (DEEPINFER_SM120_EP_BACKEND=cake, which
# the default auto picks with this NCCL) compiles NCCL's Device API into its kernel and requires exactly this NCCL in
# the process (2.32.3 spills its registers). DeepEP, which needs 2.31 or newer, is not built on SM120.
# Keep it equal to deepinfer/sm120_support.py CAKE_NCCL_VERSION (tests/test_build_nccl_pin.py checks).
CAKE_NCCL_VERSION=2.30.7
pip install --no-deps --force-reinstall "nvidia-nccl-cu13==${CAKE_NCCL_VERSION}"
elif [ "${DEEPINFER_ACCELERATOR}" = nvidia ]; then
# DeepEP needs NCCL 2.31 or newer
pip install --no-deps --force-reinstall nvidia-nccl-cu13==2.32.3
fi
# Build and install vendored dependencies
bash ./scripts/build_vendor.sh
if [ "${SM120}" = 1 ]; then
# Warns if torch loads another NCCL than the pin (DEEPINFER_SM120_EP_BACKEND=auto would then pick nccl)
python scripts/check_sm120_nccl.py "${CAKE_NCCL_VERSION}"
fi
# Build DeepInfer
bash ./scripts/build.sh build
echo "✅ DeepInfer is successfully built"