GLM5.3 FP8 部署指南

更新时间:
复制 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/GLM-5.3-Quant-W-FP8-PerChannel-A-FP8-PerToken --local_dir /path/to/your/model
模型:https://modelscope.cn/models/T-HEAD/GLM-5.3-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=GLM-5.3-FP8-Channelwise
export SGLANG_JIT_DEEPGEMM_COMPILE_WORKERS=16
export SGLANG_WARMUP_TIMEOUT=3600
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export DEEPEP_TIMEOUT_SECONDS=3600
export MC_NUM_QP_PER_EP=4
export SGLANG_DISAGGREGATION_ALL_CP_RANKS_TRANSFER=1
export SGLANG_DSA_KV_FLAT_FP8=1
export SGLANG_OPT_USE_FP4_INDEXER_CACHE=0
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_INTERNODE_HIER_ALL_GATHER=1
export SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=4096
export SGLANG_PPU_FP8_MEGA_MOE_G1_QUANT_MODE=grid
export SGLANG_OPT_ULTRA_EP_PPU=1
export SGLANG_OPT_ULTRA_EP_PPU_REDUNDANT_PER_RANK=1
export SGLANG_HICACHE_HOST_REGISTER_CHUNK_GB=256
export SGLANG_ENABLE_HEALTH_ENDPOINT_GENERATION=false
export SGLANG_HICACHE_SHARED_MLA_HOST_CACHE=0
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export PYTHONUNBUFFERED=1
export SERVING_PORT=8000
export SGLANG_ENABLE_CACHELINK=0
export MC_FORCE_HCA=1
export NCCL_IB_GID_INDEX=3
export MOONCAKE_PROTOCOL=rdma
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --tp-size 8 \
  --enable-prefill-cp \
  --cp-strategy interleave \
  --attention-backend dsa \
  --dsa-prefill-backend flashmla_sparse_q8 \
  --dsa-decode-backend flashmla_sparse_q8 \
  --moe-a2a-backend megamoe \
  --hicache-io-backend direct \
  --disaggregation-transfer-backend mooncake \
  --kv-cache-dtype fp8_e4m3 \
  --mem-fraction-static 0.9 \
  --chunked-prefill-size 32768 \
  --disable-custom-all-reduce \
  --watchdog-timeout 36000 \
  --dist-timeout 36000 \
  --disable-cuda-graph \
  --num-continuous-decode-steps 1 \
  --disable-shared-experts-fusion \
  --reasoning-parser glm45 \
  --tool-call-parser glm47 \
  --enable-hierarchical-cache \
  --hicache-write-policy write_back \
  --hicache-mem-layout layer_first \
  --disable-overlap-schedule \
  --enable-metrics \
  --enable-cache-report \
  --disaggregation-mode prefill \
  --disaggregation-bootstrap-port 8030 \
  --disaggregation-ib-device mlx5_bond_0,mlx5_bond_1,mlx5_bond_2,mlx5_bond_3 \
  --hicache-size ${L2_CACHE_SIZE:-740} \
  --port ${SERVING_PORT} \
  --host 0.0.0.0

Decode

export MODEL_PATH=/path/to/your/model
export SERVED_MODEL_NAME=GLM-5.3-FP8-Channelwise
export SGLANG_WARMUP_TIMEOUT=3600
export SGLANG_SAIL_DEEPEP_RECV_HOOK=0
export DEEPEP_TIMEOUT_SECONDS=3600
export MC_NUM_QP_PER_EP=4
export SGLANG_DISAGGREGATION_ALL_CP_RANKS_TRANSFER=1
export SGLANG_DSA_KV_FLAT_FP8=1
export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256
export SGLANG_DSV4_FLASHMLA_USE_DRAFT_EXTEND_GRAPH_SCHEDULE=1
export DG_USE_MOE_DYNAMIC_TILE=1
export SGLANG_INTERNODE_HIER_ALL_GATHER=1
export SGLANG_OPT_USE_FP4_INDEXER_CACHE=0
export SGLANG_ENABLE_JIT_DEEPGEMM=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export SGLANG_JIT_DEEPGEMM_FAST_WARMUP=0
export PYTHONUNBUFFERED=1
export SERVING_PORT=8000
export SGLANG_ENABLE_CACHELINK=0
export MC_FORCE_HCA=1
export NCCL_IB_GID_INDEX=3
export MOONCAKE_PROTOCOL=rdma
sglang serve \
  --model-path ${MODEL_PATH} \
  --served-model-name ${SERVED_MODEL_NAME} \
  --trust-remote-code \
  --tp-size 8 \
  --moe-dense-tp-size 1 \
  --enable-dp-lm-head \
  --enable-dp-attention \
  --dp-size 8 \
  --moe-a2a-backend deepep \
  --deepep-mode auto \
  --attention-backend dsa \
  --dsa-prefill-backend flashmla_sparse_q8 \
  --dsa-decode-backend flashmla_sparse_q8 \
  --disaggregation-transfer-backend mooncake \
  --kv-cache-dtype fp8_e4m3 \
  --mem-fraction-static 0.9 \
  --cuda-graph-max-bs-decode 32 \
  --max-running-requests 256 \
  --speculative-algorithm EAGLE \
  --speculative-num-steps 2 \
  --speculative-eagle-topk 1 \
  --speculative-num-draft-tokens 3 \
  --speculative-attention-mode decode \
  --decode-log-interval 1 \
  --stream-interval 128 \
  --disable-custom-all-reduce \
  --watchdog-timeout 36000 \
  --dist-timeout 36000 \
  --num-continuous-decode-steps 1 \
  --disable-radix-cache \
  --disable-shared-experts-fusion \
  --reasoning-parser glm45 \
  --tool-call-parser glm47 \
  --enable-metrics \
  --enable-cache-report \
  --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 \
    --prefill http://$PREFILL_IP:$PREFILL_PORT $BOOTSTRAP_PORT \
    --decode http://$DECODE_IP:$DECODE_PORT \
    --host 0.0.0.0 \
    --port $SERVICE_PORT \
    --pd-disaggregation \
    --disable-health-check \
    --worker-startup-check-interval 1800 \
    --request-timeout-secs 3600