[Kernel] Import flash_mla kernels from sglang kernel for deepseek v4 (#26499)
This commit is contained in:
@@ -58,7 +58,7 @@ from sglang.srt.speculative.spec_info import SpecInput
|
||||
from sglang.srt.utils import ceil_align
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from flash_mla.flash_mla_interface import FlashMLASchedMeta
|
||||
from sgl_kernel.flash_mla import FlashMLASchedMeta
|
||||
|
||||
from sglang.srt.layers.radix_attention import RadixAttention
|
||||
from sglang.srt.model_executor.model_runner import ModelRunner
|
||||
@@ -82,7 +82,7 @@ def _pad_last_dim(x: T, multiples_of: int = PAGE_INDEX_ALIGNED_SIZE) -> T:
|
||||
|
||||
|
||||
def _create_flashmla_metadata():
|
||||
import flash_mla
|
||||
import sgl_kernel.flash_mla as flash_mla
|
||||
|
||||
return flash_mla.get_mla_metadata()[0]
|
||||
|
||||
@@ -1045,7 +1045,7 @@ class DeepseekV4AttnBackend(
|
||||
extra_indices.shape[-1] % 64 == 0
|
||||
), f"{extra_indices.shape=}'s last dimension is not aligned to 64"
|
||||
|
||||
import flash_mla
|
||||
import sgl_kernel.flash_mla as flash_mla
|
||||
|
||||
o = flash_mla.flash_mla_with_kvcache(
|
||||
q=q,
|
||||
|
||||
@@ -55,7 +55,7 @@ from sglang.srt.speculative.spec_info import SpecInput
|
||||
from sglang.srt.utils import ceil_align
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from flash_mla.flash_mla_interface import FlashMLASchedMeta
|
||||
from sgl_kernel.flash_mla import FlashMLASchedMeta
|
||||
|
||||
from sglang.srt.layers.radix_attention import RadixAttention
|
||||
from sglang.srt.model_executor.model_runner import ModelRunner
|
||||
@@ -83,7 +83,7 @@ def _create_flashmla_metadata():
|
||||
|
||||
if is_hip():
|
||||
return None
|
||||
import flash_mla
|
||||
import sgl_kernel.flash_mla as flash_mla
|
||||
|
||||
return flash_mla.get_mla_metadata()[0]
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ def flash_mla_with_kvcache_entrypoint(backend: str, **kwargs):
|
||||
|
||||
backend = os.environ.get("SGLANG_HACK_FLASHMLA_BACKEND", "tilelang")
|
||||
else:
|
||||
import flash_mla
|
||||
import sgl_kernel.flash_mla as flash_mla
|
||||
|
||||
if backend == "comparison":
|
||||
pack_ref, pack_fast_via_tester = flash_mla_with_kvcache_entrypoint(
|
||||
|
||||
Reference in New Issue
Block a user