|
| 1 | +# Disaggregated Prefill-Decode Deployment Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | +This demo document provides instructions for running a disaggregated vLLM-ascend service with separate prefill and decode stages across 4 nodes, uses 16 Ascend NPUs for two prefill nodes (P1/P2) and 16 Ascend NPUS for two decode nodes (D1/D2). |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | +- Ascend NPU environment with vLLM 0.9.1 installed |
| 8 | +- Network interfaces configured for distributed communication (eg: eth0) |
| 9 | +- Model weights located at `/data01/deepseek_r1_w8a8_zhw` |
| 10 | + |
| 11 | +## Rank table generation |
| 12 | +The rank table is a JSON file that specifies the mapping of Ascend NPU ranks to nodes. The following command generates a rank table for all nodes with 16 cards prefill and 16 cards decode: |
| 13 | + |
| 14 | +Run the following command on every node to generate the rank table: |
| 15 | +```shell |
| 16 | +cd vllm-ascend/examples/disaggregate_prefill_v1/ |
| 17 | +bash gen_ranktable.sh --ips 172.19.32.175 172.19.241.49 172.19.123.51 172.19.190.36 \ |
| 18 | + --npus-per-node 8 --network-card-name enp189s0f0 --prefill-device-cnt 16 --decode-device-cnt 16 |
| 19 | +``` |
| 20 | +Rank table will generated at `/vllm-workspace/vllm-ascend/examples/disaggregate_prefill_v1/ranktable.json` |
| 21 | + |
| 22 | +## Start disaggregated vLLM-ascend service |
| 23 | +Execution Sequence |
| 24 | +- 4 configured node ip are: 172.19.32.175 172.19.241.49 172.19.123.51 172.19.190.36 |
| 25 | +- Start Prefill on Node 1 (P1) |
| 26 | +- Start Prefill on Node 2 (P2) |
| 27 | +- Start Decode on Node 1 (D1) |
| 28 | +- Start Decode on Node 2 (D2) |
| 29 | +- Start proxy server on Node1 |
| 30 | + |
| 31 | +* Run prefill server P1 on first node |
| 32 | +```shell |
| 33 | +export HCCL_IF_IP=172.19.32.175 # node ip |
| 34 | +export GLOO_SOCKET_IFNAME="eth0" # network card name |
| 35 | +export TP_SOCKET_IFNAME="eth0" |
| 36 | +export HCCL_SOCKET_IFNAME="eth0" |
| 37 | +export DISAGGREGATED_PREFILL_RANK_TABLE_PATH=/vllm-workspace/vllm-ascend/examples/disaggregate_prefill_v1/ranktable.json |
| 38 | +export OMP_PROC_BIND=false |
| 39 | +export OMP_NUM_THREADS=100 |
| 40 | +export VLLM_USE_V1=1 |
| 41 | +vllm serve /data01/deepseek_r1_w8a8_zhw \ |
| 42 | + --host 0.0.0.0 \ |
| 43 | + --port 20002 \ |
| 44 | + --data-parallel-size 2 \ |
| 45 | + --data-parallel-size-local 1 \ |
| 46 | + --api-server-count 2 \ |
| 47 | + --data-parallel-address 172.19.32.175 \ |
| 48 | + --data-parallel-rpc-port 13356 \ |
| 49 | + --tensor-parallel-size 8 \ |
| 50 | + --no-enable-prefix-caching \ |
| 51 | + --seed 1024 \ |
| 52 | + --served-model-name deepseek \ |
| 53 | + --max-model-len 6144 \ |
| 54 | + --max-num-batched-tokens 6144 \ |
| 55 | + --trust-remote-code \ |
| 56 | + --enforce-eager \ |
| 57 | + --gpu-memory-utilization 0.9 \ |
| 58 | + --kv-transfer-config \ |
| 59 | + '{"kv_connector": "LLMDataDistCMgrConnector", |
| 60 | + "kv_buffer_device": "npu", |
| 61 | + "kv_role": "kv_producer", |
| 62 | + "kv_parallel_size": 1, |
| 63 | + "kv_port": "20001", |
| 64 | + "engine_id": "0", |
| 65 | + "kv_connector_module_path": "vllm_ascend.distributed.llmdatadist_c_mgr_connector" |
| 66 | + }' \ |
| 67 | + --additional-config \ |
| 68 | + '{"torchair_graph_config": {"enabled": false, "enable_multistream_shared_expert": false}, "ascend_scheduler_config":{"enabled":false}}' |
| 69 | +``` |
| 70 | + |
| 71 | +* Run prefill server P2 on second node |
| 72 | +```shell |
| 73 | +export HCCL_IF_IP=172.19.241.49 |
| 74 | +export GLOO_SOCKET_IFNAME="eth0" |
| 75 | +export TP_SOCKET_IFNAME="eth0" |
| 76 | +export HCCL_SOCKET_IFNAME="eth0" |
| 77 | +export DISAGGREGATED_PREFILL_RANK_TABLE_PATH=/vllm-workspace/vllm-ascend/examples/disaggregate_prefill_v1/ranktable.json |
| 78 | +export OMP_PROC_BIND=false |
| 79 | +export OMP_NUM_THREADS=100 |
| 80 | +export VLLM_USE_V1=1 |
| 81 | +vllm serve /data01/deepseek_r1_w8a8_zhw \ |
| 82 | + --host 0.0.0.0 \ |
| 83 | + --port 20002 \ |
| 84 | + --headless \ |
| 85 | + --data-parallel-size 2 \ |
| 86 | + --data-parallel-start-rank 1 \ |
| 87 | + --data-parallel-size-local 1 \ |
| 88 | + --data-parallel-address 172.19.32.175 \ |
| 89 | + --data-parallel-rpc-port 13356 \ |
| 90 | + --tensor-parallel-size 8 \ |
| 91 | + --no-enable-prefix-caching \ |
| 92 | + --seed 1024 \ |
| 93 | + --served-model-name deepseek \ |
| 94 | + --max-model-len 6144 \ |
| 95 | + --max-num-batched-tokens 6144 \ |
| 96 | + --trust-remote-code \ |
| 97 | + --enforce-eager \ |
| 98 | + --gpu-memory-utilization 0.9 \ |
| 99 | + --kv-transfer-config \ |
| 100 | + '{"kv_connector": "LLMDataDistCMgrConnector", |
| 101 | + "kv_buffer_device": "npu", |
| 102 | + "kv_role": "kv_producer", |
| 103 | + "kv_parallel_size": 1, |
| 104 | + "kv_port": "20001", |
| 105 | + "engine_id": "0", |
| 106 | + "kv_connector_module_path": "vllm_ascend.distributed.llmdatadist_c_mgr_connector" |
| 107 | + }' \ |
| 108 | + --additional-config \ |
| 109 | + '{"torchair_graph_config": {"enabled": false, "enable_multistream_shared_expert": false}, "ascend_scheduler_config":{"enabled":false}}' |
| 110 | +``` |
| 111 | + |
| 112 | +* Run decode server d1 on third node |
| 113 | +```shell |
| 114 | +export HCCL_IF_IP=172.19.123.51 |
| 115 | +export GLOO_SOCKET_IFNAME="eth0" |
| 116 | +export TP_SOCKET_IFNAME="eth0" |
| 117 | +export HCCL_SOCKET_IFNAME="eth0" |
| 118 | +export DISAGGREGATED_PREFILL_RANK_TABLE_PATH=/vllm-workspace/vllm-ascend/examples/disaggregate_prefill_v1/ranktable.json |
| 119 | +export OMP_PROC_BIND=false |
| 120 | +export OMP_NUM_THREADS=100 |
| 121 | +export VLLM_USE_V1=1 |
| 122 | +vllm serve /data01/deepseek_r1_w8a8_zhw \ |
| 123 | + --host 0.0.0.0 \ |
| 124 | + --port 20002 \ |
| 125 | + --data-parallel-size 2 \ |
| 126 | + --data-parallel-size-local 1 \ |
| 127 | + --api-server-count 2 \ |
| 128 | + --data-parallel-address 172.19.123.51 \ |
| 129 | + --data-parallel-rpc-port 13356 \ |
| 130 | + --tensor-parallel-size 8 \ |
| 131 | + --no-enable-prefix-caching \ |
| 132 | + --seed 1024 \ |
| 133 | + --served-model-name deepseek \ |
| 134 | + --max-model-len 6144 \ |
| 135 | + --max-num-batched-tokens 6144 \ |
| 136 | + --trust-remote-code \ |
| 137 | + --enforce-eager \ |
| 138 | + --gpu-memory-utilization 0.9 \ |
| 139 | + --kv-transfer-config \ |
| 140 | + '{"kv_connector": "LLMDataDistCMgrConnector", |
| 141 | + "kv_buffer_device": "npu", |
| 142 | + "kv_role": "kv_consumer", |
| 143 | + "kv_parallel_size": 1, |
| 144 | + "kv_port": "20001", |
| 145 | + "engine_id": "0", |
| 146 | + "kv_connector_module_path": "vllm_ascend.distributed.llmdatadist_c_mgr_connector" |
| 147 | + }' \ |
| 148 | + --additional-config \ |
| 149 | + '{"torchair_graph_config": {"enabled": false, "enable_multistream_shared_expert": false}, "ascend_scheduler_config":{"enabled":false}}' |
| 150 | +``` |
| 151 | + |
| 152 | +* Run decode server d2 on last node |
| 153 | +```shell |
| 154 | +export HCCL_IF_IP=172.19.190.36 |
| 155 | +export GLOO_SOCKET_IFNAME="eth0" |
| 156 | +export TP_SOCKET_IFNAME="eth0" |
| 157 | +export HCCL_SOCKET_IFNAME="eth0" |
| 158 | +export DISAGGREGATED_PREFILL_RANK_TABLE_PATH=/vllm-workspace/vllm-ascend/examples/disaggregate_prefill_v1/ranktable.json |
| 159 | +export OMP_PROC_BIND=false |
| 160 | +export OMP_NUM_THREADS=100 |
| 161 | +export VLLM_USE_V1=1 |
| 162 | +vllm serve /data01/deepseek_r1_w8a8_zhw \ |
| 163 | + --host 0.0.0.0 \ |
| 164 | + --port 20002 \ |
| 165 | + --headless \ |
| 166 | + --data-parallel-size 2 \ |
| 167 | + --data-parallel-start-rank 1 \ |
| 168 | + --data-parallel-size-local 1 \ |
| 169 | + --data-parallel-address 172.19.123.51 \ |
| 170 | + --data-parallel-rpc-port 13356 \ |
| 171 | + --tensor-parallel-size 8 \ |
| 172 | + --no-enable-prefix-caching \ |
| 173 | + --seed 1024 \ |
| 174 | + --served-model-name deepseek \ |
| 175 | + --max-model-len 6144 \ |
| 176 | + --max-num-batched-tokens 6144 \ |
| 177 | + --trust-remote-code \ |
| 178 | + --enforce-eager \ |
| 179 | + --gpu-memory-utilization 0.9 \ |
| 180 | + --kv-transfer-config \ |
| 181 | + '{"kv_connector": "LLMDataDistCMgrConnector", |
| 182 | + "kv_buffer_device": "npu", |
| 183 | + "kv_role": "kv_consumer", |
| 184 | + "kv_parallel_size": 1, |
| 185 | + "kv_port": "20001", |
| 186 | + "engine_id": "0", |
| 187 | + "kv_connector_module_path": "vllm_ascend.distributed.llmdatadist_c_mgr_connector" |
| 188 | + }' \ |
| 189 | + --additional-config \ |
| 190 | + '{"torchair_graph_config": {"enabled": false, "enable_multistream_shared_expert": false}, "ascend_scheduler_config":{"enabled":false}}' |
| 191 | +``` |
| 192 | + |
| 193 | +* Run proxy server on the first node |
| 194 | +```shell |
| 195 | +cd /vllm-workspace/vllm-ascend/examples/disaggregate_prefill_v1 |
| 196 | +python toy_proxy_server.py --host 172.19.32.175 --port 1025 --prefiller-hosts 172.19.241.49 --prefiller-port 20002 --decoder-hosts 172.19.123.51 --decoder-ports 20002 |
| 197 | +``` |
| 198 | + |
| 199 | +* Verification |
| 200 | +Check service health using the proxy server endpoint: |
| 201 | +```shell |
| 202 | +curl http://localhost:1025/v1/completions \ |
| 203 | + -H "Content-Type: application/json" \ |
| 204 | + -d '{ |
| 205 | + "model": "deepseek", |
| 206 | + "prompt": "Who are you?", |
| 207 | + "max_tokens": 100, |
| 208 | + "temperature": 0 |
| 209 | + }' |
| 210 | +``` |
| 211 | + |
| 212 | +* Performance |
| 213 | +Test performance with vllm benchmark |
| 214 | +```shell |
| 215 | +cd /vllm-workspace/vllm/benchmarks |
| 216 | +python3 benchmark_serving.py \ |
| 217 | + --backend vllm \ |
| 218 | + --dataset-name random \ |
| 219 | + --random-input-len 4096 \ |
| 220 | + --random-output-len 1536 \ |
| 221 | + --num-prompts 256 \ |
| 222 | + --ignore-eos \ |
| 223 | + --model deepseek \ |
| 224 | + --tokenizer /data01/deepseek_r1_w8a8_zhw \ |
| 225 | + --host localhost \ |
| 226 | + --port 8000 \ |
| 227 | + --endpoint /v1/completions \ |
| 228 | + --max-concurrency 4 \ |
| 229 | + --request-rate 4 |
| 230 | +``` |
0 commit comments