Repository navigation
Add Kimi K3 B300 EFA AgentX sweep / 新增 Kimi K3 B300 EFA AgentX 扫描 #4304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7cd89a6
be199fc
17add7f
a9b8f30
6a35874
e3c8ef5
6f13a99
064a205
bde7f84
9715529
03586db
e26a25b
2e66bdb
ee970fb
97530fb
ca54dea
a29d4c5
519cdf7
915861e
06580d6
465d9aa
bfbb5a9
31af465
aa0d514
8ba89f7
1e23f43
34fceb1
8110949
2d5a18c
c8e53e2
7a33f2e
76b08ca
35a1981
02bfe77
e421cb1
075e50a
4412e54
66b0ad1
5a386a6
25daed5
b14e1ee
e41c768
b935282
aa27cd1
504eb5e
b40249a
00990ea
eb928ae
658c124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| diff --git a/vllm/envs.py b/vllm/envs.py | ||
| --- a/vllm/envs.py | ||
| +++ b/vllm/envs.py | ||
| @@ -1659,3 +1659,7 @@ | ||
| + # The fused Kimi K3 latent MoE tail requires NVLink multicast. | ||
| + "VLLM_ENABLE_K3_LATENT_MOE_TAIL_FUSION": lambda: bool( | ||
| + int(os.getenv("VLLM_ENABLE_K3_LATENT_MOE_TAIL_FUSION", "1")) | ||
| + ), | ||
| # Use the SM100 BF16 GEMM-AR kernel for eligible Kimi-K3 row-parallel | ||
| # attention projections. All TP ranks must belong to one NVLink domain. | ||
| "VLLM_KIMI_K3_GEMM_AR": lambda: bool(int(os.getenv("VLLM_KIMI_K3_GEMM_AR", "1"))), | ||
| diff --git a/vllm/models/kimi_k3/nvidia/latent_moe_runner.py b/vllm/models/kimi_k3/nvidia/latent_moe_runner.py | ||
| --- a/vllm/models/kimi_k3/nvidia/latent_moe_runner.py | ||
| +++ b/vllm/models/kimi_k3/nvidia/latent_moe_runner.py | ||
| @@ -75,4 +75,5 @@ | ||
| self.enable_k3_latent_moe_tail_fusion = ( | ||
| - current_platform.is_cuda() | ||
| + envs.VLLM_ENABLE_K3_LATENT_MOE_TAIL_FUSION | ||
| + and current_platform.is_cuda() | ||
| and current_platform.is_device_capability_family(100) | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| source /infmax-workspace/benchmarks/check_env.sh | ||
| check_env_vars KIMI_EFA_BUILD_CACHE LD_LIBRARY_PATH | ||
|
|
||
| export DEBIAN_FRONTEND=noninteractive | ||
| # The NVIDIA CUDA apt mirror is intermittently mid-sync (index size mismatch); | ||
| # retry instead of failing the whole worker setup. | ||
| for attempt in 1 2 3 4 5; do | ||
| apt-get update -qq && break | ||
| [ "$attempt" = 5 ] && exit 1 | ||
| sleep $((attempt * 15)) | ||
| done | ||
| apt-get install -y -qq --no-install-recommends \ | ||
| autoconf automake build-essential ca-certificates curl git libboost-filesystem-dev \ | ||
| libboost-system-dev libcurl4-openssl-dev libgflags-dev libgoogle-glog-dev \ | ||
| libhwloc15 libibverbs-dev libjsoncpp-dev libmsgpack-dev libnuma-dev libprotobuf-dev libssl-dev \ | ||
| libtool libxxhash-dev libyaml-cpp-dev libzstd-dev numactl patchelf pkg-config \ | ||
| protobuf-compiler python-is-python3 cuda-nvml-dev-13-0 | ||
|
|
||
| vllm_site_packages=$(python3 -c 'import importlib.util; from pathlib import Path; print(Path(importlib.util.find_spec("vllm").origin).parent.parent)') | ||
| tail_patch="$(dirname "${BASH_SOURCE[0]}")/kimi-k3-latent-tail-opt-out.patch" | ||
| if ! git -C "$vllm_site_packages" apply --reverse --check "$tail_patch" 2>/dev/null; then | ||
| git -C "$vllm_site_packages" apply "$tail_patch" | ||
| fi | ||
|
|
||
| task_dir=$(mktemp -d /tmp/kimi-k3-efa.XXXXXX) | ||
| curl -fsSL --retry 3 --retry-all-errors \ | ||
| https://efa-installer.amazonaws.com/aws-efa-installer-1.50.0.tar.gz \ | ||
| -o "$task_dir/efa.tar.gz" | ||
| printf '%s %s\n' \ | ||
| fa6dff8593d866866c13cb4640d9059835cd4efa427971f100ab40c97bef2841 \ | ||
| "$task_dir/efa.tar.gz" | sha256sum -c - | ||
| tar -xzf "$task_dir/efa.tar.gz" -C "$task_dir" | ||
| ( | ||
| cd "$task_dir/aws-efa-installer" | ||
| ./efa_installer.sh -y --skip-kmod --skip-limit-conf --no-verify --skip-mpi | ||
| ) | ||
|
|
||
| cache="$KIMI_EFA_BUILD_CACHE/c3fa13ec-e83bf01a-collapse-hs-lb-v1" | ||
| mkdir -p "$cache" | ||
| exec 9>"$cache/build.lock" | ||
| flock 9 | ||
| if [ ! -f "$cache/ready" ]; then | ||
| git clone https://github.com/aws/libfabric.git "$task_dir/libfabric" | ||
| git -C "$task_dir/libfabric" checkout --detach e83bf01a834a1a7c776d93efcaee3f8f28ff2705 | ||
| git -C "$task_dir/libfabric" apply \ | ||
| "$(dirname "${BASH_SOURCE[0]}")/libfabric-efa-vmm.patch" | ||
| ( | ||
| cd "$task_dir/libfabric" | ||
| export PKG_CONFIG_PATH=/opt/amazon/efa/lib/pkgconfig | ||
| export CPPFLAGS=-I/opt/amazon/efa/include | ||
| export LDFLAGS=-L/opt/amazon/efa/lib | ||
| ./autogen.sh | ||
| ./configure --prefix=/opt/amazon/efa --with-cuda=/usr/local/cuda \ | ||
| --enable-cuda-dlopen --enable-efa=yes --disable-static | ||
| make -j12 | ||
| make DESTDIR="$task_dir/fabric-install" install | ||
| ) | ||
| tar -czf "$cache/libfabric.tar.gz" -C "$task_dir/fabric-install" opt/amazon/efa | ||
| tar -xzf "$cache/libfabric.tar.gz" -C / | ||
| ldconfig | ||
|
|
||
| python3 -m pip install --no-cache-dir \ | ||
| 'cmake==4.4.4' 'build==1.6.1' 'auditwheel==6.8.2' \ | ||
| 'wheel==0.48.0' 'setuptools==84.0.0' numpy 'pybind11==3.1.0' | ||
| git clone https://github.com/kvcache-ai/Mooncake.git "$task_dir/Mooncake" | ||
| git -C "$task_dir/Mooncake" checkout --detach c3fa13ecaf1038df933dcb784ff8ffe026381100 | ||
| git -C "$task_dir/Mooncake" apply \ | ||
| "$(dirname "${BASH_SOURCE[0]}")/mooncake-efa-collapse-host-chunks.patch" | ||
| # Upstream #4704: do not hold the endpoint lock across the handshake RPC; | ||
| # bilateral active setup deadlocks both peers otherwise. | ||
| git -C "$task_dir/Mooncake" apply \ | ||
| "$(dirname "${BASH_SOURCE[0]}")/mooncake-efa-handshake-lock.patch" | ||
| # Loopback copies on a private non-blocking stream instead of a synchronous | ||
| # legacy-stream cudaMemcpy that can deadlock against concurrent collectives. | ||
| git -C "$task_dir/Mooncake" apply \ | ||
| "$(dirname "${BASH_SOURCE[0]}")/mooncake-efa-loopback-stream.patch" | ||
| git -C "$task_dir/Mooncake" submodule update --init --recursive | ||
| ( | ||
| cd "$task_dir/Mooncake" | ||
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON '-DCMAKE_INSTALL_RPATH=$ORIGIN' \ | ||
| -DCMAKE_PREFIX_PATH=/opt/amazon/efa \ | ||
| -DPython3_EXECUTABLE="$(command -v python3)" \ | ||
| -DUSE_EFA=ON -DUSE_CUDA=ON -DUSE_ETCD=OFF \ | ||
| -DWITH_STORE_RUST=OFF -DWITH_EP=OFF -DBUILD_UNIT_TESTS=OFF \ | ||
| -DBUILD_BENCHMARK=OFF -DBUILD_EXAMPLES=ON | ||
| cmake --build build --parallel 12 --target \ | ||
| engine store mooncake_master mooncake_client transfer_engine_bench build_nvlink_allocator | ||
| sed -i 's/^version = .*/version = "0.3.13.post1+gc3fa13ec.collapse1.hs1.lb1"/' \ | ||
| mooncake-wheel/pyproject.toml | ||
| mkdir -p "$task_dir/wheels" | ||
| EFA_CU13_BUILD=1 OUTPUT_DIR="$task_dir/wheels" bash scripts/build_wheel.sh | ||
| ) | ||
| cp "$task_dir/wheels/"*.whl "$cache/" | ||
| touch "$cache/ready" | ||
| fi | ||
| tar -xzf "$cache/libfabric.tar.gz" -C / | ||
| ldconfig | ||
|
|
||
| python3 -m pip uninstall -y \ | ||
| mooncake-transfer-engine mooncake-transfer-engine-cuda13 mooncake-transfer-engine-efa-cuda13 | ||
| python3 -m pip install --no-deps "$cache/"*.whl | ||
| flock -u 9 | ||
|
|
||
| # Dynamo's source install pulls aiconfigurator-core, a placeholder sdist that | ||
| # downloads its real wheel from pypi.nvidia.com at install time and fails | ||
| # intermittently on these nodes. Install the same wheel first, verified against | ||
| # its published SHA256, so the Dynamo install finds the requirement satisfied. | ||
| aic_wheel=aiconfigurator_core-0.11.0.dev20260728-cp310-abi3-manylinux_2_28_x86_64.whl | ||
| aic_sha256=cfd724c6cce142ffc3df150785614245b8a9e0fb70cacb071b4ab58f01bd19c7 | ||
| aic_dir="$KIMI_EFA_BUILD_CACHE/wheels" | ||
| mkdir -p "$aic_dir" | ||
| for attempt in 1 2 3 4 5; do | ||
| if printf '%s %s\n' "$aic_sha256" "$aic_dir/$aic_wheel" | sha256sum -c --status - 2>/dev/null; then | ||
| break | ||
| fi | ||
| curl -fsSL --retry 3 --retry-all-errors \ | ||
| "https://pypi.nvidia.com/aiconfigurator-core/$aic_wheel" -o "$task_dir/$aic_wheel" || true | ||
| if printf '%s %s\n' "$aic_sha256" "$task_dir/$aic_wheel" | sha256sum -c --status -; then | ||
| mv -f "$task_dir/$aic_wheel" "$aic_dir/$aic_wheel.tmp.$$" | ||
| mv -f "$aic_dir/$aic_wheel.tmp.$$" "$aic_dir/$aic_wheel" | ||
| else | ||
| echo "aiconfigurator-core wheel failed SHA256 check (attempt $attempt)" >&2 | ||
|
Comment on lines
+121
to
+126
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Every B300 Kimi K3 job now runs native code from a cache that other cluster users may be able to swap out. Nothing checks that code before it runs. Lines 100-105 untar Why this was flaggedThe condition is that another account on the cluster can traverse the runner's home. runners.yaml:579-580 adds Verification: It triggers when another account on the b300-dsxe cluster can traverse the runner's home down to |
||
| sleep $((attempt * 10)) | ||
| fi | ||
| done | ||
| printf '%s %s\n' "$aic_sha256" "$aic_dir/$aic_wheel" | sha256sum -c - | ||
| python3 -m pip install --no-deps "$aic_dir/$aic_wheel" | ||
|
Comment on lines
+112
to
+131
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 (optional) Aggregate B300 Kimi K3 jobs can now fail at setup because of an aiconfigurator-core download they never use. That recipe sets Why this was flaggedagg-megakernel-variants.yaml sets Verification: nit. Trigger: an agg job runs while the shared wheel cache has no valid aiconfigurator-core wheel, and pypi.nvidia.com fails on all five attempts. agg-megakernel-variants.yaml:9-10 sets |
||
|
|
||
| /opt/amazon/efa/bin/fi_info --version | ||
| /opt/amazon/efa/bin/fi_info -p efa -t FI_EP_RDM | ||
| python3 - <<'PY' | ||
| import ctypes | ||
| import importlib.metadata | ||
| from mooncake.store import MooncakeDistributedStore | ||
|
|
||
| fabric = ctypes.CDLL("libfabric.so.1") | ||
| fabric.fi_version.restype = ctypes.c_uint32 | ||
| assert fabric.fi_version() == (2 << 16 | 6) | ||
| assert importlib.metadata.version("mooncake-transfer-engine-efa-cuda13") == "0.3.13.post1+gc3fa13ec.collapse1.hs1.lb1" | ||
| print("EFA libfabric 2.6 and THP-enabled Mooncake Store are available") | ||
| PY | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 (optional) Maintainers who bump the master config's Mooncake version get results labelled with the new version while the old wheel still runs. The script never reads the caller's version.
kimik3-b300-efa-setup.shis missing fromINSTALLERS(infx/srt_slurm/workload.py:80), soKV_OFFLOAD_BACKEND_VERSIONis never bound. The script hard-codes0.3.13.post1+gc3fa13ecat lines 70 and 94. Fix: register the script inINSTALLERSas ("kv-offload-backend", "mooncake"), requireKV_OFFLOAD_BACKEND_VERSIONvia check_env_vars, and use it for the wheel version, the cache key and the final assert.Why this was flagged
Both new master entries in nvidia-master.yaml declare
kv-offload-backend: {name: mooncake, version: 0.3.13.post1+gc3fa13ec}._bind_components(infx/srt_slurm/workload.py:256-263) checks and binds that version only for scripts listed inINSTALLERS(workload.py:80-86). That list hasvllm-mooncake.shandkimik3-b300-mooncake.shbut not the new script. The new script does its ownsedtoversion = "0.3.13.post1+gc3fa13ec"(line 70), pins checkoutc3fa13ec...(line 57) and asserts the same literal (line 94). So the master version is only a label. If it changes, nothing installs the new version and nothing fails, so results are recorded under a backend version that did not run. The existingvllm-mooncake.shtakes its version from the caller throughcheck_env_vars KV_OFFLOAD_BACKEND_VERSION. AGENTS.md says configuration must flow from the caller, and this script breaks that rule.Verification: nit. Trigger: someone changes the disagg master entry's
kv-offload-backend.versionwithout also editing the script.INSTALLERS(infx/srt_slurm/workload.py:80-86) omitskimik3-b300-efa-setup.sh, soKV_OFFLOAD_BACKEND_VERSIONis never bound. The script hard-codes the version in its sed (line 70) and final assert (line 94), so the old c3fa13ec wheel still runs and nothing would fail.