refactor: consolidate is_in_ci (jit_kernel, sgl-kernel benchmarks, tests) (#21009)
This commit is contained in:
@@ -5,7 +5,8 @@ import triton
|
||||
import triton.testing
|
||||
|
||||
from sglang.jit_kernel.awq_dequantize import awq_dequantize as jit_awq_dequantize
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
try:
|
||||
from sgl_kernel import awq_dequantize as aot_awq_dequantize
|
||||
|
||||
@@ -7,8 +7,9 @@ from sgl_kernel.scalar_type import scalar_types
|
||||
from sglang.jit_kernel.awq_marlin_repack import (
|
||||
awq_marlin_moe_repack as jit_awq_marlin_moe_repack,
|
||||
)
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.srt.layers.quantization.utils import pack_cols, quantize_weights
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
AOT_AVAILABLE = hasattr(torch.ops.sgl_kernel, "awq_marlin_moe_repack") and hasattr(
|
||||
torch.ops.sgl_kernel.awq_marlin_moe_repack, "default"
|
||||
|
||||
@@ -7,8 +7,9 @@ from sgl_kernel.scalar_type import scalar_types
|
||||
from sglang.jit_kernel.awq_marlin_repack import (
|
||||
awq_marlin_repack as jit_awq_marlin_repack,
|
||||
)
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.srt.layers.quantization.utils import pack_cols, quantize_weights
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
AOT_AVAILABLE = hasattr(torch.ops.sgl_kernel, "awq_marlin_repack") and hasattr(
|
||||
torch.ops.sgl_kernel.awq_marlin_repack, "default"
|
||||
|
||||
@@ -6,9 +6,10 @@ import triton.testing
|
||||
from sgl_kernel import concat_mla_absorb_q as aot_absorb_q
|
||||
from sgl_kernel import concat_mla_k as aot_k
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.concat_mla import concat_mla_absorb_q as jit_absorb_q
|
||||
from sglang.jit_kernel.concat_mla import concat_mla_k as jit_k
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
IS_CI = is_in_ci()
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@ import triton
|
||||
import triton.testing
|
||||
from flashinfer import fused_add_rmsnorm as fi_fused_add_rmsnorm
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.norm import fused_add_rmsnorm as jit_fused_add_rmsnorm
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
IS_CI = is_in_ci()
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ import torch
|
||||
import triton
|
||||
import triton.testing
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark_no_cudagraph
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark_no_cudagraph
|
||||
from sglang.multimodal_gen.runtime.layers.layernorm import (
|
||||
LayerNormScaleShift,
|
||||
RMSNormScaleShift,
|
||||
ScaleResidualLayerNormScaleShift,
|
||||
ScaleResidualRMSNormScaleShift,
|
||||
)
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
if is_in_ci():
|
||||
B_RANGE, S_RANGE, D_RANGE = [1], [128], [1024]
|
||||
|
||||
@@ -3,10 +3,11 @@ import triton
|
||||
import triton.testing
|
||||
from sgl_kernel.scalar_type import scalar_types
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.gptq_marlin import gptq_marlin_gemm as jit_gptq_marlin_gemm
|
||||
from sglang.srt.layers.quantization.marlin_utils import marlin_make_workspace
|
||||
from sglang.test.test_marlin_utils import marlin_quantize
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
AOT_AVAILABLE = hasattr(torch.ops.sgl_kernel, "gptq_marlin_gemm") and hasattr(
|
||||
torch.ops.sgl_kernel.gptq_marlin_gemm, "default"
|
||||
|
||||
@@ -3,9 +3,10 @@ import triton
|
||||
import triton.testing
|
||||
from sgl_kernel.scalar_type import scalar_types
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.gptq_marlin_repack import gptq_marlin_repack as jit_fn
|
||||
from sglang.srt.layers.quantization.utils import gptq_quantize_weights, pack_rows
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
AOT_AVAILABLE = hasattr(torch.ops.sgl_kernel, "gptq_marlin_repack") and hasattr(
|
||||
torch.ops.sgl_kernel.gptq_marlin_repack, "default"
|
||||
|
||||
@@ -3,10 +3,11 @@ import triton
|
||||
import triton.testing
|
||||
from sgl_kernel.scalar_type import scalar_types
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.moe_wna16_marlin import moe_wna16_marlin_gemm as jit_fn
|
||||
from sglang.srt.layers.moe.fused_moe_triton import moe_align_block_size
|
||||
from sglang.test.test_marlin_utils import marlin_quantize
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
AOT_AVAILABLE = hasattr(torch.ops.sgl_kernel, "moe_wna16_marlin_gemm") and hasattr(
|
||||
torch.ops.sgl_kernel.moe_wna16_marlin_gemm, "default"
|
||||
|
||||
@@ -6,9 +6,10 @@ import triton.testing
|
||||
from flashinfer.norm import fused_add_rmsnorm as fi_fused_add_rmsnorm
|
||||
from flashinfer.norm import rmsnorm as fi_rmsnorm
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.norm import fused_add_rmsnorm as jit_fused_add_rmsnorm
|
||||
from sglang.jit_kernel.norm import rmsnorm as jit_rmsnorm
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
IS_CI = is_in_ci()
|
||||
|
||||
|
||||
@@ -15,12 +15,13 @@ from typing import Callable
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import DEFAULT_DEVICE, is_in_ci
|
||||
from sglang.jit_kernel.benchmark.utils import DEFAULT_DEVICE
|
||||
from sglang.jit_kernel.diffusion.triton.norm import norm_infer, rms_norm_fn
|
||||
from sglang.jit_kernel.diffusion.triton.rmsnorm_onepass import triton_one_pass_rms_norm
|
||||
from sglang.jit_kernel.norm import fused_add_rmsnorm as jit_fused_add_rmsnorm
|
||||
from sglang.jit_kernel.norm import rmsnorm as jit_rmsnorm
|
||||
from sglang.jit_kernel.utils import KERNEL_PATH
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
os.environ.setdefault("FLASHINFER_DISABLE_VERSION_CHECK", "1")
|
||||
|
||||
|
||||
@@ -5,10 +5,7 @@ import torch
|
||||
import triton
|
||||
from sgl_kernel.test_utils import create_per_token_group_quant_test_data
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import (
|
||||
get_benchmark_range,
|
||||
is_in_ci,
|
||||
)
|
||||
from sglang.jit_kernel.benchmark.utils import get_benchmark_range
|
||||
from sglang.jit_kernel.per_token_group_quant_8bit import (
|
||||
per_token_group_quant_8bit as sglang_per_token_group_quant_8bit,
|
||||
)
|
||||
@@ -20,6 +17,7 @@ from sglang.srt.layers.quantization.fp8_kernel import (
|
||||
)
|
||||
from sglang.srt.utils import is_hip
|
||||
from sglang.srt.utils.bench_utils import bench_kineto
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
IS_CI = is_in_ci()
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ import triton
|
||||
import triton.testing
|
||||
from sgl_kernel import rmsnorm
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark
|
||||
from sglang.jit_kernel.norm import fused_inplace_qknorm_across_heads
|
||||
from sglang.srt.utils import get_current_device_stream_fast
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
IS_CI = is_in_ci()
|
||||
|
||||
|
||||
@@ -3,13 +3,14 @@ from typing import Tuple
|
||||
import torch
|
||||
import triton.testing
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark_no_cudagraph
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark_no_cudagraph
|
||||
from sglang.jit_kernel.diffusion.triton.norm import norm_infer
|
||||
from sglang.jit_kernel.diffusion.triton.scale_shift import (
|
||||
fuse_layernorm_scale_shift_gate_select01_kernel,
|
||||
fuse_residual_layernorm_scale_shift_gate_select01_kernel,
|
||||
fuse_scale_shift_gate_select01_kernel,
|
||||
)
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
if is_in_ci():
|
||||
B_RANGE, S_RANGE, D_RANGE = [1], [128], [3072]
|
||||
|
||||
@@ -5,7 +5,8 @@ import torch
|
||||
import triton
|
||||
import triton.testing
|
||||
|
||||
from sglang.jit_kernel.benchmark.utils import is_in_ci, run_benchmark_no_cudagraph
|
||||
from sglang.jit_kernel.benchmark.utils import run_benchmark_no_cudagraph
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
|
||||
def torch_top_k_renorm_probs(probs, top_k):
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Callable, List, Tuple
|
||||
import torch
|
||||
import triton.testing
|
||||
|
||||
from sglang.jit_kernel.utils import is_in_ci as jit_kernel_is_in_ci
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
# Common constants
|
||||
DEFAULT_DTYPE = torch.bfloat16
|
||||
@@ -13,11 +13,6 @@ DEFAULT_DEVICE = "cuda"
|
||||
DEFAULT_QUANTILES = [0.5, 0.2, 0.8]
|
||||
|
||||
|
||||
def is_in_ci() -> bool:
|
||||
"""Check if running in CI environment."""
|
||||
return jit_kernel_is_in_ci()
|
||||
|
||||
|
||||
def get_benchmark_range(full_range: List, ci_range: List) -> List:
|
||||
"""Return appropriate benchmark range based on CI environment."""
|
||||
return ci_range if is_in_ci() else full_range
|
||||
|
||||
@@ -7,6 +7,8 @@ from typing import TYPE_CHECKING, Any, Callable, List, Tuple, TypeAlias, TypeVar
|
||||
|
||||
import torch
|
||||
|
||||
from sglang.utils import is_in_ci
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tvm_ffi import Module
|
||||
|
||||
@@ -14,11 +16,6 @@ F = TypeVar("F", bound=Callable[..., Any])
|
||||
_FULL_TEST_ENV_VAR = "SGLANG_JIT_KERNEL_RUN_FULL_TESTS"
|
||||
|
||||
|
||||
def is_in_ci() -> bool:
|
||||
ci_env_vars = ("SGLANG_IS_IN_CI", "CI", "GITHUB_ACTIONS")
|
||||
return any(os.getenv(env_var, "false").lower() == "true" for env_var in ci_env_vars)
|
||||
|
||||
|
||||
def should_run_full_tests() -> bool:
|
||||
return os.getenv(_FULL_TEST_ENV_VAR, "false").lower() == "true"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user