# Set chunked prefill size, which depends on the gpu memory capacity
ifself.chunked_prefill_sizeisNone:
ifgpu_memisnotNoneandgpu_mem>180_000:
self.chunked_prefill_size=16384
elifgpu_memisnotNoneandgpu_mem<25_000:
self.chunked_prefill_size=2048
elifself.disaggregation_mode!="null":
self.chunked_prefill_size=16384
ifgpu_memisnotNone:
ifgpu_mem<35*1024:# A10, L40, 4090
self.chunked_prefill_size=2048
elifgpu_mem<160*1024:# H100, H200, A100, H20
self.chunked_prefill_size=8192
else:# B200, MI300
self.chunked_prefill_size=16384
else:
self.chunked_prefill_size=8192
self.chunked_prefill_size=4096
assertself.chunked_prefill_size%self.page_size==0
# Set cuda graph max batch size
ifself.cuda_graph_max_bsisNone:
# Based on detailed statistics, when serving TP1/TP2 models on lower-end GPUs with HBM<25G, you can either disable cuda graph or set `cuda_graph_max_bs` to a very small value to reduce the memory overhead of creating cuda graphs, with almost no impact on performance. However, when serving models with TP4 or TP8, we need to enable cuda graph to maintain high performance. In this case, we can set `cuda_graph_max_bs` to 80 (half of the default value 160) to reduce the memory overhead of creating cuda graphs. Looking at the logs from TP4 serving of qwen2-72b, a value of 80 is sufficient and can reduce the memory overhead of creating cuda graphs on lower-end GPUs compared to the original 160, avoiding OOM issues.
ifgpu_memisnotNoneandgpu_mem<35*1024:
ifself.tp_size<4:
self.cuda_graph_max_bs=8
else:
self.cuda_graph_max_bs=80
assertself.moe_dense_tp_sizein{
1,
None,
...
...
@@ -316,15 +337,6 @@ class ServerArgs:
)
self.page_size=128
# Set cuda graph max batch size
ifself.cuda_graph_max_bsisNone:
# Based on detailed statistics, when serving TP1/TP2 models on lower-end GPUs with HBM<25G, you can either disable cuda graph or set `cuda_graph_max_bs` to a very small value to reduce the memory overhead of creating cuda graphs, with almost no impact on performance. However, when serving models with TP4 or TP8, we need to enable cuda graph to maintain high performance. In this case, we can set `cuda_graph_max_bs` to 80 (half of the default value 160) to reduce the memory overhead of creating cuda graphs. Looking at the logs from TP4 serving of qwen2-72b, a value of 80 is sufficient and can reduce the memory overhead of creating cuda graphs on lower-end GPUs compared to the original 160, avoiding OOM issues.