Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/sglang/srt/speculative/eagle_worker_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from sglang.srt.hardware_backend.npu.graph_runner.eagle_draft_npu_graph_runner import (
EAGLEDraftNpuGraphRunner,
)
from sglang.srt.layers.attention.triton_backend import TritonMultiStepDraftBackend
from sglang.srt.layers.attention.triton_backend import TritonAttnBackend
from sglang.srt.layers.attention.trtllm_mla_backend import (
TRTLLMMLAMultiStepDraftBackend,
TRTLLMMLABackend,
)
from sglang.srt.layers.dp_attention import get_attention_tp_group
from sglang.srt.layers.logits_processor import LogitsProcessorOutput
Expand Down Expand Up @@ -294,8 +294,8 @@ def init_cuda_graphs(self):
)

supports_cuda_draft_extend_graph = _is_cuda and (
isinstance(self.draft_attn_backend, TritonMultiStepDraftBackend)
or isinstance(self.draft_attn_backend, TRTLLMMLAMultiStepDraftBackend)
isinstance(self.draft_extend_attn_backend, TritonAttnBackend)
or isinstance(self.draft_extend_attn_backend, TRTLLMMLABackend)
Comment on lines +297 to +298
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change correctly uses self.draft_extend_attn_backend to determine CUDA graph support for the draft extend step.

A similar issue seems to exist for HIP support on lines 292-293, which still uses self.draft_attn_backend. This will likely fail when spec_step=1 as self.draft_attn_backend will be None.

To ensure consistency and fix the potential bug for HIP, consider applying a similar change to the HIP-specific code block:

        supports_hip_aiter_draft_extend_graph = False
        if _is_hip:
            # Keep import local so non-HIP environments do not require aiter.
            from sglang.srt.layers.attention.aiter_backend import (
                AiterAttnBackend,
            )

            supports_hip_aiter_draft_extend_graph = isinstance(
                self.draft_extend_attn_backend, AiterAttnBackend
            )

)
# Capture extend
# TODO: support draft extend cuda graph for more attention backends
Expand Down
Loading