repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
sglang
test/registered/sessions/test_session_control.py
.py
""" Usage: python3 -m unittest test_session_control.TestSessionControl.test_session_control python3 -m unittest test_session_control.TestSessionControl.test_session_control_with_branching python3 -m unittest test_session_control.TestSessionControl.test_session_control_backtrack_with_abort python3 -m unittest test_sessi...
791
29,573
sglang
test/registered/function_call/test_kimik2_detector.py
.py
import json import unittest from sglang.srt.entrypoints.openai.protocol import Function, Tool from sglang.srt.function_call.kimik2_detector import ( KimiK2Detector as KimiK2FuncDetector, ) from sglang.srt.function_call.kimik2_detector import ( _strip_special_tokens, ) from sglang.srt.parser.reasoning_parser im...
1,399
56,535
sglang
test/registered/function_call/test_kimik3_detector.py
.py
import json import sys import pytest from sglang.srt.entrypoints.openai.protocol import Function, Tool from sglang.srt.function_call.core_types import ToolCallItem from sglang.srt.function_call.function_call_parser import FunctionCallParser from sglang.srt.function_call.kimik3_detector import KimiK3Detector from sgla...
222
6,988
sglang
test/registered/reasoning/test_reasoning.py
.py
import json import unittest import requests from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.kits.reasoning_kit import ( ReasoningTokenUsageMixin, SeparateReasoningMixin, ) from sglang.test.test_utils import ( DEFAULT_...
191
7,015
sglang
test/registered/moe/test_triton_fused_moe.py
.py
import unittest import torch from tqdm import tqdm from sglang.srt.layers.activation import SiluAndMul from sglang.srt.layers.moe import MoeRunner, MoeRunnerBackend, MoeRunnerConfig from sglang.srt.layers.moe.moe_runner.triton_kernels import TritonKernelsQuantInfo from sglang.srt.layers.moe.token_dispatcher.standard ...
196
6,733
sglang
test/registered/moe/test_flashinfer_a2a_cutedsl_v2.py
.py
"""Test CuteDSL FP4 MoE + FlashInfer alltoall on B200 with DP attention. Config: Qwen3.5-397B-A17B-NVFP4, B200x4, EP=4 DP=4, cutedsl + flashinfer a2a. """ import unittest from types import SimpleNamespace import torch from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cud...
90
2,515
sglang
test/registered/moe/test_hybrid_dp_ep_tp_mtp.py
.py
# Comprehensive test for hybrid parallelism (DP/TP attention, DP/TP Dense FFN, TP/EP Sparse FFN, DP/VP LM head) plus speculative decoding. import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.run_eval ...
2,734
75,349
sglang
test/registered/moe/test_moe_ep.py
.py
import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( DEFAULT_MODEL_NAME_FOR_TEST_MLA, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT...
59
1,549
sglang
test/registered/moe/test_hpc_ops_moe.py
.py
"""Numerical tests for the HPC-Ops FP8 MoE runner backend. Compares the hpc_ops fused func (hpc.fuse_moe_blockwise) against the triton fused_experts reference and an fp32 exact reference on realistic blockwise FP8 quantized weights. Skipped when HPC-Ops (https://github.com/Tencent/hpc-ops) is not installed or the GPU ...
215
8,696
sglang
test/registered/moe/test_fused_append_remap_per_rank_shared_slots.py
.py
"""Unit tests for fused append + per-rank shared-slot remap. Covers ``fused_append_remap_shared_experts_deepep``, which collapses ``fused_append_shared_experts()`` followed by ``remap_topk_for_per_rank_shared_slots()`` into a single Triton launch on the per-rank shared-slot path. The kernel is GPU-only (Triton), so th...
188
7,527
sglang
test/registered/moe/test_topk_renormalize_degenerate.py
.py
"""Regression test: top-k renormalization must not emit NaN for degenerate tokens. With sigmoid scoring plus a selection bias (DeepSeek noaux_tc-style gates), experts are selected by `sigmoid(logits) + bias` but weighted by the raw sigmoid. A token whose router logits are all deeply negative (< ~-88) has every gathere...
142
5,325
sglang
test/registered/moe/test_fused_moe.py
.py
import unittest import torch from tqdm import tqdm from sglang.kernels.ops.quantization.fp8_kernel import is_fp8_fnuz from sglang.srt.layers.activation import SiluAndMul from sglang.srt.layers.moe.moe_runner import MoeRunnerConfig from sglang.srt.layers.moe.moe_runner.triton_utils.fused_moe import fused_moe from sgla...
278
10,328
sglang
test/registered/moe/test_torch_compile_moe.py
.py
import time import unittest from types import SimpleNamespace import requests from sglang.srt.utils import is_cuda, kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( DEFAULT_SMALL_MOE_MODEL_NAME...
87
2,551
sglang
test/registered/moe/test_glm4_moe_models.py
.py
import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, ...
53
1,371
sglang
test/registered/moe/test_topk_padded_region.py
.py
import unittest import torch import sglang.srt.layers.moe.topk as topk_mod from sglang.srt.layers.moe.topk import ( TopKConfig, _can_fuse_padded_region, _fill_padded_rows, _mask_topk_ids_padded_region, _post_process_topk_ids, _zero_topk_weights_padded_region, ) from sglang.srt.utils import is_...
253
10,534
sglang
test/registered/moe/test_cutedsl_moe.py
.py
# SPDX-License-Identifier: Apache-2.0 import unittest import torch from flashinfer import fp4_quantize, scaled_fp4_grouped_quantize from torch.nn import functional as F from sglang.srt.layers.activation import SiluAndMul from sglang.srt.layers.moe.flashinfer_cutedsl_moe import flashinfer_cutedsl_moe_masked from sglan...
1,268
48,769
sglang
test/registered/moe/test_triton_moe_channel_fp8_kernel.py
.py
import itertools import unittest import torch from sglang.kernels.ops.quantization.fp8_kernel import scaled_fp8_quant from sglang.srt.layers.activation import SiluAndMul from sglang.srt.layers.moe.moe_runner.triton_utils.fused_moe import fused_moe from sglang.srt.layers.moe.topk import TopKConfig, select_experts from...
188
6,447
sglang
test/registered/moe/test_moe_ep_extra.py
.py
"""Extra: TP=2 EP=2 with FP8 + DeepGEMM MoE backend. Sibling per-commit file (test_moe_ep.py) keeps the baseline TP=2 EP=2 variant. """ import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.run_eval im...
67
1,732
sglang
test/registered/moe/test_zero_experts.py
.py
import unittest import torch from sglang.kernels.ops.moe.ep_moe_kernels import zero_experts_compute_triton from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.test_utils import CustomTestCase register_cuda_ci(est_time=5, stage="base-b", runner_config="1-gpu-small") register_amd_...
68
2,397
sglang
test/registered/moe/test_hash_topk.py
.py
import sys from types import SimpleNamespace import pytest import torch from sglang.srt.eplb.expert_location_dispatch import ExpertLocationDispatchInfo from sglang.srt.layers.moe import hash_topk as hash_topk_module from sglang.srt.layers.moe.hash_topk import HashTopK from sglang.srt.layers.moe.topk import ( Stan...
144
4,754
sglang
test/registered/moe/test_fused_append_shared_experts.py
.py
"""Unit tests for ``fused_append_shared_experts_with_weights``. Covers PR #28658, which folds the shared-expert ``sigmoid`` activation and the bf16->fp32 cast into the append kernel's prologue (``apply_sigmoid=True``), and PR #28666, which additionally folds the ``shared_expert_gate`` GEMV into the kernel (``fuse_gate...
302
13,317
sglang
test/registered/moe/test_flashinfer_a2a_cutlass.py
.py
"""Test FlashInfer Cutlass BF16 MoE + FlashInfer alltoall on B200 with DP attention. Config: Qwen3-30B-A3B, B200x4, EP=4 DP=4, flashinfer cutlass + flashinfer a2a. """ import os import unittest from types import SimpleNamespace import torch from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_regis...
94
2,597
sglang
test/registered/models_e2e/test_minimax_m25_basic.py
.py
import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.send_one import BenchArgs, send_one_prompt from sglang.test.test_utils imp...
86
2,545
sglang
test/registered/models_e2e/test_mimo_v2.py
.py
import unittest from sglang.srt.environ import envs from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.server_fixtures.mmmu_fixture import MMMUServerBase register_cuda_ci(est_time=400, stage="base-c", runner_config="8-gpu-h200") MIMO_V2_...
61
1,445
sglang
test/registered/models_e2e/test_dsa_glm52_dp_mtp.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.spec_decoding_kit import SpecDecodingMixin from sglang.test.server_fixtures.dsa_mtp_fixture import ( DsaMtpEvalConfigDefaults, DsaMtpServerBase, ) register_cu...
29
675
sglang
test/registered/models_e2e/test_nvidia_nemotron_3_super_bf16_mtp.py
.py
import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, ...
85
2,181
sglang
test/registered/models_e2e/test_step3p5_flash_chain_mtp.py
.py
import unittest import numpy as np import requests from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.server_fixtures.default_fixture import DefaultServerBase from sglang.test.test_utils import DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH register_...
190
8,270
sglang
test/registered/models_e2e/test_kimi_linear_models.py
.py
import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.kl_divergence_kit import KLDivergenceMixin from sglang.test.kits.prefix_cache_branchin...
83
2,552
sglang
test/registered/models_e2e/test_deepseek_v4_flash_fp4_b200.py
.py
"""B200 per-commit CI: DeepSeek-V4-Flash FP4 (LowLatency recipe). Launches TP=4 with flashinfer_mxfp4 MoE runner + EAGLE speculative decoding. Runs 12 ServerSanity probes (correctness, streaming, concurrency, determinism) plus a GSM8K accuracy gate. Registry: base-c-test-4-gpu-b200 (per-commit, 4x B200) """ import u...
230
6,801
sglang
test/registered/models_e2e/test_mimo_v2_flash.py
.py
import unittest from sglang.srt.environ import envs from sglang.srt.utils import is_blackwell from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.spec_decoding_kit import SpecDecodingMixin from sglang.test.server_fixtures.default_fixtu...
65
1,766
sglang
test/registered/models_e2e/test_dsa_glm52_tp_mtp.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.spec_decoding_kit import SpecDecodingMixin from sglang.test.server_fixtures.dsa_mtp_fixture import ( DsaMtpEvalConfigDefaults, DsaMtpServerBase, ) register_cu...
28
644
sglang
test/registered/models_e2e/test_gemma4_fp8_per_expert_loading.py
.py
"""End-to-end test for compressed-tensors per-expert FP8 MoE checkpoint loading on Gemma4 (e.g. RedHatAI/gemma-4-26B-A4B-it-FP8-Dynamic). Regression coverage for the load_weights path that recognises `experts.<id>.{gate,up,down}_proj.{weight,weight_scale}` keys and folds them into SGLang's fused FusedMoE parameters. W...
110
3,863
sglang
test/registered/models_e2e/test_deepseek_v4_flash_fp8_h200.py
.py
"""H200 per-commit CI: DeepSeek-V4-Flash FP8 (LowLatency recipe). Launches TP=4 with DeepEP a2a backend + EAGLE speculative decoding, with FP4 experts disabled via SGLANG_DSV4_FP4_EXPERTS=0. Runs 12 ServerSanity probes (correctness, streaming, concurrency, determinism) plus a GSM8K accuracy gate. Registry: extra-b-te...
163
5,272
sglang
test/registered/models_e2e/test_generation_models.py
.py
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci # Generation model tests (CUDA only) register_cuda_ci(est_time=150, stage="extra-a", runner_config="1-gpu-large") register_amd_ci(est_time=106, suite="stage-b-test-1-gpu-small-amd") # Copyright 2023-2024 SGLang Team # Licensed under the Apache L...
224
7,503
sglang
test/registered/models_e2e/test_transformers_models.py
.py
# Transformers fallback model tests import dataclasses import multiprocessing as mp import unittest from types import SimpleNamespace from typing import List import torch from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.run_eval ...
162
5,041
sglang
test/registered/models_e2e/test_deepseek_v4_flash_fp4_megamoe_b200.py
.py
"""B200 per-commit CI: DeepSeek-V4-Flash FP4 (LowLatency recipe). Launches TP=4 with flashinfer_mxfp4 MoE runner + EAGLE speculative decoding. Runs 12 ServerSanity probes (correctness, streaming, concurrency, determinism) plus a GSM8K accuracy gate. Registry: extra-b-test-4-gpu-b200 (label-gated, 4x B200) """ import...
138
3,812
sglang
test/registered/models_e2e/test_inkling_small_nvfp4.py
.py
"""Per-commit accuracy + logprob-consistency test for Inkling-Small-NVFP4. ``test_inkling.py`` boots a shrunken checkpoint, so it can only guard that the code paths run -- an undertrained model has no answer quality to gate on. This one serves the real NVFP4 checkpoint, which is what catches a weight-load or FP4-kerne...
338
12,463
sglang
test/registered/models_e2e/test_dsa_glm52_nvfp4_tp_mtp.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.spec_decoding_kit import SpecDecodingMixin from sglang.test.server_fixtures.dsa_mtp_fixture import ( DsaMtpEvalConfigDefaults, DsaMtpServerBase, ) register_cu...
35
809
sglang
test/registered/models_e2e/test_ministral3_models.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.mmmu_vlm_kit import MMMUMixin from sglang.test.server_fixtures.default_fixture import DefaultServerBase from sglang.test.server_fixtures.mmmu_fixture import MMMUServer...
35
1,042
sglang
test/registered/models_e2e/test_inkling.py
.py
"""Per-commit end-to-end server test for Inkling (hybrid SWA/sconv attention + MoE + multimodal towers). Boots a small ``thinkingmachines/Inkling`` checkpoint (the ``test`` revision, a full-architecture but shrunken model) via ``popen_launch_server`` and exercises the Inkling code paths on every PR: generation, the mu...
230
8,657
sglang
test/registered/models_e2e/test_deepseek_v3_mtp.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.send_one import BenchArgs, send_one_prompt from sglang.test.server_fixtures.default_fixture import DefaultServerBase from sglang.test.test_utils import ( DEFAULT_TIMEOU...
68
1,993
sglang
test/registered/models_e2e/test_qwen3_next_models.py
.py
import os import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.kl_divergence_kit import KLDivergenceMixin from sglang.test.kits.prefix_cache_branching_kit import PrefixCacheBranchingMixin from sglang.test.server_fixtures...
99
2,829
sglang
test/registered/models_e2e/test_nvidia_nemotron_3_nano.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.lm_eval_kit import LMEvalMixin from sglang.test.server_fixtures.default_fixture import DefaultServerBase register_cuda_ci( est_time=190, stage="base-b", runner_config="2-gpu-large", ) NEMOTRON_3_NANO_THINKING_AR...
35
872
sglang
test/registered/models_e2e/test_compressed_tensors_models.py
.py
# Model tests for compressed tensors (FP8) import unittest from types import SimpleNamespace from sglang.srt.utils import is_hip, kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( DEFAULT_TIMEOU...
57
1,650
sglang
test/registered/models_e2e/test_gpt_oss_sm120.py
.py
import unittest import torch from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.gpt_oss_common import BaseTestGptOss register_cuda_ci(est_time=345, stage="extra-a", runner_config="1-gpu-small") @unittest.skipIf(not torch.cuda.is_available(), "CUDA is not available") class TestGptOssSm120(Base...
35
981
sglang
test/registered/models_e2e/test_dsa_glm52_hisparse.py
.py
import subprocess import time import unittest from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.server_fixtures.default_fixture import DefaultServerBase register_cuda_ci(est_time=720, stage=...
70
2,172
sglang
test/registered/models_e2e/test_deepseek_v4_flash_fp4_h200.py
.py
"""H200 per-commit CI: DeepSeek-V4-Flash FP4 Marlin (LowLatency recipe). Launches TP=4 with Marlin FP4 MoE runner + EAGLE speculative decoding. Runs 12 ServerSanity probes (correctness, streaming, concurrency, determinism) plus a GSM8K accuracy gate. Also covers SGLANG_DSV4_FP4_DEQUANT=1 (TP=8): FP4 experts dequantiz...
218
6,393
sglang
test/registered/models_e2e/test_deepseek_v3_fp4.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.server_fixtures.default_fixture import DefaultServerBase # Per-commit: SymmetricMemory variant only. # - TestDeepseekV3FP4 (TRTLLM) archived to test/manual/quant/test_deep...
42
1,262
sglang
test/registered/models_e2e/test_ministral4_models.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.mmmu_vlm_kit import MMMUMixin from sglang.test.server_fixtures.default_fixture import DefaultServerBase from sglang.test.server_fixtures.mmmu_fixture import MMMUServer...
30
1,031
sglang
test/registered/models_e2e/test_transformers_backend_eval.py
.py
"""A small end-to-end eval coverage for the transformers modeling backend.""" import unittest from types import SimpleNamespace from sglang.test.ci.ci_register import ( register_amd_ci, register_cpu_ci, register_cuda_ci, ) from sglang.test.few_shot_gsm8k import run_eval from sglang.test.server_fixtures.de...
50
1,443
sglang
test/registered/models_e2e/test_gpt_oss_4gpu_mxfp4.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.gpt_oss_common import BaseTestGptOss register_cuda_ci(est_time=220, stage="base-c", runner_config="4-gpu-h100") register_cuda_ci(est_time=220, stage="base-c", runner_config="4-gpu-b200") class TestGptOss4GpuMxfp4(BaseTestGptOss...
29
751
sglang
test/registered/models_e2e/test_qwen35_fp4_mtp.py
.py
import unittest from types import SimpleNamespace import requests from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.reasoning_kit import ReasoningTokenUsageMixin from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( ...
154
4,235
sglang
test/registered/models_e2e/test_vlm_models.py
.py
import random import tempfile import unittest from types import SimpleNamespace from sglang.srt.utils import is_hip from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.kits.mmmu_vlm_kit import ( MMMUMultiModelTestBase, ) from sglang.test.test_utils import is_in_amd_ci, is_in_c...
59
2,242
sglang
test/registered/models_e2e/test_kimi_linear_unified_memory.py
.py
"""Kimi-Linear (MLA full attention + KDA linear attention) served from the unified memory pool. Under `--enable-unified-memory` the MLA full side is exposed as DENSE per-layer views and every loc the kernels see is a translated virtual id, so the whole read/write path differs from the static pool. The unit tests pin t...
60
2,320
sglang
test/registered/models_e2e/test_dsa_glm52_cache_layer_split.py
.py
"""End-to-end GSM8K accuracy test for DSA cache layer split (GLM-5.2). Layer split shards the DSA GPU KV/indexer cache layers across prefill CP ranks (``--enable-dsa-cache-layer-split``); non-owner ranks read a layer via an owner-broadcast into a small remote scratch buffer. It only applies to PD prefill workers runni...
96
2,849
sglang
test/registered/models_e2e/test_nvidia_nemotron_3_super_bf16.py
.py
import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, ...
70
1,897
sglang
test/registered/models_e2e/test_dummy_grok_models.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.test_utils import CustomTestCase, is_in_ci, run_bench_one_batch register_cuda_ci( est_time=120, stage="base-b", runner_config="2-gpu-large", disabled="Temporarily disabled", ) class TestDummyGrok1(CustomTestCase...
43
1,035
sglang
test/registered/models_e2e/test_qwen3_next_models_mtp.py
.py
import os import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.kl_divergence_kit import KLDivergenceMixin from sglang.test.kits.prefix_cache_branching_kit import PrefixCacheBranchingMixin from sglang.test.server_fixtures...
156
4,589
sglang
test/registered/models_e2e/test_dsa_glm52_nvfp4_dp_mtp.py
.py
import unittest from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.kits.spec_decoding_kit import SpecDecodingMixin from sglang.test.server_fixtures.dsa_mtp_fixture import ( DsaMtpEvalConfigDefaults, DsaMtpServerBase, ) register_cu...
37
857
sglang
test/registered/models_e2e/test_kimi_k3_b300.py
.py
"""B300 per-commit CI coverage for Kimi-K3 serving recipes. Runs the Low Latency DSPARK, Balanced DCP/HiCache, and MegaMoE recipes on eight B300 GPUs. Each server must preserve basic model quality on GSM8K, and the Low Latency recipe must also preserve single-request decode performance. """ import unittest from sgla...
181
5,599
sglang
test/registered/scheduler/test_scheduler_control.py
.py
import multiprocessing import threading import time import unittest from concurrent.futures import ThreadPoolExecutor, as_completed import requests from sglang.srt.environ import envs from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.te...
368
12,522
sglang
test/registered/scheduler/test_abort_with_metrics.py
.py
""" Unit test for _PureASGIDispatch: verify that the ASGI ``receive`` callable is passed through untouched so that request.is_disconnected() works. Background: @app.middleware("http") wraps handlers with BaseHTTPMiddleware whose call_next() replaces the ASGI ``receive``, breaking request.is_disconnected() and preventi...
80
2,551
sglang
test/registered/scheduler/test_mixed_chunked_prefill.py
.py
import unittest from sglang.srt.environ import envs from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.kits.eval_accuracy_kit import GSM8KMixin from sglang.test.test_utils import ( DEFAULT_MODEL_NAME_FOR_TEST, DEFAULT_TIMEOUT...
56
1,516
sglang
test/registered/scheduler/test_load_snapshot_server.py
.py
"""Integration tests for load snapshot with real servers. Tests [no dp, normal dp] x [zmq, shm] by launching real servers and querying /v1/loads. """ import json import time import unittest import urllib.request from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, re...
98
2,848
sglang
test/registered/scheduler/test_min_free_slots_delayer.py
.py
import unittest from sglang.srt.managers.min_free_slots_delayer import ( MinFreeSlotsDelayer, resolve_min_free_slots, ) from sglang.test.ci.ci_register import register_cpu_ci register_cpu_ci(est_time=5, suite="base-a-test-cpu") class TestResolveMinFreeSlots(unittest.TestCase): def test_unset_non_dflash...
71
2,949
sglang
test/registered/scheduler/test_priority_scheduling.py
.py
import asyncio import os import re import unittest from typing import Any, List, Optional, Tuple from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.test_utils import ( DEFAULT_SMALL_MODEL_NAME_FOR_TEST, DEFAULT_TIMEOUT_FOR_SE...
429
16,751
sglang
test/registered/scheduler/test_prefill_delayer.py
.py
import asyncio import os import re import time import unittest from dataclasses import dataclass from types import SimpleNamespace from typing import List, Optional import openai import requests import torch from sglang.benchmark.serving import run_benchmark from sglang.srt.managers.prefill_delayer import PrefillDela...
768
27,085
sglang
test/registered/scheduler/test_routing_key_scheduling.py
.py
import asyncio import os import time import unittest import aiohttp from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import ( register_amd_ci, register_cpu_ci, register_cuda_ci, ) from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_...
129
4,191
sglang
test/registered/scheduler/test_retract_decode.py
.py
import time import unittest from types import SimpleNamespace import requests from sglang.srt.environ import envs from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( D...
113
3,522
sglang
test/registered/dp_attn/test_dp_attention.py
.py
import unittest import requests from sglang.srt.environ import envs from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.kits.ebnf_constrained_kit import EBNFConstrainedMixin from sglang.test.kits.eval_accuracy_kit import GSM8KMixin f...
242
7,597
sglang
test/registered/dp_attn/test_dp_attention_bcg_kl.py
.py
from __future__ import annotations import random import unittest import numpy as np import requests from sglang.srt.utils import get_device_capability, is_blackwell, kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kl_test_utils import ( _extract_output_logprobs, _fl...
265
9,153
sglang
test/registered/mlx/models_e2e/test_qwen3_moe_mlx_correctness.py
.py
import importlib.util import os import unittest import requests from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cpu_ci, register_mlx_ci from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, popen_lau...
124
4,257
sglang
test/registered/mlx/models_e2e/test_gpt_oss_mlx_correctness.py
.py
"""Correctness tests for gpt-oss served on the SGLang MLX backend. gpt-oss interleaves sliding-window (window=128) and full-attention layers and uses per-head attention sinks, so it exercises the MLX backend's sliding-window path end to end. Two guards: 1. ``TestGptOssMlxCorrectness`` — black-box serving smoke agains...
395
15,317
sglang
test/registered/mlx/models_e2e/test_qwen2_moe_mlx_correctness.py
.py
import importlib.util import os import unittest import requests from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cpu_ci, register_mlx_ci from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, popen_lau...
124
4,112
sglang
test/registered/core/test_srt_endpoint.py
.py
""" python3 -m unittest test_srt_endpoint.TestSRTEndpoint.test_simple_decode python3 -m unittest test_srt_endpoint.TestSRTEndpoint.test_logprob_with_chunked_prefill python3 -m unittest test_srt_endpoint.TestTokenizeDetokenize python3 -m unittest test_srt_endpoint.TestRustServerEndpoint python3 -m unittest test_srt_endp...
966
38,773
sglang
test/registered/core/test_hidden_states.py
.py
import unittest import torch from transformers import AutoModelForCausalLM, AutoTokenizer import sglang as sgl from sglang.srt.utils import get_device, is_hip from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST, CustomTestCase ...
233
8,465
sglang
test/registered/core/test_basic_sanity_eagle3.py
.py
"""Stage-a basic sanity with EAGLE3 spec decoding enabled. Mirrors test_basic_sanity.py with the spec-decoding path active.""" import unittest from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.kits.basic_api_contract_kit import Bas...
90
3,187
sglang
test/registered/core/test_basic_sanity_dflash.py
.py
"""Stage-a basic sanity with DFLASH spec decoding enabled. Mirrors test_basic_sanity.py / test_basic_sanity_eagle3.py with the DFLASH path active (overlap scheduling on by default).""" import unittest from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.te...
83
2,757
sglang
test/registered/core/test_srt_engine.py
.py
""" Usage: python3 -m unittest test_srt_engine.TestSRTEngine.test_4_sync_async_stream_combination """ import asyncio import json import unittest import torch import sglang as sgl from sglang.benchmark.offline_throughput import BenchArgs, throughput_test from sglang.srt.server_args import ServerArgs from sglang.srt.u...
160
5,125
sglang
test/registered/core/test_basic_sanity_dspark.py
.py
import unittest from sglang.srt.utils import is_sm100_supported, kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.kits.basic_api_contract_kit import BasicAPIContractMixin from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin from sglang.test.kit...
103
3,236
sglang
test/registered/core/test_engine_child_pids.py
.py
""" Unit tests for Engine.get_all_child_pids(). Verifies that launching an Engine exposes the PIDs of all child processes (schedulers, detokenizer) and that those PIDs correspond to live processes. Usage: python -m unittest test_engine_child_pids -v """ import os import unittest import psutil import sglang as ...
81
2,308
sglang
test/registered/core/test_srt_empty_deps.py
.py
# Copyright 2024 SGLang Team # Licensed under the Apache License, Version 2.0 """Test that runtime_base in pyproject_other.toml remains torch-free. This prevents accidental introduction of packages that transitively pull torch/triton into the srt_empty install target. """ from pathlib import Path import pytest from...
92
2,653
sglang
test/registered/core/test_request_queue_validation.py
.py
import asyncio import os import re import unittest from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci from sglang.test.test_utils import ( DEFAULT_SMALL_MODEL_NAME_FOR_TEST, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, STD...
93
3,189
sglang
test/registered/core/test_basic_sanity.py
.py
"""Stage-a basic sanity: small-but-broad server coverage that downstream stages depend on. Multiple sanity-kit mixins driving one shared server, covering protocol, decode correctness, scheduler stress, occupancy, and hellaswag accuracy.""" import unittest from sglang.srt.utils import is_hip, kill_process_tree from sg...
67
2,387
sglang
test/registered/core/test_no_extra_forked_cuda_context.py
.py
import shutil import subprocess import time import unittest import psutil from sglang.srt.utils import kill_process_tree from sglang.test.ci.ci_register import register_cuda_ci from sglang.test.test_utils import ( DEFAULT_SMALL_MODEL_NAME_FOR_TEST, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, ...
140
4,211
sglang
test/registered/eplb/test_lplb_distributed.py
.py
"""Real-CUDA multi-rank distributed test for LPLBSolver. Supplements the CPU-only `test_lplb.py` checks: this test spawns 2 CUDA-bound ranks on a single node via `torch.multiprocessing.spawn` and exercises the actual code paths the production LP server uses, including the EP all-reduce and the DP-attention "empty rank...
447
17,910
sglang
test/registered/unit/test_model_overrides.py
.py
"""Unit tests for the model-override machinery: whitelist metadata, registry, gate, publish wiring, and the per-arch golden diffs for migrated families.""" from sglang.test.ci.ci_register import register_cpu_ci register_cpu_ci(est_time=30, suite="base-a-test-cpu") import dataclasses import json import os import shut...
2,368
96,648
sglang
test/registered/unit/test_dsa_tilelang_fp8_validation.py
.py
"""Rejecting an fp8_e4m3 KV cache with the tilelang DSA backend on CUDA. Regression: the combination used to boot the server and crash at decode CUDA-graph capture with ``kernel main input KV dtype expected bfloat16, but got float8_e4m3fn``. """ import unittest from sglang.srt.arg_groups.overrides import _check_tile...
42
1,483
sglang
test/registered/unit/test_server_args_migration.py
.py
"""Tests for ServerArgs CLI argument auto-derivation from A[T, Arg(...)] annotations. Each test covers a distinct edge case in how add_cli_args_from_dataclass translates field annotations into argparse arguments. """ import argparse import unittest from sglang.srt.server_args import ServerArgs from sglang.srt.utils....
180
6,941
sglang
test/registered/unit/test_legacy_global_ratchet.py
.py
"""Ratchet guard: legacy global-accessor call-sites may only decrease. The process-wide ``ServerArgs`` is owned by the runtime context; the legacy ``get_global_server_args`` / ``set_global_server_args_for_*`` names survive as thin shims for the existing call-sites. New code should use the ``sglang.srt.runtime_context`...
66
2,559
sglang
test/registered/unit/test_module_state_ratchet.py
.py
"""Ratchet guard: module-level runtime state in the flag-owning layers may only shrink. Runtime flags belong on ``get_flags()`` groups, which have lifecycle reset and a scoped test-override primitive; a module-level ``global`` has neither and leaks across test teardowns. ``_PINNED_GLOBALS`` names the survivors -- migr...
62
1,926
sglang
test/registered/unit/test_server_args_no_instance_mutation_entry.py
.py
"""``ServerArgs`` has no in-place mutation entry, and nothing calls one. ``ServerArgs.override(source, **fields)`` used to mutate a resolved instance, and ``ServerArgs.derive(source, **fields)`` used to copy-and-edit one; after resolution the fields are the record the config bags were projected from, so a write desync...
115
4,633
sglang
test/registered/unit/test_eval_accuracy_kit_sgl_eval.py
.py
"""Unit tests for the GSM8K backend dispatch + sgl-eval skip in eval_accuracy_kit. Hermetic (no server, no real sgl-eval install). These guard the behavior that existing consumers rely on -- not the sgl-eval happy path, which the live accuracy runs already cover: 1. The default GSM8K backend stays on ``run_eval`` (...
101
4,178
sglang
test/registered/unit/test_runtime_context_override.py
.py
"""Context-first mutation. ``get_context().override(source, **fields)`` is the business mutation entry: it writes the resolved config bags (the single source of truth) and never touches ``server_args`` (the pristine startup record). Routing is by NS metadata; a bad field aborts before any write; provenance is recorded...
197
8,447
sglang
test/registered/unit/test_split_attention_backend_decisions.py
.py
"""Decisions keyed on the attention backend must read the configured pair. `--attention-backend` is one of three fields: the base one and the two split ones (`--prefill-attention-backend` / `--decode-attention-backend`). A launch that sets only a split field leaves the base at `None`, so a decision that reads `attenti...
362
15,872
sglang
test/registered/unit/test_server_args_namespaces.py
.py
"""Coverage lint for the ServerArgs -> RuntimeContext namespace split. Every ServerArgs field must carry an ``NS("<path>")`` marker in its ``Annotated`` metadata, and every path must be one of the known domains. This is the guardrail that fails when an upstream PR adds a ServerArgs field without assigning it a namespa...
72
2,086
sglang
test/registered/unit/test_global_config_read_ratchet.py
.py
"""Ratchet guard: process-global config reads may only decrease. ``get_server_args()`` returns the published ``ServerArgs`` — one process's startup record. Config decisions read the namespace accessors instead (``get_exec()`` / ``get_memory()`` / …), which carry the resolved value including post-publish overrides, and...
479
21,106
sglang
test/registered/unit/test_parallel_adoption_ratchet.py
.py
"""Ratchet guard: legacy parallel-getter calls in swept directories may only shrink. ``models/`` and ``layers/`` read parallel topology through ``get_parallel().<dim>`` (the read-through wrapper in ``runtime_context``), which gives one import, one naming scheme, and the scoped ``override()`` test primitive. Exemptions...
74
2,643
sglang
test/registered/unit/test_context_accessor_shadowing.py
.py
"""No local may shadow a ``runtime_context`` accessor it also calls. A mechanical sweep that rewrites ``self.server_args.mamba_cache_chunk_size`` into ``mamba_cache_chunk_size()`` turns mamba_cache_chunk_size = self.server_args.mamba_cache_chunk_size into ``mamba_cache_chunk_size = mamba_cache_chunk_size()``, wh...
192
7,961
sglang
test/registered/unit/test_server_args_cli_metadata.py
.py
"""Unit tests for migrated ServerArgs CLI metadata.""" import argparse import ast import inspect import textwrap import unittest from sglang.srt.server_args import ServerArgs from sglang.srt.utils.common import human_readable_int from sglang.test.ci.ci_register import register_cpu_ci from sglang.test.test_utils impor...
166
5,764