From 306ccf6f57bcd6efc9edc626e39a9673e22cb9d6 Mon Sep 17 00:00:00 2001 From: Yuxuan Zhou <43881388+ZhouYuxuanYX@users.noreply.github.com> Date: Tue, 20 Oct 2026 18:05:42 +0800 Subject: [PATCH] [Perf] spec: Let the FlashAttention backend capture the draft-extend CUDA graph (#40762) --- python/sglang/srt/speculative/eagle_worker_v2.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/sglang/srt/speculative/eagle_worker_v2.py b/python/sglang/srt/speculative/eagle_worker_v2.py index a91fca4691..dc73ee46d6 100644 --- a/python/sglang/srt/speculative/eagle_worker_v2.py +++ b/python/sglang/srt/speculative/eagle_worker_v2.py @@ -554,6 +554,13 @@ class EagleDraftWorker(EagleDraftWorkerBase): graph_supported_backend_types.append(DeepseekV4AttnBackend) if _is_cuda: + # FlashAttention is CUDA-only here; import lazily so MUSA and NPU + # builds don't pull sgl_kernel in at import time. + from sglang.srt.layers.attention.flashattention_backend import ( + FlashAttentionBackend, + ) + + graph_supported_backend_types.append(FlashAttentionBackend) # FlashMLA is CUDA-only; import lazily so CPU builds don't pull # sgl_kernel.flash_mla at import time. from sglang.srt.layers.attention.flashmla_backend import FlashMLABackend