[Kernel] Introduce sglang.kernels namespace and migrate scattered triton_ops kernels (RFC #29630, Phase 2) (#30044)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Xiaoyu Zhang
2026-07-10 21:41:08 +08:00
committed by GitHub
co-authored by Claude Opus 4.8
parent e9493a015c
commit 6ed9843b57
161 changed files with 3329 additions and 459 deletions
@@ -3,10 +3,10 @@ import argparse
import torch
import triton
from sglang.srt.layers.attention.triton_ops.decode_attention import (
from sglang.kernels.ops.attention.decode_attention import (
decode_attention_fwd_grouped,
)
from sglang.srt.layers.attention.triton_ops.extend_attention import extend_attention_fwd
from sglang.kernels.ops.attention.extend_attention import extend_attention_fwd
# gpt oss
head_num = 64
@@ -6,8 +6,8 @@ import torch
import torch.utils.benchmark as benchmark
from flashinfer import BatchDecodeWithPagedKVCacheWrapper
from sglang.kernels.ops.attention.decode_attention import decode_attention_fwd
from sglang.srt.layers.attention.flashinfer_backend import should_use_tensor_core
from sglang.srt.layers.attention.triton_ops.decode_attention import decode_attention_fwd
def benchmark_forward(
@@ -58,9 +58,9 @@ from typing import Any, Dict, List, Optional
import torch
import triton
from sglang.srt.lora.triton_ops.chunked_sgmv_expand import _chunked_lora_expand_kernel
from sglang.srt.lora.triton_ops.chunked_sgmv_shrink import _chunked_lora_shrink_kernel
from sglang.srt.lora.triton_ops.lora_tuning_config import (
from sglang.kernels.ops.gemm.chunked_sgmv_expand import _chunked_lora_expand_kernel
from sglang.kernels.ops.gemm.chunked_sgmv_shrink import _chunked_lora_shrink_kernel
from sglang.kernels.ops.gemm.lora_tuning_config import (
DEFAULT_EXPAND_CONFIG,
DEFAULT_SHRINK_CONFIG,
get_lora_config_file_name,
@@ -362,9 +362,9 @@ def save_config(
"..",
"python",
"sglang",
"srt",
"lora",
"triton_ops",
"kernels",
"ops",
"gemm",
"csgmv_configs",
version_dir,
)
@@ -5,7 +5,7 @@ import torch.nn.functional as F
import triton.testing as tt
from sglang.benchmark.bench_utils import run_bench
from sglang.srt.layers.attention.triton_ops.extend_attention import extend_attention_fwd
from sglang.kernels.ops.attention.extend_attention import extend_attention_fwd
def extend_attention_fwd_torch(
@@ -19,10 +19,10 @@ import argparse
import torch
import triton
from sglang.srt.layers.attention.triton_ops.extend_attention import (
from sglang.kernels.ops.attention.extend_attention import (
extend_attention_fwd,
)
from sglang.srt.layers.attention.triton_ops.verify_splitkv import verify_splitkv_fwd
from sglang.kernels.ops.attention.verify_splitkv import verify_splitkv_fwd
from sglang.srt.utils import is_gfx95_supported