From 925185f9ecd146c125d63af752fdde0846a0b168 Mon Sep 17 00:00:00 2001 From: Qiaolin Yu Date: Fri, 6 Mar 2026 20:01:43 -0800 Subject: [PATCH] Fix flashinfer backend with pcg (#20061) --- python/sglang/srt/layers/attention/flashinfer_backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/layers/attention/flashinfer_backend.py b/python/sglang/srt/layers/attention/flashinfer_backend.py index 39d44b1e6..c51127254 100644 --- a/python/sglang/srt/layers/attention/flashinfer_backend.py +++ b/python/sglang/srt/layers/attention/flashinfer_backend.py @@ -16,6 +16,7 @@ from typing import TYPE_CHECKING, Callable, List, Optional, Union import torch +from sglang.srt.compilation.piecewise_context_manager import is_in_piecewise_cuda_graph from sglang.srt.dllm.config import DllmConfig from sglang.srt.environ import envs from sglang.srt.layers.attention.base_attn_backend import AttentionBackend @@ -479,7 +480,9 @@ class FlashInferAttnBackend(AttentionBackend): use_ragged = False extend_no_prefix = False else: - use_ragged = not self.enable_deterministic + use_ragged = ( + not self.enable_deterministic and not is_in_piecewise_cuda_graph() + ) extend_no_prefix = not any(forward_batch.extend_prefix_lens_cpu) # Process multi-item scoring in attention backend instead of ForwardBatch