[Intel GPU] xpu_piecewise: fall back to eager when PCG capture stream is unset (#30235)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Ma Mingfei <mingfei.ma@intel.com>
This commit is contained in:
Chetan Kumar Verma
2026-07-09 10:21:43 +08:00
committed by GitHub
co-authored by Claude Opus 4.8 gemini-code-assist[bot] Ma Mingfei
parent 2b3d9ad375
commit 6bce72d968
@@ -13,6 +13,7 @@ from sglang.srt.compilation.cuda_piecewise_backend import (
CUDAPiecewiseBackend,
weak_ref_tensors,
)
from sglang.srt.utils.common import print_warning_once
class XPUPiecewiseBackend(CUDAPiecewiseBackend):
@@ -57,10 +58,22 @@ class XPUPiecewiseBackend(CUDAPiecewiseBackend):
entry.num_finished_warmup += 1
return entry.runnable(*args)
# During normal capture (PiecewiseCudaGraphRunner.capture()),
# set_pcg_capture_stream() guarantees a valid stream. However,
# Dynamo may silently recompile on serving batches whose token
# count exceeds the captured range (e.g. chunked prefill running
# at 8192 tokens when the capture grid tops out at 512). The
# recompiled backend instance has no capture stream; fall back to
# eager for that sub-graph instead of crashing the scheduler.
# Mirrors the HIP fallback in CUDAPiecewiseBackend.__call__.
stream = get_pcg_capture_stream()
assert (
stream is not None
), "PCG capture stream is not set, please check if runtime recompilation happened"
if stream is None:
print_warning_once(
"PCG capture stream is not set; likely a Dynamo runtime "
"recompilation. Falling back to eager execution for this "
"subgraph."
)
return entry.runnable(*args)
if self.compile_config.get_enable_debug_mode():
entry.input_addresses = [