Skip to content

Commit 1fc8435

Browse files
committed
add disaggregated deployment
1 parent a224be6 commit 1fc8435

File tree

3 files changed

+93
-5
lines changed

3 files changed

+93
-5
lines changed

runtime/triton_trtllm/README.DIT.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ bash run_stepaudio2_dit_token2wav.sh <start_stage> <stop_stage>
4545
- **Stage 4**: Runs the gRPC benchmark client for performance testing.
4646
- **Stage 5**: Runs the offline TTS inference benchmark test.
4747
- **Stage 6**: Runs a standalone inference script for the Step-Audio2-mini DiT Token2Wav model.
48-
48+
- **Stage 7**: Launches servers in a disaggregated setup, with the LLM on GPU 0 and Token2Wav servers on GPUs 1-3.
49+
- **Stage 8**: Runs the benchmark client for the disaggregated server configuration.
4950
### Export Models and Launch Server
5051

5152
Inside the Docker container, prepare the models and start the Triton server by running stages 0-3:
@@ -100,6 +101,40 @@ The following results were obtained by decoding on a single L20 GPU with the `yu
100101
| TRTLLM | 16 | 2.01 | 5.03 | 0.0292 |
101102

102103

104+
### Disaggregated Server
105+
When the LLM and token2wav components are deployed on the same GPU, they compete for resources. To optimize performance, we use a disaggregated setup where the LLM is deployed on one dedicated L20 GPU, taking advantage of in-flight batching for inference. The token2wav module is deployed on separate, dedicated GPUs.
106+
107+
The table below shows the first chunk latency results for this configuration. In our tests, we deploy two token2wav instances on each dedicated token2wav GPU.
108+
109+
| token2wav_num_gpu | concurrent_task_per_instance | concurrent_tasks_per_gpu | avg (ms) | p50 (ms) | p90 (ms) | p99 (ms) |
110+
|---|---|---|---|---|---|---|
111+
| 1 | 1 | 1.00 | 218.53 | 217.86 | 254.07 | 296.49 |
112+
| 2 | 1 | 1.33 | 218.82 | 219.21 | 256.62 | 303.13 |
113+
| 3 | 1 | 1.50 | 229.08 | 223.27 | 302.13 | 324.41 |
114+
| 4 | 1 | 1.60 | 203.87 | 198.23 | 254.92 | 279.31 |
115+
| 1 | 2 | 2.00 | 293.46 | 280.53 | 370.81 | 407.40 |
116+
| 2 | 2 | 2.67 | 263.38 | 236.84 | 350.82 | 397.39 |
117+
| 3 | 2 | 3.00 | 308.09 | 275.48 | 385.22 | 521.45 |
118+
| 4 | 2 | 3.20 | 271.85 | 253.25 | 359.03 | 387.91 |
119+
| 1 | 3 | 3.00 | 389.15 | 373.01 | 469.22 | 542.89 |
120+
| 2 | 3 | 4.00 | 403.48 | 394.80 | 481.24 | 507.75 |
121+
| 3 | 3 | 4.50 | 406.33 | 391.28 | 495.43 | 571.29 |
122+
| 4 | 3 | 4.80 | 436.72 | 383.81 | 638.44 | 879.23 |
123+
| 1 | 4 | 4.00 | 520.12 | 493.98 | 610.38 | 739.85 |
124+
| 2 | 4 | 5.33 | 494.60 | 490.50 | 605.93 | 708.09 |
125+
| 3 | 4 | 6.00 | 538.23 | 508.33 | 687.62 | 736.96 |
126+
| 4 | 4 | 6.40 | 579.68 | 546.20 | 721.53 | 958.04 |
127+
| 1 | 5 | 5.00 | 635.02 | 623.30 | 786.85 | 819.84 |
128+
| 2 | 5 | 6.67 | 598.23 | 617.09 | 741.00 | 788.96 |
129+
| 3 | 5 | 7.50 | 644.78 | 684.40 | 786.45 | 1009.45 |
130+
| 4 | 5 | 8.00 | 733.92 | 642.26 | 1024.79 | 1281.55 |
131+
| 1 | 6 | 6.00 | 715.38 | 745.68 | 887.04 | 906.68 |
132+
| 2 | 6 | 8.00 | 748.31 | 753.94 | 873.59 | 1007.14 |
133+
| 3 | 6 | 9.00 | 900.27 | 822.28 | 1431.14 | 1800.23 |
134+
| 4 | 6 | 9.60 | 857.54 | 820.33 | 1150.30 | 1298.53 |
135+
136+
The `concurrent_task_per_gpu` is calculated as:
137+
`concurrent_task_per_gpu = concurrent_task_per_instance * num_token2wav_instance_per_gpu (2) * token2wav_gpus / (token2wav_gpus + llm_gpus (1))`
103138

104139
### Acknowledgements
105140

runtime/triton_trtllm/client_grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ def write_triton_stats(stats, summary_file):
134134
compute_output = batch["compute_output"]
135135
compute_infer = batch["compute_infer"]
136136
batch_count = int(compute_infer["count"])
137+
if batch_count == 0:
138+
continue
137139
assert compute_infer["count"] == compute_output["count"] == compute_input["count"]
138140
compute_infer_time_ms = int(compute_infer["ns"]) / 1e6
139141
compute_input_time_ms = int(compute_input["ns"]) / 1e6

runtime/triton_trtllm/run_stepaudio2_dit_token2wav.sh

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trt_weights_dir=./trt_weights_${trt_dtype}
2020
trt_engines_dir=./trt_engines_${trt_dtype}
2121

2222
model_repo=./model_repo_cosyvoice2_dit
23-
bls_instance_num=4
23+
bls_instance_num=10
2424

2525
if [ $stage -le -1 ] && [ $stop_stage -ge -1 ]; then
2626

@@ -58,7 +58,7 @@ if [ $stage -le 1 ] && [ $stop_stage -ge 1 ]; then
5858
echo "Building TensorRT engines"
5959
trtllm-build --checkpoint_dir $trt_weights_dir \
6060
--output_dir $trt_engines_dir \
61-
--max_batch_size 16 \
61+
--max_batch_size 64 \
6262
--max_num_tokens 32768 \
6363
--gemm_plugin $trt_dtype || exit 1
6464

@@ -100,14 +100,14 @@ fi
100100

101101
if [ $stage -le 3 ] && [ $stop_stage -ge 3 ]; then
102102
echo "Starting Token2wav Triton server and Cosyvoice2 llm using trtllm-serve"
103-
mpirun -np 1 --allow-run-as-root --oversubscribe trtllm-serve serve --tokenizer $huggingface_model_local_dir $trt_engines_dir --max_batch_size 16 --kv_cache_free_gpu_memory_fraction 0.4 &
103+
mpirun -np 1 --allow-run-as-root --oversubscribe trtllm-serve serve --tokenizer $huggingface_model_local_dir $trt_engines_dir --max_batch_size 64 --kv_cache_free_gpu_memory_fraction 0.4 &
104104
tritonserver --model-repository $model_repo --http-port 18000 &
105105
wait
106106
# Test using curl
107107
# curl http://localhost:8000/v1/chat/completions \
108108
# -H "Content-Type: application/json" \
109109
# -d '{
110-
# "model": "trt_engines_bfloat16",
110+
# "model": "",
111111
# "messages":[{"role": "user", "content": "Where is New York?"},
112112
# {"role": "assistant", "content": "<|s_1708|><|s_2050|><|s_2159|>"}],
113113
# "max_tokens": 512,
@@ -172,3 +172,54 @@ if [ $stage -le 6 ] && [ $stop_stage -ge 6 ]; then
172172
fi
173173

174174

175+
if [ $stage -le 7 ] && [ $stop_stage -ge 7 ]; then
176+
echo "Disaggregated Server: LLM and Token2wav on different GPUs"
177+
echo "Starting LLM server on GPU 0"
178+
export CUDA_VISIBLE_DEVICES=0
179+
mpirun -np 1 --allow-run-as-root --oversubscribe trtllm-serve serve --tokenizer $huggingface_model_local_dir $trt_engines_dir --max_batch_size 64 --kv_cache_free_gpu_memory_fraction 0.4 &
180+
echo "Starting Token2wav server on GPUs 1-3"
181+
Token2wav_num_gpus=3
182+
http_port=17000
183+
grpc_port=18000
184+
metrics_port=16000
185+
for i in $(seq 0 $(($Token2wav_num_gpus - 1))); do
186+
echo "Starting server on GPU $i"
187+
http_port=$((http_port + 1))
188+
grpc_port=$((grpc_port + 1))
189+
metrics_port=$((metrics_port + 1))
190+
# Two instances of Token2wav server on the same GPU
191+
CUDA_VISIBLE_DEVICES=$(($i + 1)) tritonserver --model-repository $model_repo --http-port $http_port --grpc-port $grpc_port --metrics-port $metrics_port &
192+
http_port=$((http_port + 1))
193+
grpc_port=$((grpc_port + 1))
194+
metrics_port=$((metrics_port + 1))
195+
CUDA_VISIBLE_DEVICES=$(($i + 1)) tritonserver --model-repository $model_repo --http-port $http_port --grpc-port $grpc_port --metrics-port $metrics_port &
196+
done
197+
wait
198+
fi
199+
200+
if [ $stage -le 8 ] && [ $stop_stage -ge 8 ]; then
201+
echo "Running benchmark client for Disaggregated Server"
202+
per_gpu_instances=2
203+
mode=streaming
204+
BLS_INSTANCE_NUM=$bls_instance_num
205+
Token2wav_num_gpus=(1 2 3)
206+
concurrent_tasks=(1 2 3 4 5 6)
207+
for n_gpu in ${Token2wav_num_gpus[@]}; do
208+
echo "Test 1 GPU for LLM server and $n_gpu GPUs for Token2wav servers"
209+
for concurrent_task in ${concurrent_tasks[@]}; do
210+
num_instances=$((per_gpu_instances * n_gpu))
211+
for i in $(seq 1 $num_instances); do
212+
port=$(($i + 18000))
213+
python3 client_grpc.py \
214+
--server-addr localhost \
215+
--server-port $port \
216+
--model-name cosyvoice2_dit \
217+
--num-tasks $concurrent_task \
218+
--mode $mode \
219+
--huggingface-dataset yuekai/seed_tts_cosy2 \
220+
--log-dir ./log_disagg_concurrent_tasks_${concurrent_task}_per_instance_total_token2wav_instances_${num_instances}_port_${port} &
221+
done
222+
wait
223+
done
224+
done
225+
fi

0 commit comments

Comments
 (0)