[Kernel] Migrate linear-attention, MiniMax-sparse and diffusion kernels to sglang.kernels (RFC #29630, Phase 2.5, 6/7) (#30793)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Xiaoyu Zhang
2026-07-15 11:21:36 +08:00
committed by GitHub
co-authored by Claude Fable 5
parent ba5be86d42
commit c00131ebaa
44 changed files with 238 additions and 168 deletions
@@ -23,6 +23,10 @@ if not (torch.cuda.is_available() and torch.cuda.get_device_capability()[0] >= 1
allow_module_level=True,
)
from sglang.kernels.ops.attention.linear.gdn_blackwell import ( # noqa: E402
chunk_gated_delta_rule_cutedsl,
prepare_metadata_cutedsl,
)
from sglang.srt.layers.attention.fla.fused_recurrent import ( # noqa: E402
fused_recurrent_gated_delta_rule,
)
@@ -30,10 +34,6 @@ from sglang.srt.layers.attention.fla.index import ( # noqa: E402
prepare_chunk_indices,
prepare_chunk_offsets,
)
from sglang.srt.layers.attention.linear.kernels.gdn_blackwell import ( # noqa: E402
chunk_gated_delta_rule_cutedsl,
prepare_metadata_cutedsl,
)
@pytest.mark.parametrize("num_seqs", [1, 5, 257])
@@ -25,15 +25,15 @@ if not (torch.cuda.is_available() and torch.cuda.get_device_capability()[0] >= 1
allow_module_level=True,
)
from sglang.kernels.ops.attention.linear.kda_blackwell import ( # noqa: E402
chunk_kda_cutedsl,
prepare_metadata,
)
from sglang.srt.layers.attention.fla.index import ( # noqa: E402
prepare_chunk_indices,
prepare_chunk_offsets,
)
from sglang.srt.layers.attention.fla.kda import fused_recurrent_kda # noqa: E402
from sglang.srt.layers.attention.linear.kernels.kda_blackwell import ( # noqa: E402
chunk_kda_cutedsl,
prepare_metadata,
)
def _l2norm(x: torch.Tensor) -> torch.Tensor:
@@ -11,7 +11,7 @@ import triton
from sglang.jit_kernel.benchmark import marker
from sglang.jit_kernel.minimax_decode_topk import minimax_decode_topk
from sglang.srt.layers.attention.minimax_sparse_ops.decode.flash_with_topk_idx import (
from sglang.kernels.ops.attention.minimax_sparse.decode.flash_with_topk_idx import (
_topk_index_merge_kernel,
_topk_index_partial_kernel,
)
@@ -20,7 +20,7 @@ from sglang.jit_kernel.minimax_decode_topk import (
minimax_decode_topk,
minimax_decode_topk_page_table,
)
from sglang.srt.layers.attention.minimax_sparse_ops.decode.topk_sparse import (
from sglang.kernels.ops.attention.minimax_sparse.decode.topk_sparse import (
flash_decode_with_gqa_share_sparse,
)
from sglang.test.ci.ci_register import register_cuda_ci