Qwen3.8 2.4T A95B MXFP4 部署指南

更新时间:
复制 MD 格式

基于灵骏真武 M890P 实例 efg3.GP9A 部署

SGLang v0.5.21

环境准备

镜像

docker pull egslingjun-registry.cn-wulanchabu.cr.aliyuncs.com/egslingjun-tmp/inference-xpu-pytorch-opt:v0.5.21_1ccf267d76_20261116_175604

下载模型。

# T-HEAD量化模型
modelscope download --model T-HEAD/Qwen3.8-2.4T-A95B-FP8-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken --local_dir /path/to/your/model
模型:https://modelscope.cn/models/T-HEAD/Qwen3.8-2.4T-A95B-FP8-MoE-Quant-W-MXFP4-A-MXFP4-Dense-Quant-W-FP8-PerChannel-A-FP8-PerToken

PD分离部署(基于Mooncake)

这里PD分离部署采用开源Mooncake,通过RDMA传输KVCache。

Prefill

export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=Qwen3.8-2.4T-MXFP4-FP8
export IB_DEVICE=mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3
export NCCL_IB_HCA=mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3
export MC_FORCE_HCA=1
export MC_GID_INDEX=3
export PYTHONUNBUFFERED=1
export TP_SOCKET_IFNAME=eth0
export MOONCAKE_PROTOCOL=rdma
export NCCL_IB_GID_INDEX=3
export GLOO_SOCKET_IFNAME=eth0
export NCCL_SOCKET_IFNAME=eth0
export NVSHMEM_P2P_DISABLE=1
export NVSHMEM_IB_GID_INDEX=3
export SGLANG_WARMUP_TIMEOUT=3600
export DEEPEP_TIMEOUT_SECONDS=3600
export NVSHMEM_HCA_PE_MAPPING=mlx5_bond_0:1:2,mlx5_bond_1:1:2,mlx5_bond_2:1:2,mlx5_bond_3:1:2
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_ENABLE_CACHELINK=0
export SGLANG_OPT_ULTRA_EP_PPU=1
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export HGGC_EMBEDDED_COPY_THRESHOLD=0x10000
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export NVSHMEM_ENABLE_NIC_PE_MAPPING=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export NVSHMEM_IBGDA_TRANSPORT_DISABLE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export DG_MOE_G2_DIRECT_FRAGMENT_SCATTER=1
export DG_MOE_G2_RING_SCRATCH_BLOCKS_PER_SM=0
export SGLANG_DYNAMIC_CHUNKING_SMOOTH_FACTOR=0.3
export SGLANG_OPT_ULTRA_EP_PPU_REDUNDANT_PER_RANK=1
export SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=5120
export SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION=false
export SGLANG_USE_MODELSCOPE=1
export SERVING_PORT=8000
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --tp-size 8 \
  --ep-size 8 \
  --pp-size 2 \
  --moe-dense-tp-size 1 \
  --nnodes 2 \
  --node-rank $NODE_RANK \
  --dist-init-addr $MASTER_IP:$MASTER_PORT \
  --attention-backend fa3 \
  --moe-a2a-backend megamoe \
  --disaggregation-transfer-backend mooncake \
  --page-size 64 \
  --chunked-prefill-size 16384 \
  --max-prefill-tokens 16384 \
  --mem-fraction-static 0.8 \
  --pp-max-micro-batch-size 1 \
  --pp-async-batch-depth 1 \
  --enable-dynamic-chunking \
  --mamba-radix-cache-strategy extra_buffer \
  --disable-shared-experts-fusion \
  --disable-custom-all-reduce \
  --disable-cuda-graph \
  --stream-interval 128 \
  --watchdog-timeout 60000 \
  --dist-timeout 60000 \
  --disable-overlap-schedule \
  --enable-metrics \
  --enable-cache-report \
  --reasoning-parser qwen3 \
  --tool-call-parser qwen3_coder \
  --disaggregation-mode prefill \
  --disaggregation-bootstrap-port 8030 \
  --disaggregation-ib-device mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3 \
  --port ${SERVING_PORT} \
  --host 0.0.0.0

Decode

export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=Qwen3.8-2.4T-MXFP4-FP8
export IB_DEVICE=mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3
export NCCL_IB_HCA=mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3
export MC_FORCE_HCA=1
export MC_GID_INDEX=3
export PYTHONUNBUFFERED=1
export TP_SOCKET_IFNAME=eth0
export MOONCAKE_PROTOCOL=rdma
export NCCL_IB_GID_INDEX=3
export GLOO_SOCKET_IFNAME=eth0
export NCCL_SOCKET_IFNAME=eth0
export NVSHMEM_P2P_DISABLE=1
export SGLANG_WARMUP_TIMEOUT=3600
export DEEPEP_TIMEOUT_SECONDS=3600
export NVSHMEM_HCA_PE_MAPPING=mlx5_bond_0:1:2,mlx5_bond_1:1:2,mlx5_bond_2:1:2,mlx5_bond_3:1:2
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_ENABLE_CACHELINK=0
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export NVSHMEM_ENABLE_NIC_PE_MAPPING=1
export SGLANG_MAMBA_SLOT_INDIRECTION=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export NVSHMEM_IBGDA_TRANSPORT_DISABLE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=64
export SGLANG_USE_MODELSCOPE=1
export SERVING_PORT=8000
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --tp-size 32 \
  --dp-size 8 \
  --enable-dp-attention \
  --moe-dense-tp-size 1 \
  --enable-dp-lm-head \
  --nnodes 4 \
  --node-rank $NODE_RANK \
  --dist-init-addr $MASTER_IP:$MASTER_PORT \
  --moe-a2a-backend deepep \
  --deepep-mode auto \
  --moe-runner-backend deep_gemm \
  --attention-backend fa3 \
  --disaggregation-transfer-backend mooncake \
  --page-size 64 \
  --cuda-graph-max-bs-decode 80 \
  --max-running-requests 640 \
  --mem-fraction-static 0.9 \
  --speculative-algorithm NEXTN \
  --speculative-num-steps 2 \
  --speculative-eagle-topk 1 \
  --speculative-num-draft-tokens 3 \
  --disable-shared-experts-fusion \
  --disable-custom-all-reduce \
  --disable-radix-cache \
  --stream-interval 128 \
  --watchdog-timeout 60000 \
  --dist-timeout 60000 \
  --enable-metrics \
  --enable-cache-report \
  --reasoning-parser qwen3 \
  --tool-call-parser qwen3_coder \
  --disaggregation-mode decode \
  --disaggregation-bootstrap-port 8030 \
  --disaggregation-ib-device mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3 \
  --port ${SERVING_PORT} \
  --host 0.0.0.0

启动Router

python -m sglang_router.launch_router --pd-disaggregation \
    --host 0.0.0.0 \
    --prefill http://$PREFILL_IP:$PREFILL_PORT \
    --decode http://$DECODE_IP:$DECODE_PORT \
    --port $SERVICE_PORT \
    --policy manual \
    --assignment-mode min_group \
    --dp-aware