[Build] Move DeepGEMM pin to the vLLM fork and update the Mega MoE call convention (#56876)

Signed-off-by: Yongye Zhu <zyy1102000@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

Yongye Zhu committed Sep 15, 2026 at 00:57 UTC 8263ea12bd8fa7584277f5200d521193259707b7
6 files changed +26 -13
cmake/external_projects/deepgemm.cmake
+10 -6
@@ -28,9 +28,11 @@ if(DEEPGEMM_SRC_DIR)
28 message(STATUS "DeepGEMM using local DEEPGEMM_SRC_DIR: ${deepgemm_SOURCE_DIR}")
29 else()
30 # Keep in sync with tools/install_deepgemm.sh
31 - set(_DEEPGEMM_UPSTREAM_REPO "https://github.com/deepseek-ai/DeepGEMM.git")
32 - # Pinned to the tip of the nv_dev branch (SM120 support).
33 - set(_DEEPGEMM_UPSTREAM_TAG "8b1392b978f5a03c828dd1711090d7fb50958b8a")
31 + set(_DEEPGEMM_UPSTREAM_REPO "https://github.com/vllm-project/DeepGEMM.git")
32 + # Pinned to the tip of the fork's dev branch: upstream 2.8.0 plus the SM120
33 + # port, the SM90 paged-MQA kv_block=32/next_n=4 port, configurable SwiGLU
34 + # alpha/beta, and SiTU for FP8/FP4 Mega MoE.
35 + set(_DEEPGEMM_UPSTREAM_TAG "ad1f1726aa540a76c1d26d6a120effb8de21eaa4")
36
37 set(_deepgemm_fc_root "${FETCHCONTENT_BASE_DIR}")
38 if(NOT _deepgemm_fc_root)
@@ -51,7 +53,7 @@ else()
53 BINARY_DIR "${_deepgemm_bin}"
54 GIT_REPOSITORY "${_DEEPGEMM_UPSTREAM_REPO}"
55 GIT_TAG "${_DEEPGEMM_UPSTREAM_TAG}"
54 - GIT_SUBMODULES "third-party/cutlass" "third-party/fmt"
56 + GIT_SUBMODULES "third-party/cutlass" "third-party/deep_jit"
57 GIT_PROGRESS TRUE
58 )
59 endif()
@@ -119,13 +121,15 @@ if(DEEPGEMM_ARCHS)
121 message(STATUS "DeepGEMM _C will be built for: ${_dg_pythons}")
122
123 # add_custom_command does no implicit header scanning; glob explicitly so
122 - # header-only edits in DeepGEMM/cutlass/fmt re-trigger the rebuild.
124 + # header-only edits in DeepGEMM/cutlass/deep_jit re-trigger the rebuild.
125 file(GLOB_RECURSE _dg_headers
126 "${deepgemm_SOURCE_DIR}/csrc/*.h"
127 "${deepgemm_SOURCE_DIR}/csrc/*.hpp"
128 "${deepgemm_SOURCE_DIR}/deep_gemm/include/*.h"
129 "${deepgemm_SOURCE_DIR}/deep_gemm/include/*.hpp"
128 - "${deepgemm_SOURCE_DIR}/deep_gemm/include/*.cuh")
130 + "${deepgemm_SOURCE_DIR}/deep_gemm/include/*.cuh"
131 + "${deepgemm_SOURCE_DIR}/third-party/deep_jit/include/*.h"
132 + "${deepgemm_SOURCE_DIR}/third-party/deep_jit/include/*.hpp")
133
134 set(_dg_markers)
135 set(_dg_seen_soabis)
docker/Dockerfile
+1
@@ -131,6 +131,7 @@ RUN dnf install -y --setopt=install_weak_deps=False \
131 git \
132 curl \
133 sudo \
134 + elfutils-devel \
135 rdma-core-devel \
136 && dnf clean all \
137 && rm -rf /var/cache/dnf
tools/build_deepgemm_C.py
+1 -1
@@ -50,7 +50,7 @@ includes = [
50 str(src / "deep_gemm/include"),
51 str(src / "third-party/cutlass/include"),
52 str(src / "third-party/cutlass/tools/util/include"),
53 - str(src / "third-party/fmt/include"),
53 + str(src / "third-party/deep_jit/include"),
54 *cpp_extension.include_paths(device_type="cuda"),
55 ]
56
tools/install_deepgemm.sh
+5 -3
@@ -6,9 +6,11 @@ set -e
6
7 # Default values
8 # Keep DEEPGEMM_GIT_REF in sync with cmake/external_projects/deepgemm.cmake
9 -DEEPGEMM_GIT_REPO="https://github.com/deepseek-ai/DeepGEMM.git"
10 -# NOTE: This is currently targeting the nv_dev branch tip due to sm120 support
11 -DEEPGEMM_GIT_REF="8b1392b978f5a03c828dd1711090d7fb50958b8a"
9 +DEEPGEMM_GIT_REPO="https://github.com/vllm-project/DeepGEMM.git"
10 +# NOTE: This targets the vLLM fork's dev branch tip, which carries the sm120
11 +# and sm90 paged-MQA ports plus the SwiGLU alpha/beta and SiTU Mega MoE
12 +# activations
13 +DEEPGEMM_GIT_REF="ad1f1726aa540a76c1d26d6a120effb8de21eaa4"
14 WHEEL_DIR=""
15
16 # Parse command line arguments
vllm/models/kimi_k3/nvidia/model.py
+4 -2
@@ -532,8 +532,10 @@ class KimiK3MegaMoEExperts(DeepseekV4MegaMoEExperts):
532 symm_buffer,
533 activation_clamp=activation_clamp,
534 activation=self.activation,
535 - situ_beta=self.activation_beta,
536 - situ_linear_beta=self.activation_linear_beta,
535 + # DeepGEMM names the SiTU gate tanh scale `activation_alpha` and the
536 + # linear/up tanh scale `activation_beta`; beta=0 leaves up untouched.
537 + activation_alpha=self.activation_beta or 1.0,
538 + activation_beta=self.activation_linear_beta or 0.0,
539 fast_math=fast_math,
540 )
541 return y
vllm/utils/deep_gemm.py
+5 -1
@@ -280,7 +280,11 @@ def _lazy_init() -> None:
280 _fp8_gemm_nt_impl = getattr(_dg, "fp8_gemm_nt", None)
281 _fp8_einsum_impl = getattr(_dg, "fp8_einsum", None)
282 _grouped_impl = getattr(_dg, "m_grouped_fp8_gemm_nt_contiguous", None)
283 - _grouped_masked_impl = getattr(_dg, "fp8_m_grouped_gemm_nt_masked", None)
283 + # DeepGEMM 2.8.0 dropped the legacy `fp8_*` aliases; keep both spellings so
284 + # an externally pinned older DeepGEMM still resolves.
285 + _grouped_masked_impl = getattr(
286 + _dg, "m_grouped_fp8_gemm_nt_masked", None
287 + ) or getattr(_dg, "fp8_m_grouped_gemm_nt_masked", None)
288 _grouped_fp4_impl = getattr(_dg, "m_grouped_fp8_fp4_gemm_nt_contiguous", None)
289 # DeepGEMM exposes fp8_fp4_*_mqa_logits as the canonical symbols that
290 # handle both the FP8 and FP4 Q/K paths via a tuple-typed `q`.