[Misc] Remove a few dead code paths in DSA (#30973)
This commit is contained in:
@@ -669,8 +669,6 @@ class Envs:
|
|||||||
SGLANG_ENABLE_PCG_DSV2_DUAL_STREAM = EnvBool(False)
|
SGLANG_ENABLE_PCG_DSV2_DUAL_STREAM = EnvBool(False)
|
||||||
SGLANG_DSA_TOPK_BROADCAST = EnvBool(False)
|
SGLANG_DSA_TOPK_BROADCAST = EnvBool(False)
|
||||||
SGLANG_DISABLE_DSA_INDEXER_FUSION = EnvBool(False)
|
SGLANG_DISABLE_DSA_INDEXER_FUSION = EnvBool(False)
|
||||||
SGLANG_USE_FUSED_METADATA_COPY = EnvBool(True)
|
|
||||||
SGLANG_DSA_USE_FUSED_METADATA_GENERATION = EnvBool(True)
|
|
||||||
|
|
||||||
# sgl-kernel
|
# sgl-kernel
|
||||||
SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK = EnvBool(False)
|
SGLANG_SKIP_SGL_KERNEL_VERSION_CHECK = EnvBool(False)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ from typing import TYPE_CHECKING, Optional
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from sglang.srt.environ import envs
|
|
||||||
from sglang.srt.layers.attention.dsa.utils import compute_dsa_seqlens
|
from sglang.srt.layers.attention.dsa.utils import compute_dsa_seqlens
|
||||||
from sglang.srt.layers.attention.utils import seqlens_expand_triton
|
from sglang.srt.layers.attention.utils import seqlens_expand_triton
|
||||||
from sglang.srt.utils import is_cuda, is_hip
|
from sglang.srt.utils import is_cuda, is_hip
|
||||||
@@ -21,9 +20,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
_is_cuda = is_cuda()
|
_is_cuda = is_cuda()
|
||||||
_is_hip = is_hip()
|
_is_hip = is_hip()
|
||||||
_USE_FUSED_METADATA_GENERATION = (
|
|
||||||
envs.SGLANG_DSA_USE_FUSED_METADATA_GENERATION.get() and not _is_hip
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -125,7 +121,7 @@ class DeepseekSparseAttnBackendMTPPrecomputeMixin:
|
|||||||
"""Precompute metadata for normal decode mode."""
|
"""Precompute metadata for normal decode mode."""
|
||||||
max_len = self.decode_cuda_graph_metadata[bs].page_table_1.shape[1]
|
max_len = self.decode_cuda_graph_metadata[bs].page_table_1.shape[1]
|
||||||
|
|
||||||
if _USE_FUSED_METADATA_GENERATION and _is_cuda and not _is_hip:
|
if _is_cuda and not _is_hip:
|
||||||
from sglang.kernels.ops.attention.dsa_metadata import (
|
from sglang.kernels.ops.attention.dsa_metadata import (
|
||||||
fused_dsa_decode_metadata,
|
fused_dsa_decode_metadata,
|
||||||
)
|
)
|
||||||
@@ -244,7 +240,7 @@ class DeepseekSparseAttnBackendMTPPrecomputeMixin:
|
|||||||
max_seqlen_k = self.decode_cuda_graph_metadata[bs].page_table_1.shape[1]
|
max_seqlen_k = self.decode_cuda_graph_metadata[bs].page_table_1.shape[1]
|
||||||
seqlens_expanded_size = bs * self.speculative_num_draft_tokens
|
seqlens_expanded_size = bs * self.speculative_num_draft_tokens
|
||||||
|
|
||||||
if _USE_FUSED_METADATA_GENERATION and _is_cuda and not _is_hip:
|
if _is_cuda and not _is_hip:
|
||||||
from sglang.kernels.ops.attention.dsa_metadata import (
|
from sglang.kernels.ops.attention.dsa_metadata import (
|
||||||
fused_dsa_target_verify_metadata,
|
fused_dsa_target_verify_metadata,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -136,16 +136,6 @@ def _to_2d_context_lens(seqlens_32: torch.Tensor, batch_size: int) -> torch.Tens
|
|||||||
return seqlens_32.contiguous().view(-1, 1)
|
return seqlens_32.contiguous().view(-1, 1)
|
||||||
|
|
||||||
|
|
||||||
# Reuse this workspace buffer across all DSA backend instances
|
|
||||||
|
|
||||||
# Control whether to use fused metadata copy kernel for cuda graph replay (default: enabled)
|
|
||||||
# Set SGLANG_USE_FUSED_METADATA_COPY=0 or false to disable
|
|
||||||
_USE_FUSED_METADATA_COPY = envs.SGLANG_USE_FUSED_METADATA_COPY.get() and not _is_hip
|
|
||||||
_USE_FUSED_METADATA_GENERATION = (
|
|
||||||
envs.SGLANG_DSA_USE_FUSED_METADATA_GENERATION.get() and not _is_hip
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class DSAFlashMLAMetadata:
|
class DSAFlashMLAMetadata:
|
||||||
"""Metadata only needed by FlashMLA"""
|
"""Metadata only needed by FlashMLA"""
|
||||||
@@ -1381,7 +1371,7 @@ class DeepseekSparseAttnBackend(
|
|||||||
# Normal Decode
|
# Normal Decode
|
||||||
max_len = self._graph_page_table_width(metadata)
|
max_len = self._graph_page_table_width(metadata)
|
||||||
|
|
||||||
if _USE_FUSED_METADATA_GENERATION and is_cuda() and not _is_hip:
|
if is_cuda() and not _is_hip:
|
||||||
from sglang.kernels.ops.attention.dsa_metadata import (
|
from sglang.kernels.ops.attention.dsa_metadata import (
|
||||||
fused_dsa_decode_metadata,
|
fused_dsa_decode_metadata,
|
||||||
)
|
)
|
||||||
@@ -1423,7 +1413,7 @@ class DeepseekSparseAttnBackend(
|
|||||||
elif forward_mode.is_target_verify():
|
elif forward_mode.is_target_verify():
|
||||||
max_seqlen_k = self._graph_page_table_width(metadata)
|
max_seqlen_k = self._graph_page_table_width(metadata)
|
||||||
|
|
||||||
if _USE_FUSED_METADATA_GENERATION and is_cuda() and not _is_hip:
|
if is_cuda() and not _is_hip:
|
||||||
from sglang.kernels.ops.attention.dsa_metadata import (
|
from sglang.kernels.ops.attention.dsa_metadata import (
|
||||||
fused_dsa_target_verify_metadata,
|
fused_dsa_target_verify_metadata,
|
||||||
)
|
)
|
||||||
@@ -1521,7 +1511,7 @@ class DeepseekSparseAttnBackend(
|
|||||||
device=self.device,
|
device=self.device,
|
||||||
)
|
)
|
||||||
|
|
||||||
if _USE_FUSED_METADATA_GENERATION and is_cuda() and not _is_hip:
|
if is_cuda() and not _is_hip:
|
||||||
from sglang.kernels.ops.attention.dsa_metadata import (
|
from sglang.kernels.ops.attention.dsa_metadata import (
|
||||||
fused_dsa_draft_extend_metadata,
|
fused_dsa_draft_extend_metadata,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user