diff --git a/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/kimik3-b300-mooncake.sh b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/kimik3-b300-mooncake.sh index ae385b269d..74996278e2 100755 --- a/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/kimik3-b300-mooncake.sh +++ b/inferencex-e2e/benchmarks/multi_node/srt-slurm-recipes/configs/kimik3-b300-mooncake.sh @@ -1,30 +1,69 @@ #!/usr/bin/env bash -# Install the worker's Mooncake client and point its store at one active RDMA rail. set -eo pipefail -bash "$(dirname "${BASH_SOURCE[0]}")/vllm-mooncake.sh" # Rail-isolated nodes: two RNICs cannot reach each other even within a node, so -# every rank uses one rail. mlx5_0 is down on some nodes, and topology discovery -# then finds no HCA, so take the first active rail at runtime. DSXE nodes name -# their rails rdmap*. -rail="" -for device in mlx5_0 mlx5_1 mlx5_2 mlx5_3 mlx5_4 mlx5_5 mlx5_8 mlx5_9 \ - mlx5_10 mlx5_11 mlx5_16 mlx5_17 mlx5_20 mlx5_21 mlx5_22 mlx5_23 \ - $(ls /sys/class/infiniband 2>/dev/null | grep '^rdmap' | sort -V); do - if grep -q ACTIVE "/sys/class/infiniband/$device/ports/1/state" 2>/dev/null; then - rail="$device" - break - fi -done -if [[ -z "$rail" ]]; then - echo "Error: no active RDMA rail on $(hostname); Mooncake cannot initialise" >&2 - for state in /sys/class/infiniband/*/ports/*/state; do - echo "$state: $(cat "$state" 2>&1)" >&2 +# every rank uses one rail, the first ACTIVE InfiniBand port that mlx5_core drives. +# DSXE names its ConnectX-7 ports ibp*, and its EFA rdmap* devices have no RC queue +# pairs for Mooncake's rdma transport (segment registration fails with ENOMEM). +select_mooncake_rdma_device() { + local device + MOONCAKE_RAIL="" + for device in "$1"/*; do + [[ "$(readlink "$device/device/driver" 2>/dev/null)" == */mlx5_core ]] || continue + [[ "$(cat "$device/ports/1/state" 2>/dev/null)" == "4: ACTIVE" ]] || continue + [[ "$(cat "$device/ports/1/link_layer" 2>/dev/null)" == InfiniBand ]] || continue + MOONCAKE_RAIL="${device##*/}" + return 0 + done + echo "Error: no ACTIVE InfiniBand mlx5_core port under $1; Mooncake cannot initialise" >&2 + for device in "$1"/*; do + echo " ${device##*/}: driver=$(readlink "$device/device/driver" 2>&1)" \ + "state=$(cat "$device/ports/1/state" 2>&1)" \ + "link_layer=$(cat "$device/ports/1/link_layer" 2>&1)" >&2 done + return 1 +} + +# libibverbs loads "$RDMAV_DRIVERS-rdmav.so". rdma-core installs that file as a +# relative link to ../libmlx5.so.1.*, so it resolves only when the provider's parent +# directory is mounted too; -f follows the link. +check_mooncake_verbs_provider() { + local providers=("$RDMAV_DRIVERS"-rdmav*.so) + if [[ ! -f "${providers[0]}" ]]; then + echo "Error: no verbs provider resolves for $RDMAV_DRIVERS-rdmav*.so" \ + "(${providers[0]} -> $(readlink "${providers[0]}"))" >&2 + return 1 + fi + MOONCAKE_VERBS_PROVIDER="${providers[0]} -> $(readlink -f "${providers[0]}")" +} + +# The image bundles Mooncake; it must be the master config's version, and it is never replaced. +check_bundled_mooncake() { + local installed + installed="$(python3 -c "from importlib.metadata import version; print(version('mooncake-transfer-engine-cuda13'))")" + if [[ "$installed" != "$KV_OFFLOAD_BACKEND_VERSION" ]]; then + echo "Error: the image bundles mooncake-transfer-engine-cuda13 $installed, but the master config" \ + "declares kv-offload-backend version $KV_OFFLOAD_BACKEND_VERSION" >&2 + return 1 + fi + python3 -c "from mooncake.store import MooncakeDistributedStore" >/dev/null +} + +# Sourcing only defines the functions. +[[ "${BASH_SOURCE[0]}" == "$0" ]] || return 0 + +source /infmax-workspace/benchmarks/check_env.sh +check_env_vars KV_OFFLOAD_BACKEND_VERSION MOONCAKE_CONFIG_PATH MC_GID_INDEX RDMAV_DRIVERS +# An InfiniBand port addresses peers by GID index 0. +if [[ "$MC_GID_INDEX" != 0 ]]; then + echo "Error: MC_GID_INDEX=$MC_GID_INDEX; the InfiniBand Mooncake rail needs GID index 0" >&2 exit 1 fi -config="${MOONCAKE_CONFIG_PATH:-/logs/mooncake_store_config.json}" -python3 - "$config" "$rail" <<'PY' +check_mooncake_verbs_provider +select_mooncake_rdma_device /sys/class/infiniband +check_bundled_mooncake + +python3 - "$MOONCAKE_CONFIG_PATH" "$MOONCAKE_RAIL" <<'PY' import json, sys path, rail = sys.argv[1:] with open(path) as handle: @@ -33,4 +72,6 @@ config["device_name"] = rail with open(path, "w") as handle: json.dump(config, handle, indent=2) PY -echo "Mooncake rail: $rail" +echo "Mooncake rail: $MOONCAKE_RAIL (InfiniBand, MC_GID_INDEX=$MC_GID_INDEX);" \ + "host verbs provider $MOONCAKE_VERBS_PROVIDER; image mlx5 provider" \ + /usr/lib/x86_64-linux-gnu/libibverbs/libmlx5-rdmav*.so diff --git a/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3/vllm/b300-fp4-mtp/agentic.yaml b/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3/vllm/b300-fp4-mtp/agentic.yaml index 95c66e148f..a4ecde1f23 100644 --- a/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3/vllm/b300-fp4-mtp/agentic.yaml +++ b/inferencex-e2e/benchmarks/single_node/srt-slurm-recipes/kimik3/vllm/b300-fp4-mtp/agentic.yaml @@ -18,21 +18,31 @@ base: health_check: interval_seconds: 10 max_attempts: 360 - # Embedded Mooncake: each TP rank contributes TOTAL_CPU_DRAM_GB / 8 GB. The - # setup script installs the master config's Mooncake and fills in the node's - # active RDMA rail. DSXE rails are InfiniBand without a netdev, so the transfer - # engine picks its own GID (a RoCE v2 index 3 does not exist). + # Embedded Mooncake ("GB" is GiB): 8 TP ranks x (256 GiB segment + 4 GiB buffer) + # = 2233.4 GB stay within TOTAL_CPU_DRAM_GB (2249 GB). + # The setup script checks that the image's bundled Mooncake is the master config's, then + # writes the node's first ACTIVE InfiniBand port that mlx5_core drives (ibp* on DSXE, never + # EFA) into the store config, failing the worker when there is none. setup_script: kimik3-b300-mooncake.sh + # The whole host library directory, for RDMAV_DRIVERS: the host's + # libibverbs/libmlx5-rdmav.so is a relative link to ../libmlx5.so.1.*. + extra_mount: + - /usr/lib/x86_64-linux-gnu:/host-usr-lib:ro services: - name: mooncake-master type: mooncake-master - preamble: bash /configs/vllm-mooncake.sh + # The first container import on a node plus the in-container check outlast + # the default 120 s readiness window. + readiness: + port: 8700 + timeout_seconds: 900 + preamble: python3 -c "from mooncake.store import MooncakeDistributedStore" args: ["--eviction_high_watermark_ratio=0.95", "--eviction_ratio=0.10"] options: store_config: mode: embedded metadata_server: P2PHANDSHAKE - global_segment_size: 281GB + global_segment_size: 256GB local_buffer_size: 4GB protocol: rdma device_name: "" @@ -55,11 +65,14 @@ base: reasoning-parser: kimi_k3 load-format: fastsafetensors moe-backend: auto - no-enable-flashinfer-autotune: true + enable-flashinfer-autotune: true enable-cumem-allocator: true enable-prefix-caching: true prefix-match-unit: 128 kv-cache-dtype: fp8 + # KDA recurrent state only (the DSpark draft is dense MLA). Leave the conv state at + # SD: FlashInfer's packed KDA spec decode rejects VLLM_SSM_CONV_STATE_LAYOUT=DS on SM10x. + mamba-ssm-cache-dtype: bfloat16 stream-interval: 10 attention-backend: TOKENSPEED_MLA attention-config: '{"mla_prefill_backend":"TRTLLM_RAGGED","use_prefill_query_quantization":true}' @@ -74,6 +87,8 @@ base: VLLM_USE_DIRECT_DCP_Q_GATHER: '1' VLLM_USE_DIRECT_DCP_KV_GATHER: '1' VLLM_RPC_TIMEOUT: '600000' + # Mooncake loads can block inside execute_model past the 300 s default. + VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS: '1800' VLLM_PREFIX_CACHE_RETENTION_INTERVAL: '0' VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS: '0' PYTHONNOUSERSITE: '1' @@ -86,6 +101,10 @@ base: MC_ENABLE_DEST_DEVICE_AFFINITY: '1' MC_SLICE_SIZE: '1048576' MC_WORKERS_PER_CTX: '4' + # The setup script selects only InfiniBand rails, which use GID index 0. + MC_GID_INDEX: '0' + # libibverbs appends -rdmav.so; on an ABI mismatch it falls back to the image's provider. + RDMAV_DRIVERS: /host-usr-lib/libibverbs/libmlx5 WITH_NVIDIA_PEERMEM: '0' VLLM_MOONCAKE_LOAD_RECV_THREADS: '4' benchmark: @@ -95,11 +114,10 @@ base: KV_OFFLOADING: dram TOTAL_CPU_DRAM_GB: '2249' -# One variant per point. Admission is 2x CONC; CONC 56 and 70 keep more memory -# headroom. Graphs capture (1 + drafts) x 1..min(2x CONC, 128) tokens, then the -# larger powers of two to 8192. Throughput runs switch DSpark to synthetic -# rejection at the golden acceptance length; points above CONC 16 do not draft -# and keep the matrix's mtp label. +# One variant per point. Admission is 2x CONC. Graphs capture (1 + drafts) x +# 1..2x CONC tokens (to 96 at CONC 4, to 252 at CONC 28), then the larger powers +# of two to 8192. Throughput runs switch DSpark to synthetic rejection at the +# golden acceptance length. override_c1: roles: agg: @@ -112,26 +130,14 @@ override_c1: env: CONC: '1' -override_c2: - roles: - agg: - args: - max-num-seqs: 4 - gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[8,16,24,32,64,128,256,512,1024,2048,4096,8192]}' - speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":7,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' - benchmark: - env: - CONC: '2' - override_c4: roles: agg: args: max-num-seqs: 8 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[8,16,24,32,40,48,56,64,128,256,512,1024,2048,4096,8192]}' - speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":7,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,128,256,512,1024,2048,4096,8192]}' + speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":5,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: CONC: '4' @@ -142,92 +148,68 @@ override_c8: args: max-num-seqs: 16 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,256,512,1024,2048,4096,8192]}' - speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":7,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,128,256,512,1024,2048,4096,8192]}' + speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":5,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: CONC: '8' -override_c16: +override_c12: roles: agg: args: - max-num-seqs: 32 + max-num-seqs: 24 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,256,512,1024,2048,4096,8192]}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,128,256,512,1024,2048,4096,8192]}' speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":3,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: - CONC: '16' + CONC: '12' -override_c24: +override_c14: roles: agg: args: - max-num-seqs: 48 + max-num-seqs: 28 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,64,128,256,512,1024,2048,4096,8192]}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,128,256,512,1024,2048,4096,8192]}' + speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":3,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: - CONC: '24' - SPEC_DECODING: mtp + CONC: '14' -override_c32: +override_c16: roles: agg: args: - max-num-seqs: 64 + max-num-seqs: 32 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,128,256,512,1024,2048,4096,8192]}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,256,512,1024,2048,4096,8192]}' + speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":3,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: - CONC: '32' - SPEC_DECODING: mtp + CONC: '16' -override_c40: +override_c24: roles: agg: args: - max-num-seqs: 80 + max-num-seqs: 48 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,128,256,512,1024,2048,4096,8192]}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,512,1024,2048,4096,8192]}' + speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":3,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: - CONC: '40' - SPEC_DECODING: mtp + CONC: '24' -override_c48: +override_c28: roles: agg: args: - max-num-seqs: 96 + max-num-seqs: 56 gpu-memory-utilization: 0.92 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,128,256,512,1024,2048,4096,8192]}' - benchmark: - env: - CONC: '48' - SPEC_DECODING: mtp - -override_c56: - roles: - agg: - args: - max-num-seqs: 112 - gpu-memory-utilization: 0.9 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,128,256,512,1024,2048,4096,8192]}' - benchmark: - env: - CONC: '56' - SPEC_DECODING: mtp - -override_c70: - roles: - agg: - args: - max-num-seqs: 140 - gpu-memory-utilization: 0.9 - compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,256,512,1024,2048,4096,8192]}' + compilation-config: '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,512,1024,2048,4096,8192]}' + speculative-config: '{"method":"dspark","model":"Inferact/Kimi-K3-DSpark","num_speculative_tokens":3,"attention_backend":"TOKENSPEED_MLA","draft_sample_method":"probabilistic","rejection_sample_method":"block"}' benchmark: env: - CONC: '70' - SPEC_DECODING: mtp + CONC: '28' diff --git a/inferencex-e2e/configs/nvidia-master.yaml b/inferencex-e2e/configs/nvidia-master.yaml index 59d56510e8..51e64942b8 100644 --- a/inferencex-e2e/configs/nvidia-master.yaml +++ b/inferencex-e2e/configs/nvidia-master.yaml @@ -1200,14 +1200,15 @@ dsr1-fp8-b300-sglang-mtp: kimik3-fp4-b300-vllm-agentic-dspark: # TP8 x DCP8 with Mooncake as the external KV tier. The recipe drafts with - # DSpark level 7 at conc <= 8 and stops above it; synthetic acceptance is - # pinned to the committed golden AL 3.84 (infx/golden_al_distribution/ + # DSpark level 7 at conc 1, level 5 at conc 4-8 and level 3 at conc 12-40; + # synthetic acceptance is pinned to the committed golden + # AL for each level (3.84, 3.62, 3.00; infx/golden_al_distribution/ # kimik3_dspark_probabilistic_sample_method_block_rejection_sample_method.yaml), # and EVAL_ONLY switches to real block verification. # - # Kimi-K3 runtime from vllm-project/vllm @ 3696c772aae308f2420a8f307b0971e6986c4818. - # This replaces the unavailable 5894fdf build; new results use a new runtime baseline. - image: vllm/vllm-openai:nightly-dev-x86_64-cu13-3696c77 + # vllm/vllm-openai:nightly-49cb2bbf71cfd36ee5aa33d1e184b1cddff55294 (vllm-project/vllm + # @ 49cb2bbf), pinned to its linux/amd64 manifest digest. + image: vllm/vllm-openai@sha256:8c1434bfee7d7626eef78ef70600434ffba4a1b8813cb1d1c8707ad25f47035e model: moonshotai/Kimi-K3 model-prefix: kimik3 runner: cluster:b300-dsxe @@ -1218,15 +1219,15 @@ kimik3-fp4-b300-vllm-agentic-dspark: scenarios: # Agentic-coding only: no fixed-seq-len (1k1k / 8k1k) arms for this recipe. agentic-coding: - # Sizes the Mooncake segment: this resolves to total-cpu-dram-gb, which - # the recipe divides across the 8 TP ranks. + # Resolves to TOTAL_CPU_DRAM_GB, which caps the recipe's 8 Mooncake + # segments and buffers. - dram-utilization: 0.75 search-space: # TP8-only: a ~1.5 TB MXFP4 checkpoint does not fit below 8 GPUs. - # One entry for every arm: the recipe drafts at DSpark 7 up to conc 8, - # DSpark 3 at conc 16, and not at all above. Keep the concurrencies - # disjoint across arms so exp-names stay unique. - - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: mooncake, version: "0.3.11.post1" }, conc-list: [1, 2, 4, 8, 16, 24, 32, 40, 48, 56, 70], srt-recipe: agentic.yaml } + # One entry for every arm: DSpark 7 at conc 1, DSpark 5 at conc 4-8 and + # DSpark 3 at conc 12-40. + # Keep the concurrencies disjoint across arms so exp-names stay unique. + - { tp: 8, ep: 1, dcp-size: 8, spec-decoding: mtp, kv-offloading: dram, kv-offload-backend: { name: mooncake, version: "0.3.13.post1" }, conc-list: [1, 4, 8, 12, 14, 16, 24, 28], srt-recipe: agentic.yaml } dsr1-fp8-b200-trt: image: nvcr.io#nvidia/tensorrt-llm/release:1.3.0rc14 diff --git a/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py b/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py index 028405e64f..a4953d0a74 100644 --- a/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py +++ b/inferencex-e2e/infx/tests/srt_slurm/test_setup_scripts.py @@ -2,11 +2,13 @@ import json import os +import shutil import subprocess import sys from pathlib import Path import pytest +import yaml from infx.srt_slurm.workload import INSTALLERS, VERSION_ENV from infx.tests.bench.stubs import executable @@ -66,3 +68,152 @@ def test_an_installer_installs_exactly_the_bound_version(tmp_path, script, env, assert result.returncode == 0, result.stdout + result.stderr assert expected <= set(installs[0]) + + +def b300_mooncake(command: str, *args: str, env: dict[str, str] | None = None) -> subprocess.CompletedProcess: + """Source the B300 Mooncake setup script, which then only defines its functions, and run ``command``.""" + return subprocess.run( + ["bash", "-c", f'source "$1"; shift; {command}', "_", str(CONFIGS / "kimik3-b300-mooncake.sh"), *args], + env={**os.environ, **(env or {})}, + capture_output=True, + text=True, + check=False, + ) + + +def bundled_mooncake(tmp_path: Path, bundled: str, declared: str) -> subprocess.CompletedProcess: + """Run the B300 bundled-Mooncake check against an image that ships ``bundled``.""" + (tmp_path / "bin").mkdir() + executable( + tmp_path / "bin/python3", + f"#!{sys.executable}\nimport sys\nif 'importlib.metadata' in sys.argv[2]:\n print({bundled!r})\n", + ) + return b300_mooncake( + "check_bundled_mooncake", + env={ + "PATH": f"{tmp_path / 'bin'}{os.pathsep}{os.environ['PATH']}", + "KV_OFFLOAD_BACKEND_VERSION": declared, + }, + ) + + +def test_kimik3_b300_accepts_the_bundled_mooncake_at_the_declared_version(tmp_path): + result = bundled_mooncake(tmp_path, "9.8.7", "9.8.7") + + assert result.returncode == 0, result.stderr + + +def test_kimik3_b300_rejects_a_bundled_mooncake_at_another_version(tmp_path): + result = bundled_mooncake(tmp_path, "9.8.7", "9.8.6") + + assert result.returncode == 1 + assert "bundles mooncake-transfer-engine-cuda13 9.8.7" in result.stderr + assert "version 9.8.6" in result.stderr + + +def rdma_port(root: Path, name: str, driver: str, state: str, link_layer: str = "InfiniBand") -> None: + """One sysfs ``infiniband`` class entry: driver symlink, port 1 state and link layer.""" + (root / name / "device").mkdir(parents=True) + (root / name / "device/driver").symlink_to(f"../../../bus/pci/drivers/{driver}") + (root / name / "ports/1").mkdir(parents=True) + (root / name / "ports/1/state").write_text(f"{state}\n") + (root / name / "ports/1/link_layer").write_text(f"{link_layer}\n") + + +def select_rail(root: Path) -> subprocess.CompletedProcess: + return b300_mooncake('select_mooncake_rdma_device "$1"; echo "$MOONCAKE_RAIL"', str(root)) + + +def test_kimik3_b300_rail_is_the_first_active_mellanox_port_never_efa(tmp_path): + rdma_port(tmp_path, "a_efa", "efa", "4: ACTIVE") + rdma_port(tmp_path, "ibp198s0f0", "mlx5_core", "1: DOWN") + rdma_port(tmp_path, "ibp199s0f0", "mlx5_core", "4: ACTIVE") + rdma_port(tmp_path, "rdmap86s0", "efa", "4: ACTIVE") + + result = select_rail(tmp_path) + + assert result.returncode == 0, result.stderr + assert result.stdout == "ibp199s0f0\n" + + +def test_kimik3_b300_rail_skips_an_active_ethernet_mellanox_port(tmp_path): + rdma_port(tmp_path, "mlx5_0", "mlx5_core", "4: ACTIVE", "Ethernet") + rdma_port(tmp_path, "mlx5_1", "mlx5_core", "4: ACTIVE") + + result = select_rail(tmp_path) + + assert result.returncode == 0, result.stderr + assert result.stdout == "mlx5_1\n" + + +def test_kimik3_b300_rail_fails_instead_of_falling_back_to_efa(tmp_path): + rdma_port(tmp_path, "ibp198s0f0", "mlx5_core", "1: DOWN") + rdma_port(tmp_path, "mlx5_bond_0", "mlx5_core", "4: ACTIVE", "Ethernet") + rdma_port(tmp_path, "rdmap86s0", "efa", "4: ACTIVE") + + result = select_rail(tmp_path) + + assert result.returncode == 1 + assert result.stdout == "" + assert "no ACTIVE InfiniBand mlx5_core port" in result.stderr + assert "rdmap86s0: driver=../../../bus/pci/drivers/efa state=4: ACTIVE link_layer=InfiniBand" in result.stderr + + +RECIPE = ROOT / "benchmarks/single_node/srt-slurm-recipes/kimik3/vllm/b300-fp4-mtp/agentic.yaml" + + +def host_with_mlx5_provider(root: Path) -> None: + """The host's rdma-core layout: libibverbs/libmlx5-rdmav34.so links to ../libmlx5.so.1.*.""" + lib = root / "usr/lib/x86_64-linux-gnu" + (lib / "libibverbs").mkdir(parents=True) + (lib / "libmlx5.so.1.25.58.0").write_bytes(b"\x7fELF") + (lib / "libibverbs/libmlx5-rdmav34.so").symlink_to("../libmlx5.so.1.25.58.0") + + +def bind(host: Path, container: Path, spec: str) -> None: + """Bind ``host:container[:flags]``: the container sees the tree, links unresolved, at its own path.""" + source, target = spec.split(":")[:2] + shutil.copytree(host / source.lstrip("/"), container / target.lstrip("/"), symlinks=True) + + +def check_provider(container: Path, drivers: str) -> subprocess.CompletedProcess: + return b300_mooncake( + 'check_mooncake_verbs_provider; echo "$MOONCAKE_VERBS_PROVIDER"', + env={"RDMAV_DRIVERS": f"{container}{drivers}"}, + ) + + +def test_kimik3_b300_recipe_mount_resolves_the_host_mlx5_provider(tmp_path): + base = yaml.safe_load(RECIPE.read_text())["base"] + host_with_mlx5_provider(tmp_path / "host") + for spec in base["extra_mount"]: + bind(tmp_path / "host", tmp_path / "container", spec) + + result = check_provider(tmp_path / "container", base["roles"]["agg"]["env"]["RDMAV_DRIVERS"]) + + assert result.returncode == 0, result.stderr + assert result.stdout.endswith("/host-usr-lib/libmlx5.so.1.25.58.0\n") + + +def test_kimik3_b300_provider_check_fails_when_only_the_provider_directory_is_mounted(tmp_path): + host_with_mlx5_provider(tmp_path / "host") + bind(tmp_path / "host", tmp_path / "container", "/usr/lib/x86_64-linux-gnu/libibverbs:/host-usr-lib/libibverbs:ro") + + result = check_provider(tmp_path / "container", "/host-usr-lib/libibverbs/libmlx5") + + assert result.returncode == 1 + assert "no verbs provider resolves" in result.stderr + assert "libmlx5-rdmav34.so -> ../libmlx5.so.1.25.58.0" in result.stderr + + +def test_kimik3_b300_setup_rejects_a_roce_gid_index_before_installing(tmp_path): + result, installs = run(tmp_path, "kimik3-b300-mooncake.sh", { + "KV_OFFLOAD_BACKEND_VERSION": "9.8.7", + "MOONCAKE_CONFIG_PATH": str(tmp_path / "mooncake_store_config.json"), + "MC_GID_INDEX": "3", + "RDMAV_DRIVERS": str(tmp_path / "libmlx5"), + }) # fmt: skip + + assert result.returncode == 1 + assert "MC_GID_INDEX=3; the InfiniBand Mooncake rail needs GID index 0" in result.stderr + assert installs == [] diff --git a/inferencex-e2e/perf-changelog.yaml b/inferencex-e2e/perf-changelog.yaml index 4e97d5dcbd..83ffb21e8d 100644 --- a/inferencex-e2e/perf-changelog.yaml +++ b/inferencex-e2e/perf-changelog.yaml @@ -11874,3 +11874,12 @@ - "Disable integer QuickReduce in the shared DeepSeek-V4.1-Flash MI355X vLLM recipe by setting VLLM_ROCM_QUICK_REDUCE_QUANTIZATION to NONE instead of INT4." - "This supersedes the preceding entry's INT4 setting and TP8-only sweep scope: rerun both the existing TP4/TP2 grid and the new TP8 c1 point with integer QuickReduce disabled. Images, search spaces and draft precision are unchanged." pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/4666 + +- config-keys: + - kimik3-fp4-b300-vllm-agentic-dspark + scenario-type: + - agentic-coding + description: + - "Update Kimi-K3 B300 vLLM AgentX to concurrency 1, 4, 8, 12, 14, 16, 24 and 28 with DSpark draft lengths 7, 5 and 3, per-point CUDA graph capture sizes, and move the KDA recurrent-state cache from float32 to bfloat16 (mamba-ssm-cache-dtype)." + - "Pin the vLLM nightly-49cb2bbf image digest and use the image's bundled Mooncake 0.3.13.post1 over an InfiniBand rail for KV offload at 256 GiB per TP rank." + pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/4381