[Kernel] Move sgl-kernel under sglang.kernels.aot (#32648)
This commit is contained in:
@@ -294,7 +294,7 @@ class TestVerifyTreeGreedy(CustomTestCase):
|
||||
|
||||
def test_verify_tree_greedy_upstream_golden(self):
|
||||
# Golden fixture ported from the CUDA kernel UT
|
||||
# sgl-kernel/tests/speculative/test_eagle_utils.py::test_verify_tree_greedy
|
||||
# python/sglang/kernels/aot/tests/speculative/test_eagle_utils.py::test_verify_tree_greedy
|
||||
# (device swapped to CPU); expected outputs are the CUDA kernel's.
|
||||
candidates = torch.tensor(
|
||||
[
|
||||
@@ -767,7 +767,7 @@ class TestReconstructIndicesFromTreeMask(CustomTestCase):
|
||||
bs, draft_token_num = 2, 4
|
||||
seq_lens = torch.tensor([12, 5], dtype=torch.int64)
|
||||
# Request 0: root(0) -> {1, 2}, 2 -> 3 (golden case from
|
||||
# sgl-kernel/tests/speculative/test_ngram_utils.py).
|
||||
# python/sglang/kernels/aot/tests/speculative/test_ngram_utils.py).
|
||||
# Request 1: plain chain 0 -> 1 -> 2 -> 3.
|
||||
tree_mask = torch.tensor(
|
||||
# fmt: off
|
||||
|
||||
@@ -221,13 +221,13 @@ def hadamard_transform_mn_ref(x, multiple, scale=1.0):
|
||||
@pytest.mark.parametrize("dtype", [torch.float32, torch.float16, torch.bfloat16])
|
||||
@pytest.mark.parametrize(
|
||||
"dim",
|
||||
# Power-of-2 dims from sgl-kernel/tests/test_hadamard.py (old AOT test)
|
||||
# Power-of-2 dims from python/sglang/kernels/aot/tests/test_hadamard.py (old AOT test)
|
||||
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768],
|
||||
)
|
||||
def test_hadamard_transform(dim, dtype):
|
||||
device = "cuda"
|
||||
|
||||
# Tolerances from sgl-kernel/tests/test_hadamard.py (old AOT test)
|
||||
# Tolerances from python/sglang/kernels/aot/tests/test_hadamard.py (old AOT test)
|
||||
if dtype == torch.float32:
|
||||
rtol, atol = 3e-4, 3e-3
|
||||
elif dtype == torch.bfloat16:
|
||||
@@ -252,7 +252,7 @@ def test_hadamard_transform(dim, dtype):
|
||||
@pytest.mark.parametrize(
|
||||
"dim",
|
||||
# Non-power-of-2 dims to test the padding path
|
||||
# (137 from sgl-kernel/tests/test_hadamard.py, 500/1000 added for coverage)
|
||||
# (137 from python/sglang/kernels/aot/tests/test_hadamard.py, 500/1000 added for coverage)
|
||||
[137, 500, 1000],
|
||||
)
|
||||
def test_hadamard_transform_non_power_of_two(dim, dtype):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Adapted from https://github.com/flashinfer-ai/flashinfer/blob/main/tests/test_sampling.py
|
||||
# and /sgl-workspace/sglang/sgl-kernel/tests/test_sampling.py
|
||||
# and /sgl-workspace/sglang/python/sglang/kernels/aot/tests/test_sampling.py
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
Reference in New Issue
Block a user