Reland Cute-DSL FP4 dense GEMM (#23590)
Co-authored-by: b8zhong <b8zhong@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import logging
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sglang.srt.utils.common import is_sm120_supported
|
||||
from sglang.srt.utils.common import is_sm100_supported, is_sm120_supported
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sglang.srt.server_args import ServerArgs
|
||||
@@ -18,6 +18,7 @@ class Fp4GemmRunnerBackend(Enum):
|
||||
AUTO = "auto"
|
||||
CUTLASS = "cutlass"
|
||||
FLASHINFER_CUDNN = "flashinfer_cudnn"
|
||||
FLASHINFER_CUTEDSL = "flashinfer_cutedsl"
|
||||
FLASHINFER_CUTLASS = "flashinfer_cutlass"
|
||||
FLASHINFER_TRTLLM = "flashinfer_trtllm"
|
||||
|
||||
@@ -36,6 +37,9 @@ class Fp4GemmRunnerBackend(Enum):
|
||||
def is_flashinfer_trtllm(self) -> bool:
|
||||
return self == Fp4GemmRunnerBackend.FLASHINFER_TRTLLM
|
||||
|
||||
def is_flashinfer_cutedsl(self) -> bool:
|
||||
return self == Fp4GemmRunnerBackend.FLASHINFER_CUTEDSL
|
||||
|
||||
def is_flashinfer(self) -> bool:
|
||||
return self.value.startswith("flashinfer_")
|
||||
|
||||
@@ -47,7 +51,10 @@ class Fp4GemmRunnerBackend(Enum):
|
||||
'flashinfer_trtllm' -> 'trtllm'
|
||||
'flashinfer_cutlass' -> 'cutlass'
|
||||
'flashinfer_cudnn' -> 'cudnn'
|
||||
'flashinfer_cutedsl' -> 'cute-dsl'
|
||||
"""
|
||||
if self == Fp4GemmRunnerBackend.FLASHINFER_CUTEDSL:
|
||||
return "cute-dsl"
|
||||
if self.value.startswith("flashinfer_"):
|
||||
return self.value.removeprefix("flashinfer_")
|
||||
else:
|
||||
@@ -68,10 +75,8 @@ def initialize_fp4_gemm_config(server_args: ServerArgs) -> None:
|
||||
# heterogeneous batches on SM120 (Blackwell). cudnn is stable.
|
||||
# See: https://github.com/sgl-project/sglang/issues/20043
|
||||
backend = "flashinfer_cudnn"
|
||||
logger.info(
|
||||
"SM120 (Blackwell) detected: auto-selecting "
|
||||
"fp4-gemm-backend=flashinfer_cudnn"
|
||||
)
|
||||
elif is_sm100_supported():
|
||||
backend = "flashinfer_cutedsl"
|
||||
else:
|
||||
backend = "flashinfer_cutlass"
|
||||
|
||||
|
||||
@@ -220,6 +220,7 @@ FP4_GEMM_RUNNER_BACKEND_CHOICES = [
|
||||
"auto",
|
||||
"cutlass",
|
||||
"flashinfer_cudnn",
|
||||
"flashinfer_cutedsl",
|
||||
"flashinfer_cutlass",
|
||||
"flashinfer_trtllm",
|
||||
]
|
||||
@@ -5482,10 +5483,11 @@ class ServerArgs:
|
||||
default=ServerArgs.fp4_gemm_runner_backend,
|
||||
dest="fp4_gemm_runner_backend",
|
||||
help="Choose the runner backend for NVFP4 GEMM operations. "
|
||||
"Options: 'auto' (default; selects flashinfer_cudnn on SM120, flashinfer_cutlass otherwise), "
|
||||
"Options: 'auto' (default; selects flashinfer_cudnn on SM120, flashinfer_cutedsl on SM100, flashinfer_cutlass otherwise), "
|
||||
"'cutlass' (SGLang CUTLASS kernel), "
|
||||
"'flashinfer_cutlass' (FlashInfer CUTLASS backend), "
|
||||
"'flashinfer_cudnn' (FlashInfer cuDNN backend, optimal on CUDA 13+ with cuDNN 9.15+), "
|
||||
"'flashinfer_cutedsl' (FlashInfer CuTe DSL backend), "
|
||||
"'flashinfer_trtllm' (FlashInfer TensorRT-LLM backend, requires different weight preparation with shuffling). ",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -1229,6 +1229,11 @@ def configure_logger(server_args, prefix: str = ""):
|
||||
for name in ("httpx", "httpcore"):
|
||||
logging.getLogger(name).setLevel(logging.WARNING)
|
||||
|
||||
if is_flashinfer_available():
|
||||
from flashinfer.jit.core import logger as flashinfer_logger
|
||||
|
||||
flashinfer_logger.setLevel(logging.ERROR)
|
||||
|
||||
|
||||
# source: https://github.com/vllm-project/vllm/blob/93b38bea5dd03e1b140ca997dfaadef86f8f1855/vllm/lora/utils.py#L9
|
||||
def replace_submodule(
|
||||
|
||||
Reference in New Issue
Block a user