__init__.py 1.24 KB
Newer Older
1
2
3
import ctypes
import os

4
5
import torch

6
7
8
9
10
11
if os.path.exists("/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.12"):
    ctypes.CDLL(
        "/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.12",
        mode=ctypes.RTLD_GLOBAL,
    )

12
13
14
15
from sgl_kernel import common_ops
from sgl_kernel.allreduce import *
from sgl_kernel.attention import lightning_attention_decode
from sgl_kernel.elementwise import (
16
17
18
19
20
21
22
23
24
    apply_rope_with_cos_sin_cache_inplace,
    fused_add_rmsnorm,
    gelu_and_mul,
    gelu_tanh_and_mul,
    gemma_fused_add_rmsnorm,
    gemma_rmsnorm,
    rmsnorm,
    silu_and_mul,
)
25
from sgl_kernel.gemm import (
26
    awq_dequantize,
27
28
29
30
31
    bmm_fp8,
    cublas_grouped_gemm,
    fp8_blockwise_scaled_mm,
    fp8_scaled_mm,
    int8_scaled_mm,
32
    sgl_per_tensor_quant_fp8,
33
    sgl_per_token_group_quant_fp8,
34
    sgl_per_token_quant_fp8,
35
)
36
from sgl_kernel.moe import moe_align_block_size, topk_softmax
37
from sgl_kernel.sampling import (
38
39
40
41
42
43
    min_p_sampling_from_probs,
    top_k_renorm_prob,
    top_k_top_p_sampling_from_probs,
    top_p_renorm_prob,
    top_p_sampling_from_probs,
)
44
from sgl_kernel.speculative import (
45
46
47
48
    build_tree_kernel,
    build_tree_kernel_efficient,
    tree_speculative_sampling_target_only,
)
Lianmin Zheng's avatar
Lianmin Zheng committed
49
from sgl_kernel.version import __version__