From bfd9bb2e038d9c09c2be3b18a2d3cc90b9a38417 Mon Sep 17 00:00:00 2001 From: AMD-yanfeiwang Date: Sun, 4 Oct 2026 03:14:28 +0800 Subject: [PATCH] fix(cuda-graph): remove unnecessary CP batch alignment (#40543) (cherry picked from commit 3dc7f4b816707781716f30446433467c66c4c0ed) --- python/sglang/srt/utils/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/utils/common.py b/python/sglang/srt/utils/common.py index f8d6ec80b1..2c21e384cb 100644 --- a/python/sglang/srt/utils/common.py +++ b/python/sglang/srt/utils/common.py @@ -4052,7 +4052,8 @@ def get_cuda_graph_batch_size_alignment() -> int: alignment *= 2 if require_gathered_buffer(): alignment *= get_parallel().attn_tp_size - if alignment % get_parallel().attn_cp_size != 0: + # TODO: unverified on NVIDIA; drop the gate once validated on CUDA. + if not is_hip() and alignment % get_parallel().attn_cp_size != 0: alignment *= get_parallel().attn_cp_size return alignment