A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 11, 23:45 UTC
[PCP&DCP] move CUDAGraph check for PCP&DCP to the check func of platforms (#29952)
Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
Qiu committed
Dec 5, 2025 at 10:40 UTC
0098a6e3dab74ac1e3e9371638bd9173c1ba83ad
3 files changed
+43
-22
vllm/config/vllm.py
+8
-22
@@ -671,36 +671,22 @@ class VllmConfig:
671
672
if current_platform.support_static_graph_mode():
673
# if cudagraph_mode has full cudagraphs, we need to check support
674
- if self.compilation_config.cudagraph_mode.has_full_cudagraphs():
675
- # decode context parallel does not support full cudagraphs
676
- if self.parallel_config.decode_context_parallel_size > 1:
674
+ if (
675
+ self.compilation_config.cudagraph_mode.has_full_cudagraphs()
676
+ and self.model_config is not None
677
+ ):
678
+ if self.model_config.pooler_config is not None:
679
logger.warning_once(
678
- "Decode context parallel (DCP) is enabled, which is "
679
- "incompatible with full CUDA graphs. "
680
+ "Pooling models do not support full cudagraphs. "
681
"Overriding cudagraph_mode to PIECEWISE."
682
)
683
self.compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
683
- # prefill context parallel do not support full cudagraphs
684
- elif self.parallel_config.prefill_context_parallel_size > 1:
684
+ elif self.model_config.is_encoder_decoder:
685
logger.warning_once(
686
- "Prefill context parallel (PCP) is enabled, which is "
687
- "incompatible with full CUDA graphs. "
686
+ "Encoder-decoder models do not support full cudagraphs. "
687
"Overriding cudagraph_mode to PIECEWISE."
688
)
689
self.compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
691
- elif self.model_config is not None:
692
- if self.model_config.pooler_config is not None:
693
- logger.warning_once(
694
- "Pooling models do not support full cudagraphs. "
695
- "Overriding cudagraph_mode to PIECEWISE."
696
- )
697
- self.compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
698
- elif self.model_config.is_encoder_decoder:
699
- logger.warning_once(
700
- "Encoder-decoder models do not support full cudagraphs. "
701
- "Overriding cudagraph_mode to PIECEWISE."
702
- )
703
- self.compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
690
691
# disable cudagraph when enforce eager execution
692
if self.model_config is not None and self.model_config.enforce_eager:
vllm/platforms/cuda.py
+17
@@ -233,6 +233,23 @@ class CudaPlatformBase(Platform):
233
from vllm.config import CUDAGraphMode
234
235
compilation_config = vllm_config.compilation_config
236
+ if compilation_config.cudagraph_mode.has_full_cudagraphs():
237
+ # decode context parallel does not support full cudagraphs
238
+ if parallel_config.decode_context_parallel_size > 1:
239
+ logger.warning_once(
240
+ "Decode context parallel (DCP) is enabled, which is "
241
+ "incompatible with full CUDA graphs. "
242
+ "Overriding cudagraph_mode to PIECEWISE."
243
+ )
244
+ compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
245
+ # prefill context parallel do not support full cudagraphs
246
+ elif parallel_config.prefill_context_parallel_size > 1:
247
+ logger.warning_once(
248
+ "Prefill context parallel (PCP) is enabled, which is "
249
+ "incompatible with full CUDA graphs. "
250
+ "Overriding cudagraph_mode to PIECEWISE."
251
+ )
252
+ compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
253
if (
254
parallel_config.all2all_backend == "deepep_high_throughput"
255
and parallel_config.data_parallel_size > 1
vllm/platforms/rocm.py
+18
@@ -381,6 +381,24 @@ class RocmPlatform(Platform):
381
parallel_config = vllm_config.parallel_config
382
is_eager_execution = compilation_config == CUDAGraphMode.NONE
383
384
+ if compilation_config.cudagraph_mode.has_full_cudagraphs():
385
+ # decode context parallel does not support full cudagraphs
386
+ if parallel_config.decode_context_parallel_size > 1:
387
+ logger.warning_once(
388
+ "Decode context parallel (DCP) is enabled, which is "
389
+ "incompatible with full CUDA graphs. "
390
+ "Overriding cudagraph_mode to PIECEWISE."
391
+ )
392
+ compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
393
+ # prefill context parallel do not support full cudagraphs
394
+ elif parallel_config.prefill_context_parallel_size > 1:
395
+ logger.warning_once(
396
+ "Prefill context parallel (PCP) is enabled, which is "
397
+ "incompatible with full CUDA graphs. "
398
+ "Overriding cudagraph_mode to PIECEWISE."
399
+ )
400
+ compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
401
+
402
use_aiter_rms_norm = rocm_aiter_ops.is_rmsnorm_enabled()
403
404
if cache_config and cache_config.block_size is None: