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

69 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -e
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
VENDOR_DIR="${REPO_ROOT}/vendor"
case "${DEEPINFER_ACCELERATOR:-nvidia}" in
nvidia)
BUILD_TARGET=CUDA
NVIDIA_ARCH="$(bash "${REPO_ROOT}/scripts/nvidia_arch.sh")"
if [ "${NVIDIA_ARCH}" = sm120 ]; then
# SM120 selects top-k with FlashInfer (see deepinfer/model_executor/layers/topk.py), so it builds no DeepSelect.
# It builds no DeepEP either: nothing on SM120 uses it, and it needs a newer NCCL than Cake MegaMoE's 2.30.7.
PACKAGES=(DeepGEMM-sm120)
INSTALL=(deep_gemm)
else
PACKAGES=(DeepSelect FlashMLA DeepEP DeepGEMM)
INSTALL=(deep_select flash_mla deep_ep deep_gemm)
fi
;;
ascend)
BUILD_TARGET=ASCEND
PACKAGES=(DeepSelect FlashMLA DeepEP-Ascend DeepGEMM-Ascend)
INSTALL=(deep_select flash_mla deep_ep deep_gemm)
;;
*)
echo "Unsupported DEEPINFER_ACCELERATOR: '${DEEPINFER_ACCELERATOR}' (expect nvidia or ascend)" >&2
exit 1
;;
esac
PLATFORM_TAG="${DEEPINFER_ACCELERATOR:-nvidia}-$(uname -m)"
[ "${NVIDIA_ARCH:-}" = sm120 ] && PLATFORM_TAG="nvidia-sm120-$(uname -m)"
WHEEL_DIR="${WHEEL_DIR:-${REPO_ROOT}/build/${PLATFORM_TAG}/vendor-wheels}"
echo "📥 Initializing submodules ..."
git -C "${REPO_ROOT}" submodule update --init
target_var() {
case "$1" in
DeepSelect) echo DEEP_SELECT_BUILD_TARGET_PLATFORM ;;
FlashMLA) echo FLASH_MLA_BUILD_TARGET_PLATFORM ;;
*) echo "" ;;
esac
}
mkdir -p "${WHEEL_DIR}"
for name in "${INSTALL[@]}"; do
rm -f "${WHEEL_DIR}/${name}-"*.whl
done
for pkg in "${PACKAGES[@]}"; do
echo "🔧 Building ${pkg} (${BUILD_TARGET}) ..."
envs=()
var="$(target_var "${pkg}")"
[ -n "${var}" ] && envs+=("${var}=${BUILD_TARGET}")
case "${pkg}" in
DeepGEMM | DeepGEMM-sm120) envs+=(DG_FORCE_BUILD=1) ;;
esac
(
cd "${VENDOR_DIR}/${pkg}"
git submodule update --init --recursive
env "${envs[@]}" python setup.py bdist_wheel --dist-dir "${WHEEL_DIR}"
)
done
echo "📦 Installing wheels from ${WHEEL_DIR} ..."
python -m pip install --no-deps --no-index --force-reinstall --find-links "${WHEEL_DIR}" "${INSTALL[@]}"
echo "✅ vendor operators installed"