Fix capture-mode detection during breakable CUDA graph capture (#29866)

This commit is contained in:
cctry
2026-07-01 22:12:56 -07:00
committed by GitHub
parent e88645d65f
commit 80ac11eda3
@@ -24,6 +24,10 @@ from typing import Optional
import torch
from sglang.srt.model_executor.runner_backend_utils.breakable_cuda_graph.context import (
is_in_breakable_cuda_graph,
)
# Detect whether the current forward pass is in capture mode.
is_capture_mode = False
@@ -33,7 +37,7 @@ _capture_lora_variant: Optional[str] = None
def get_is_capture_mode() -> bool:
return is_capture_mode
return is_capture_mode or is_in_breakable_cuda_graph()
def compile_in_capture_mode(func):