[misc] Remove deprecated endpoints, env vars and aliases past two releases (#40795)

This commit is contained in:
Liangsheng Yin
2026-09-22 18:14:45 -07:00
committed by GitHub
parent 0cd8be351d
commit 78980a3b0b
183 changed files with 179 additions and 904 deletions
-2
View File
@@ -14,8 +14,6 @@
- `README.md`: This package structure overview.
- `__init__.py`: Package initialization and public Python APIs.
- `bench_offline_throughput.py`: Deprecated wrapper for the offline throughput benchmark.
- `bench_one_batch.py`: Deprecated wrapper for the one-batch benchmark.
- `bench_one_batch_server.py`: Deprecated wrapper for the server-based one-batch benchmark.
- `bench_serving.py`: Deprecated wrapper for the online serving benchmark.
- `check_env.py`: Environment and dependency diagnostics.
-23
View File
@@ -1,23 +0,0 @@
"""Deprecated import path for ``sglang.benchmark.offline_throughput``.
``python -m sglang.bench_offline_throughput`` and
``from sglang.bench_offline_throughput import ...`` still work, but the
implementation now lives in ``sglang.benchmark.offline_throughput``.
Update references to the new path.
"""
import warnings
from sglang.benchmark.offline_throughput import * # noqa: F401,F403
from sglang.benchmark.offline_throughput import cli_main
warnings.warn(
"`sglang.bench_offline_throughput` is deprecated and will be removed in a "
"future release; use `sglang.benchmark.offline_throughput` instead "
"(e.g. `python -m sglang.benchmark.offline_throughput`).",
FutureWarning,
stacklevel=1,
)
if __name__ == "__main__":
cli_main()
-22
View File
@@ -1,22 +0,0 @@
"""Deprecated import path for ``sglang.benchmark.one_batch``.
``python -m sglang.bench_one_batch`` and ``from sglang.bench_one_batch import ...``
still work, but the implementation now lives in ``sglang.benchmark.one_batch``.
Update references to the new path.
"""
import warnings
from sglang.benchmark.one_batch import * # noqa: F401,F403
from sglang.benchmark.one_batch import cli_main
warnings.warn(
"`sglang.bench_one_batch` is deprecated and will be removed in a future "
"release; use `sglang.benchmark.one_batch` instead "
"(e.g. `python -m sglang.benchmark.one_batch`).",
FutureWarning,
stacklevel=1,
)
if __name__ == "__main__":
cli_main()
-1
View File
@@ -278,7 +278,6 @@ class BenchArgs:
)
parser.add_argument(
"--profile-prefix",
"--profile-filename-prefix", # deprecated alias, kept for back-compat
dest="profile_prefix",
type=str,
default=BenchArgs.profile_prefix,
@@ -91,8 +91,6 @@ def benchmark(batch_size, seq_len, save_kv_cache, provider):
value=inputs["value"],
k_buffer=pool_flashinfer.k_buffer[0].view(-1, num_kv_heads * head_size),
v_buffer=pool_flashinfer.v_buffer[0].view(-1, num_kv_heads * head_size),
k_scale=None,
v_scale=None,
cache_loc=inputs["out_cache_loc"],
)
if save_kv_cache
@@ -17,9 +17,6 @@ class FusedSetKVBufferArg:
k_buffer: torch.Tensor
v_buffer: torch.Tensor
cache_loc: torch.Tensor
# Kept for backward compatibility with old sgl_kernel test/bench callsites.
k_scale: Optional[float] = None
v_scale: Optional[float] = None
def to_jit(self) -> _JitFusedSetKVBufferArg:
return _JitFusedSetKVBufferArg(
@@ -339,7 +339,6 @@ POSITIONAL_FIELD_ORDER = (
"elastic_ep_initial_size",
"max_ep_size",
"elastic_ep_scale_timeout",
"elastic_ep_rejoin",
"disable_flashinfer_cutlass_moe_fp4_allgather",
"disable_shared_experts_fusion",
"enforce_shared_experts_fusion",
@@ -393,7 +392,6 @@ POSITIONAL_FIELD_ORDER = (
"mm_global_cache_backend",
"disable_fast_image_processor",
"mm_feature_transport",
"keep_mm_feature_on_device",
"enable_lora",
"enable_lora_overlap_loading",
"max_lora_rank",
@@ -821,10 +821,6 @@ class ExecMoe(msgspec.Struct):
elastic_ep_scale_timeout: A[
float, "Timeout in seconds for a pending elastic EP scale operation."
] = 600
elastic_ep_rejoin: A[
bool,
"[Deprecated] Alias for --elastic-ep-join-mode recover.",
] = False
disable_flashinfer_cutlass_moe_fp4_allgather: A[
bool, "Disables quantize before all-gather for flashinfer cutlass moe."
] = False
@@ -157,8 +157,3 @@ class Mm(msgspec.Struct):
resolvable=True,
),
] = None
keep_mm_feature_on_device: A[
bool,
"Deprecated. Use --mm-feature-transport=cuda_ipc for bounded GPU-resident "
"multimodal feature transport.",
] = False
@@ -214,7 +214,6 @@ class Model(msgspec.Struct):
"bfloat16",
"nvfp4",
"fp4_mx_block16",
"fp4_e2m1",
],
resolvable=True,
),
@@ -163,7 +163,7 @@ class Serving(msgspec.Struct):
] = None
admin_api_key: A[
Optional[str],
"Set admin API key for sensitive management endpoints (e.g. /clear_hicache_storage_backend). When set, admin endpoints require this key and do NOT accept --api-key.",
"Set admin API key for sensitive management endpoints (e.g. /hicache/storage-backend/clear). When set, admin endpoints require this key and do NOT accept --api-key.",
] = None
served_model_name: A[
Optional[str],
+2 -4
View File
@@ -1263,9 +1263,9 @@ def _mla_kv_cache_dtype_checks(view: Any) -> dict:
raise ValueError(
"TRTLLM MLA backend is only supported on Blackwell GPUs (SM100/SM12x). Please use a different backend."
)
if view.kv_cache_dtype not in ["fp8_e4m3", "fp4_e2m1", "bf16", "auto"]:
if view.kv_cache_dtype not in ["fp8_e4m3", "bf16", "auto"]:
raise ValueError(
"TensorRT-LLM MLA backend only supports kv-cache-dtype of fp8_e4m3, fp4_e2m1, bf16, or auto."
"TensorRT-LLM MLA backend only supports kv-cache-dtype of fp8_e4m3, bf16, or auto."
)
if (
view.attention_backend == "tokenspeed_mla"
@@ -1824,8 +1824,6 @@ def post_capture_kv_sizing_planned(server_args: Any) -> bool:
return False
if mla_enabled:
return False
if cfg.kv_cache_dtype == "fp4_e2m1":
return False
if cfg.prefill_only_disable_kv_cache:
return False
if cfg.enable_memory_saver:
@@ -397,21 +397,6 @@ def handle_elastic_ep(server_args: Any):
from sglang.srt.arg_groups.validation_hook import validate_ib_devices
cfg = resolving_view(server_args)
if cfg.elastic_ep_rejoin:
if cfg.ep_join_mode is None:
logger.warning(
"--elastic-ep-rejoin is deprecated, use --elastic-ep-join-mode recover instead."
)
declare_resolution(
server_args,
"_handle_elastic_ep",
ep_join_mode="recover",
)
else:
assert cfg.ep_join_mode == "recover", (
"--elastic-ep-rejoin (deprecated) conflicts with "
f"--elastic-ep-join-mode {cfg.ep_join_mode}."
)
if cfg.elastic_ep_backend is not None:
if cfg.enable_eplb:
if cfg.eplb_algorithm == "auto":
@@ -626,13 +611,6 @@ def handle_eplb_and_dispatch(server_args: Any):
def handle_expert_distribution_metrics(server_args: Any):
cfg = resolving_view(server_args)
if "SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC" in os.environ:
raise ValueError(
"SGLANG_ENABLE_EPLB_BALANCEDNESS_METRIC is no longer supported. Use "
"--expert-balancedness-report-mode with one of: off, server_log, "
"prometheus, both."
)
if should_report_expert_balancedness(server_args) and (
cfg.expert_distribution_recorder_mode is None
):
+2 -22
View File
@@ -745,8 +745,8 @@ def handle_multimodal_feature_transport(server_args: Any):
CUDA IPC is opt-in because its fixed pool on ``base_gpu_id`` reduces the
memory left for model/KV-cache allocations. Multi-node MNNVL deployments
may still auto-select CUDA VMM. The legacy CUDA IPC flag and environment
variable remain supported so existing deployments map to this policy.
may still auto-select CUDA VMM. The legacy CUDA IPC environment variable
remains supported so existing deployments map to this policy.
"""
cfg = resolving_view(server_args)
@@ -754,19 +754,6 @@ def handle_multimodal_feature_transport(server_args: Any):
legacy_ipc_is_set = envs.SGLANG_USE_CUDA_IPC_TRANSPORT.is_set()
legacy_ipc_enabled = envs.SGLANG_USE_CUDA_IPC_TRANSPORT.get()
if cfg.keep_mm_feature_on_device:
if requested_transport not in (None, "cuda_ipc"):
raise ValueError(
"--keep-mm-feature-on-device conflicts with "
f"--mm-feature-transport={requested_transport}. Use only "
"--mm-feature-transport=cuda_ipc."
)
requested_transport = "cuda_ipc"
logger.warning(
"--keep-mm-feature-on-device is deprecated; using "
"--mm-feature-transport=cuda_ipc instead."
)
if requested_transport is None:
if legacy_ipc_is_set:
requested_transport = "cuda_ipc" if legacy_ipc_enabled else "cpu"
@@ -893,13 +880,6 @@ def handle_multimodal_feature_transport(server_args: Any):
"_handle_multimodal_feature_transport",
mm_feature_transport=requested_transport,
)
# The bounded IPC pool owns device residency. Do not retain unpooled
# tensors after a pool miss, which would make HBM use request-dependent.
declare_resolution(
server_args,
"_handle_multimodal_feature_transport",
keep_mm_feature_on_device=False,
)
envs.SGLANG_USE_CUDA_IPC_TRANSPORT.set(
"1" if requested_transport == "cuda_ipc" else "0"
)
@@ -2,7 +2,6 @@ from __future__ import annotations
import json
import logging
import os
from typing import TYPE_CHECKING, Optional
from sglang.srt.arg_groups.choices import DRAFT_ATTENTION_BACKEND_CHOICES
@@ -142,15 +141,6 @@ def handle_speculative_decoding(server_args: ServerArgs) -> None:
speculative_algorithm=cfg.speculative_algorithm.upper(),
)
# Removal notice for the retired env var; raw os.getenv on purpose -- the
# Envs descriptor is gone. Drop this check after one release.
if os.getenv("SGLANG_ENABLE_SPEC_V2") is not None:
logger.warning(
"SGLANG_ENABLE_SPEC_V2 has been removed: speculative decoding "
"always runs the V2 worker. Use --disable-overlap-schedule to "
"select the non-overlap (synchronous) path."
)
kwargs = {}
override_config_file = cfg.decrypted_draft_config_file
+1 -1
View File
@@ -447,7 +447,7 @@ def get_healthy_expert_location_src_rank(
*, invoked_in_elastic_ep_rejoin_path: bool
) -> int:
world_group = get_parallel().world_group
# NOTE: do not key off `self.server_args.elastic_ep_rejoin` here.
# NOTE: do not key off the launch-time `ep_join_mode` here.
# A rank that was started as a rejoin rank may later act as a healthy
# rank in a subsequent recovery cycle.
local_rejoin_flag = bool(invoked_in_elastic_ep_rejoin_path)
-29
View File
@@ -1877,35 +1877,6 @@ def _set_envs_and_config(server_args: ServerArgs):
if gc_threshold := cfg.gc_threshold:
gc.set_threshold(*gc_threshold)
_log_legacy_kernel_cache_dirs()
def _log_legacy_kernel_cache_dirs():
"""Note the pre-SGLANG_CACHE_DIR cache dirs without touching them: other
frameworks on the box may still be using them."""
# TODO(shuwang21): drop once SGLANG_CACHE_DIR has been the default for a
# few releases.
legacy_dirs = [
d
for d in (
os.path.expanduser("~/.triton"),
os.path.expanduser("~/.cache/flashinfer"),
os.path.expanduser("~/.cache/deep_gemm"),
os.path.expanduser("~/.tilelang/cache"),
)
if os.path.isdir(d)
]
if not legacy_dirs:
return
logger.debug(
"Compiled-kernel caches now live under SGLANG_CACHE_DIR (%s). These "
"older directories are no longer used by sglang, but may still be "
"used by other frameworks on this machine, so they were left alone: "
"%s. Remove them yourself if nothing else needs them.",
envs.SGLANG_CACHE_DIR.get(),
", ".join(legacy_dirs),
)
def _scheduler_died_error(rank: int, proc) -> RuntimeError:
"""Build a descriptive error for a scheduler process that died during init."""
+1 -52
View File
@@ -799,16 +799,6 @@ async def model_info():
return msgspec_to_builtins(result)
@app.get("/get_weight_version")
@app.get("/weight_version")
async def weight_version():
"""Get the current weight version."""
raise HTTPException(
status_code=404,
detail="Endpoint '/get_weight_version' or '/weight_version' is deprecated. Please use '/model_info' instead.",
)
@app.get("/get_server_info")
async def get_server_info():
"""Get the server information (deprecated - use /server_info instead)."""
@@ -855,33 +845,6 @@ async def server_info():
)
@app.get("/get_load")
async def get_load():
"""Get load metrics (deprecated - use /v1/loads instead).
Legacy shim backed by /v1/loads. Projects the load snapshot down to the
historical field shape (dp_rank, num_reqs, num_waiting_reqs, num_tokens,
num_pending_tokens, ts_tic) so existing clients keep working.
"""
logger.warning(
"Endpoint '/get_load' is deprecated and will be removed in a future version. "
"Please use '/v1/loads' instead."
)
load_results = await _global_state.tokenizer_manager.get_loads(include=["core"])
ts = time.perf_counter()
return [
{
"dp_rank": r.dp_rank,
"num_reqs": r.num_running_reqs + r.num_waiting_reqs,
"num_waiting_reqs": r.num_waiting_reqs,
"num_tokens": r.num_total_tokens,
"num_pending_tokens": r.num_total_tokens - r.num_used_tokens,
"ts_tic": ts,
}
for r in load_results
]
# example usage:
# curl -s -X POST http://localhost:30000/set_internal_state -H "Content-Type: application/json" -d '{"server_args": {"pp_max_micro_batch_size": 8}}'
@app.api_route("/set_internal_state", methods=["POST", "PUT"])
@@ -1068,22 +1031,8 @@ async def list_external_corpora():
)
@app.api_route("/clear_hicache_storage_backend", methods=["GET", "POST"])
@auth_level(AuthLevel.ADMIN_OPTIONAL)
async def clear_hicache_storage_backend_deprecated():
"""Deprecated: use POST /hicache/storage-backend/clear."""
ret = await _global_state.tokenizer_manager.clear_hicache_storage()
return Response(
content=(
"Deprecated endpoint. Use POST /hicache/storage-backend/clear.\n"
"Hierarchical cache storage backend cleared.\n"
),
status_code=200 if ret.success else HTTPStatus.BAD_REQUEST,
)
# example usage:
# curl -s -X POST http://127.0.0.1:30000/clear_hicache_storage_backend
# curl -s -X POST http://127.0.0.1:30000/hicache/storage-backend/clear
@app.api_route("/hicache/storage-backend/clear", methods=["POST"])
@auth_level(AuthLevel.ADMIN_OPTIONAL)
async def clear_hicache_storage_backend():
+9 -89
View File
@@ -163,7 +163,7 @@ class _DeprecatedEnvFallback:
check *deprecated_name* and emit DeprecationWarning before reading it.
Usage:
SGLANG_DSA_FUSE_TOPK = EnvBoolWithAlias(True, deprecated_name="SGLANG_NSA_FUSE_TOPK")
SGLANG_NEW_NAME = EnvBoolWithAlias(True, deprecated_name="SGLANG_OLD_NAME")
"""
def __init__(self, default: Any, deprecated_name: str, secret: bool = False):
@@ -455,12 +455,8 @@ class Envs:
# reaches this many requests (0 = first decode batch). Lets a batch-size bench
# capture steady-state full-admission decode steps instead of the ramp-up.
SGLANG_PROFILE_BY_STAGE_DECODE_MIN_BS = EnvInt(0)
SGLANG_ENABLE_NVTX_SCHEDULER = EnvBoolWithAlias(
False, deprecated_name="SGLANG_ENABLE_NVTX"
)
SGLANG_ENABLE_NVTX_OPERATIONS = EnvBoolWithAlias(
False, deprecated_name="SGLANG_OPERATIONS_ENABLE_PROFILE"
)
SGLANG_ENABLE_NVTX_SCHEDULER = EnvBool(False)
SGLANG_ENABLE_NVTX_OPERATIONS = EnvBool(False)
SGLANG_RECORD_STEP_TIME = EnvBool(False)
SGLANG_ENABLE_CUDA_GRAPH_CAPTURE_TRACE = EnvBool(False)
# Opt-in: emit one CUDA-graph capture trace per captured batch size (per-bs).
@@ -974,9 +970,7 @@ class Envs:
# Enable int4x2 weights loading
SGLANG_NPU_W4A4_NEW_PACKING = EnvBool(False)
# Use the graph-safe Triton-Ascend kernel for masked speculative KV commits.
SGLANG_NPU_USE_TRITON_PREFIX_KV_CACHE_STORE = EnvBoolWithAlias(
False, deprecated_name="SGLANG_NPU_USE_TRITON_KV_CACHE_STORE"
)
SGLANG_NPU_USE_TRITON_PREFIX_KV_CACHE_STORE = EnvBool(False)
# Quantize x to int8 in the dispatch operator (vendor alias consumed by the
# Ascend DeepEP library; the MTP draft-build scopes override it to False).
DEEP_NORMAL_MODE_USE_INT8_QUANT = EnvBool(False)
@@ -1298,12 +1292,8 @@ class Envs:
# Sanitize NaN logits before sampling kernels and log a throttled warning
# (see sanitize_nan_logits).
SGLANG_SANITIZE_NAN_LOGITS = EnvBool(False)
SGLANG_ENABLE_LOGPROB_CHUNK = EnvBoolWithAlias(
True, deprecated_name="SGLANG_ENABLE_LOGITS_PROCESSER_CHUNK"
)
SGLANG_LOGPROB_CHUNK_SIZE = EnvIntWithAlias(
2048, deprecated_name="SGLANG_LOGITS_PROCESSER_CHUNK_SIZE"
)
SGLANG_ENABLE_LOGPROB_CHUNK = EnvBool(True)
SGLANG_LOGPROB_CHUNK_SIZE = EnvInt(2048)
# Compute input logprobs from logits via per-row logsumexp instead of
# materializing the full-vocab log-softmax. Escape hatch only; the two
# paths are mathematically identical.
@@ -1636,19 +1626,13 @@ class Envs:
# ===================================================================
# DSA backend (GLM 5 and DeepSeek V3.2)
# ===================================================================
SGLANG_DSA_FUSE_TOPK = EnvBoolWithAlias(
True, deprecated_name="SGLANG_NSA_FUSE_TOPK"
)
SGLANG_DSA_FUSE_TOPK = EnvBool(True)
# Enabled for supported CUDA KPool geometry; set to 0 to use ordinary metadata.
SGLANG_EXPERIMENTAL_DSA_KPOOL_METADATA_FUSION = EnvBool(True)
SGLANG_DSA_TOPK_FLASHINFER_DETERMINISTIC = EnvBool(False)
SGLANG_DSA_TOPK_FLASHINFER_TIE_BREAK = EnvStr(None)
SGLANG_DSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD = EnvIntWithAlias(
2048, deprecated_name="SGLANG_NSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD"
)
SGLANG_DSA_HIP_DISABLE_PRESHUFFLE = EnvBoolWithAlias(
False, deprecated_name="SGLANG_NSA_HIP_DISABLE_PRESHUFFLE"
)
SGLANG_DSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD = EnvInt(2048)
SGLANG_DSA_HIP_DISABLE_PRESHUFFLE = EnvBool(False)
SGLANG_DSA_MQA_LOGITS_FREE_MEM_FRACTION = EnvFloat(0.2)
SGLANG_ENABLE_PCG_DSV2_DUAL_STREAM = EnvBool(False)
SGLANG_DSA_TOPK_BROADCAST = EnvBool(False)
@@ -1883,70 +1867,20 @@ class _DeprecatedEnv:
os.environ[self.replacement] = value
def _ms_to_s(value: str) -> str:
return str(float(value) / 1000.0)
def _invert_bool(value: str) -> str:
return "0" if value.lower() in ("true", "1", "yes", "y") else "1"
# The single registry for deprecated environment variables, processed once at
# import by _handle_deprecated_envs(). Add new deprecations here instead of
# ad-hoc warnings. For a rename where the old name must keep working through a
# descriptor, use EnvBoolWithAlias / EnvIntWithAlias instead.
_DEPRECATED_ENVS: Dict[str, _DeprecatedEnv] = {
# Renamed: the value is forwarded to the replacement.
"SGLANG_GC_LOG": _DeprecatedEnv(replacement="SGLANG_LOG_GC"),
"SGLANG_CUTEDSL_MOE_NVFP4_DISPATCH": _DeprecatedEnv(
replacement="SGLANG_MOE_NVFP4_DISPATCH"
),
"SGLANG_ENABLE_THINKING": _DeprecatedEnv(replacement="SGLANG_DEFAULT_THINKING"),
"SGLANG_REASONING_EFFORT": _DeprecatedEnv(
replacement="SGLANG_DSV4_REASONING_EFFORT"
),
"SGLANG_USE_JIT_ALL_REDUCE": _DeprecatedEnv(
replacement="SGLANG_OPT_USE_CUSTOM_ALL_REDUCE_V2"
),
# The legacy DISABLE flags have the opposite polarity of their replacement.
"SGLANG_DISABLE_TP_MEMORY_INBALANCE_CHECK": _DeprecatedEnv(
replacement="SGLANG_ENABLE_TP_MEMORY_INBALANCE_CHECK", transform=_invert_bool
),
# Renamed with a unit change.
"SGLANG_QUEUED_TIMEOUT_MS": _DeprecatedEnv(
replacement="SGLANG_REQ_WAITING_TIMEOUT",
transform=_ms_to_s,
note="Note the unit change: milliseconds -> seconds.",
),
"SGLANG_FORWARD_TIMEOUT_MS": _DeprecatedEnv(
replacement="SGLANG_REQ_RUNNING_TIMEOUT",
transform=_ms_to_s,
note="Note the unit change: milliseconds -> seconds.",
),
# Removed without replacement.
"SGLANG_ENABLE_CP_V2": _DeprecatedEnv(
note="Strategy-based prefill context parallelism is now the only generic implementation."
),
"SGLANG_PER_TOKEN_GROUP_QUANT_8BIT_V2": _DeprecatedEnv(),
# Superseded by the unified JIT per_token_group_quant, the default CUDA path.
"SGLANG_OPT_USE_JIT_PER_TOKEN_GROUP_QUANT": _DeprecatedEnv(),
"SGLANG_MASKED_GEMM_FAST_ACT": _DeprecatedEnv(),
# The unified free list is kept unsorted between flushes by design; the
# sort-after-merge A/B knob never left its off default and is gone.
"SGLANG_SORT_FREE_LIST_AFTER_MERGE": _DeprecatedEnv(),
"SGLANG_OPT_SWA_EVICT_DROP_PAGE_MARGIN": _DeprecatedEnv(),
# sconv-family kernels always use the CUDA-JIT ports when supported; no toggle.
"SGLANG_OPT_USE_CUDA_SCONV": _DeprecatedEnv(),
# DSV4 compressor V2 is always used.
"SGLANG_OPT_USE_COMPRESSOR_V2": _DeprecatedEnv(),
"SGLANG_ENABLE_HICACHE_BUFFER_ANCHOR_LOCK": _DeprecatedEnv(
note="Buffer-mode anchor pinning is always on; set "
"SGLANG_HICACHE_BUFFER_ANCHOR_LOCK_CAP=0 to disable it."
),
# Replaced by CLI flags.
"SGLANG_ENABLE_GRPC": _DeprecatedEnv(
note="Please use '--grpc-port' to enable the native gRPC server."
),
"SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE": _DeprecatedEnv(
note="Please use '--enable-prefill-delayer' instead."
),
@@ -1956,20 +1890,6 @@ _DEPRECATED_ENVS: Dict[str, _DeprecatedEnv] = {
"SGLANG_PREFILL_DELAYER_TOKEN_USAGE_LOW_WATERMARK": _DeprecatedEnv(
note="Please use '--prefill-delayer-token-usage-low-watermark' instead."
),
"SGLANG_CUTLASS_MOE": _DeprecatedEnv(
note="Please use '--moe-runner-backend=cutlass' and/or "
"'--speculative-moe-runner-backend=cutlass' instead."
),
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_FP4_ACTS": _DeprecatedEnv(
note="Please use '--enable-w4a4-mxfp4-megamoe' instead."
),
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_MXF4_KIND": _DeprecatedEnv(
note="Please use '--enable-w4a4-mxfp4-megamoe' instead."
),
"SGLANG_DFLASH_PREFILL_REFILL_TARGET": _DeprecatedEnv(
note="DFlash now auto-enables the min-free-slots delay; unset this env. "
"To override the threshold, use '--min-free-slots-delay'."
),
"SGLANG_ENABLE_UNIFIED_RADIX_TREE": _DeprecatedEnv(
note="The unified radix tree is the default tree cache now; unset this env."
),
@@ -382,9 +382,3 @@ class DeepseekSparseAttnBackendMTPPrecomputeMixin:
max_seqlen_k=max_seqlen_k,
flashmla_metadata=flashmla_metadata,
)
# Backward-compat alias
DeepseekSparseAttnBackendMTPPrecomputeMixin = (
DeepseekSparseAttnBackendMTPPrecomputeMixin
)
@@ -43,7 +43,6 @@ def aiter_can_use_preshuffle_paged_mqa() -> bool:
Set ``SGLANG_DSA_HIP_DISABLE_PRESHUFFLE=1`` to force the legacy path even when
the gluon kernel would otherwise be available (useful for CI bisection).
``SGLANG_NSA_HIP_DISABLE_PRESHUFFLE`` is a deprecated alias.
"""
if not is_hip():
return False
@@ -3866,11 +3866,3 @@ class DeepseekSparseAttnMultiStepBackend:
def init_forward_metadata_in_graph(self, forward_batch: ForwardBatch) -> None:
for i in range(self.speculative_num_steps - 1):
self.attn_backends[i].init_forward_metadata_in_graph(forward_batch)
# Backward-compat aliases (deprecated: use DSA class names)
DeepseekSparseAttnBackend = DeepseekSparseAttnBackend
DeepseekSparseAttnMultiStepBackend = DeepseekSparseAttnMultiStepBackend
DSAMetadata = DSAMetadata
DSAFlashMLAMetadata = DSAFlashMLAMetadata
DSAIndexerMetadata = DSAIndexerMetadata
@@ -1,23 +0,0 @@
# [Deprecated] nsa_backend.py is a thin re-export shim for backward compatibility.
# Use dsa_backend.py instead. This file will be removed in a future release.
import warnings
warnings.warn(
"sglang.srt.layers.attention.nsa_backend is deprecated; "
"use sglang.srt.layers.attention.dsa_backend instead.",
DeprecationWarning,
stacklevel=2,
)
from sglang.srt.layers.attention.dsa_backend import * # noqa: F401, F403
from sglang.srt.layers.attention.dsa_backend import ( # noqa: F401
DeepseekSparseAttnBackend,
DeepseekSparseAttnMultiStepBackend,
DSAFlashMLAMetadata,
DSAIndexerMetadata,
DSAMetadata,
NativeSparseAttnBackend,
NativeSparseAttnMultiStepBackend,
NSAFlashMLAMetadata,
NSAIndexerMetadata,
NSAMetadata,
)
+1 -11
View File
@@ -23,11 +23,7 @@ Only the symbols imported by code OUTSIDE this subpackage are re-exported here.
Package-internal helpers (the @triton.jit kernels, ``CPTritonContext``,
``correct_attn_out``, ``create_dcp_kv_indices``, ``update_kv_lens_and_indices``,
``_all_gather_dcp_kv_cache``) stay private to their submodules — import them from
``sglang.srt.layers.dcp.{kernels,comm}`` if ever needed internally.
``dcp_enabled`` / ``get_attention_dcp_*`` remain compatibility exports for
out-of-tree callers; in-tree code should use ``get_parallel().dcp_enabled`` and
``get_parallel().attn_dcp_*``."""
``sglang.srt.layers.dcp.{kernels,comm}`` if ever needed internally."""
from sglang.kernels.ops.attention.dcp_kernels import (
create_triton_kv_indices_for_dcp_triton,
@@ -41,9 +37,6 @@ from sglang.srt.layers.dcp.comm import (
cp_lse_ag_out_rs_mha,
cp_lse_ag_out_rs_mla,
dcp_a2a_lse_reduce,
dcp_enabled,
get_attention_dcp_rank,
get_attention_dcp_world_size,
init_fi_a2a_workspace,
)
from sglang.srt.layers.dcp.layout import (
@@ -73,10 +66,7 @@ __all__ = [
"cp_lse_ag_out_rs_mha",
"cp_lse_ag_out_rs_mla",
"create_triton_kv_indices_for_dcp_triton",
"dcp_enabled",
"filter_dcp_local_kv_indices",
"get_attention_dcp_rank",
"get_attention_dcp_world_size",
"get_dcp_lens",
"update_local_kv_lens_for_dcp",
]
-31
View File
@@ -20,7 +20,6 @@ PR #25090 vs #14194):
- cp_lse_ag_out_rs_mla: Triton (log2/exp2) correction / reduce-scatter
"""
import warnings
from typing import Optional
import torch
@@ -43,36 +42,6 @@ from sglang.srt.utils.common import is_fi_a2a_supported
_is_hip = is_hip()
def _warn_deprecated_dcp_accessor(name: str, replacement: str) -> None:
warnings.warn(
f"{name} is deprecated; use {replacement} instead.",
DeprecationWarning,
stacklevel=2,
)
def dcp_enabled() -> bool:
"""Deprecated: use ``get_parallel().dcp_enabled``."""
_warn_deprecated_dcp_accessor("dcp_enabled()", "get_parallel().dcp_enabled")
return get_parallel().dcp_enabled
def get_attention_dcp_world_size() -> int:
"""Deprecated: use ``get_parallel().attn_dcp_size``."""
_warn_deprecated_dcp_accessor(
"get_attention_dcp_world_size()", "get_parallel().attn_dcp_size"
)
return get_parallel().attn_dcp_size
def get_attention_dcp_rank() -> int:
"""Deprecated: use ``get_parallel().attn_dcp_rank``."""
_warn_deprecated_dcp_accessor(
"get_attention_dcp_rank()", "get_parallel().attn_dcp_rank"
)
return get_parallel().attn_dcp_rank
def _ag_lse(cp_attn_lse: torch.Tensor, cp_group: GroupCoordinator) -> torch.Tensor:
"""All-gather each rank's LSE into a ``[world_size, *lse.shape]`` stack.
@@ -502,19 +502,6 @@ class _MoriEPDispatcherImplBase:
"MoE would read them as e8m0 bytes. Falling back to "
"bf16 dispatch."
)
elif (
"SGLANG_MORI_FP8_DISP" in os.environ or "SGLANG_MORI_FP4_DISP" in os.environ
):
# Deprecated: will be removed in a future release
logger.warning_once(
"SGLANG_MORI_FP8_DISP and SGLANG_MORI_FP4_DISP are deprecated "
"and will be removed in a future release. "
"Use SGLANG_MORI_DISPATCH_DTYPE=auto|bf16|fp8|fp4 instead."
)
if get_bool_env_var("SGLANG_MORI_FP8_DISP", "False"):
self.dispatch_dtype = DispatchDtype.fp8
if get_bool_env_var("SGLANG_MORI_FP4_DISP", "False"):
self.dispatch_dtype = DispatchDtype.fp4
if "SGLANG_MORI_COMBINE_DTYPE" in os.environ:
combine_dtype = os.environ["SGLANG_MORI_COMBINE_DTYPE"].lower()
@@ -527,15 +514,6 @@ class _MoriEPDispatcherImplBase:
self.combine_dtype = CombineDtype.fp8_direct_cast
elif combine_dtype == "fp4":
self.combine_dtype = CombineDtype.fp4
elif "SGLANG_MORI_FP8_COMB" in os.environ:
# Deprecated: will be removed in a future release
logger.warning_once(
"SGLANG_MORI_FP8_COMB is deprecated "
"and will be removed in a future release. "
"Use SGLANG_MORI_COMBINE_DTYPE=auto|bf16|fp8|fp4|fp8_direct_cast instead."
)
if get_bool_env_var("SGLANG_MORI_FP8_COMB", "False"):
self.combine_dtype = CombineDtype.fp8
def dispatch_a(
self,
@@ -1034,11 +1034,6 @@ def resolve_kv_cache_quant(kv_cache_dtype) -> Optional[str]:
)
return None
if kv_cache_dtype == "fp4_e2m1":
raise ValueError(
"--kv-cache-dtype=fp4_e2m1 is deprecated. "
"Use --kv-cache-dtype=fp4_mx_block16."
)
if kv_cache_dtype == "mxfp4":
raise ValueError(
"--kv-cache-dtype=mxfp4 is reserved for true MXFP4 block-size-32 "
@@ -51,13 +51,6 @@ def create_uno_cublas_backend():
return UnoCublasLoRABackend
@register_lora_backend("flashinfer")
def create_flashinfer_backend():
raise ValueError(
"FlashInfer LoRA backend has been deprecated, please use `triton` instead."
)
def get_backend_from_name(name: str) -> Type[BaseLoRABackend]:
"""
Get corresponding backend class from backend's name
@@ -47,7 +47,6 @@ def validate_experimental_sgl_marlin_server_args(
or cfg.enable_eplb
or cfg.elastic_ep_backend is not None
or cfg.enable_elastic_expert_backup
or cfg.elastic_ep_rejoin
):
raise ValueError(
"experimental_sgl_marlin EP requires trivial expert placement "
@@ -2982,10 +2982,6 @@ class TokenizerManager(TokenizerControlMixin, TokenizerManagerScoreMixin):
/ recv_obj.spec_verify_ct[i]
)
# FIXME: backward-compat aliases, remove in next release.
meta_info["spec_accepted_drafts"] = num_correct_drafts
meta_info["spec_proposed_drafts"] = num_proposed_drafts
# Acceptance histogram: tracks how many decoding steps accepted a certain number of draft tokens.
if (
recv_obj.spec_correct_drafts_histogram
@@ -2995,10 +2991,6 @@ class TokenizerManager(TokenizerControlMixin, TokenizerManagerScoreMixin):
meta_info["spec_correct_drafts_histogram"] = (
recv_obj.spec_correct_drafts_histogram[i]
)
# FIXME: backward-compat alias, remove in next release.
meta_info["spec_accept_histogram"] = (
recv_obj.spec_correct_drafts_histogram[i]
)
if (
getattr(recv_obj, "spec_cap_lens_histogram", None)
and len(recv_obj.spec_cap_lens_histogram) > i
@@ -62,11 +62,6 @@ def configure_kv_cache_dtype(
kv_cache_dtype = torch.float8_e4m3fn
elif server_args_kv_cache_dtype in ("bf16", "bfloat16"):
kv_cache_dtype = torch.bfloat16
elif server_args_kv_cache_dtype == "fp4_e2m1":
raise ValueError(
"--kv-cache-dtype=fp4_e2m1 is deprecated. "
"Use --kv-cache-dtype=fp4_mx_block16."
)
elif server_args_kv_cache_dtype in ("nvfp4", "fp4_mx_block16"):
if hasattr(torch, "float4_e2m1fn_x2"):
kv_cache_dtype = torch.float4_e2m1fn_x2
@@ -30,10 +30,10 @@ device_mesh = torch.distributed.init_device_mesh("cuda", (tp_size,))
tensor_parallel(model, device_mesh)
```
An end-to-end example can be found in `python/sglang/bench_one_batch.py`.
An end-to-end example can be found in `python/sglang/benchmark/one_batch.py`.
You can run it with the following command:
```bash
$ python3 -m sglang.bench_one_batch --correct \
$ python3 -m sglang.benchmark.one_batch --correct \
--model meta-llama/Meta-Llama-3-8B \
--json-model-override-args '{"architectures": ["TorchNativeLlamaForCausalLM"]}' \
--tensor-parallel-size 2 \
@@ -690,30 +690,6 @@ class SchedulerReqTimeStats(ReqTimeStatsBase):
ts = ts or time.perf_counter()
self.spec_verify_start_time = ts
def set_spec_verify_end_time(
self,
ts=None,
num_correct_drafts: int = 0,
# FIXME: backward-compat alias, remove in next release.
accepted_tokens: Optional[int] = None,
):
if accepted_tokens is not None:
num_correct_drafts = accepted_tokens
ts = ts or time.perf_counter()
if self.trace_ctx.tracing_enable:
stage = RequestStage.SPEC_VERIFY
self.trace_slice(
stage,
self.spec_verify_start_time,
ts,
{
"num_correct_drafts": num_correct_drafts,
# FIXME: backward-compat alias, remove in next release.
"accepted_tokens": num_correct_drafts,
},
)
def set_run_batch_cpu_start_time(self, ts=None, attrs=None):
ts = ts or time.perf_counter()
self.run_batch_cpu_start_time = ts
@@ -1,6 +1,5 @@
from __future__ import annotations
import warnings
from abc import ABC
from enum import Enum, IntEnum, auto
from typing import TYPE_CHECKING, Callable, List, Optional, Tuple, Type, Union
@@ -300,20 +299,6 @@ class SpeculativeAlgorithm(Enum):
return num_draft_tokens - 1
return num_draft_tokens
def get_num_tokens_per_bs_for_target_verify(
self, num_draft_tokens: int, is_draft_worker: bool
) -> int:
# Deprecated alias; remove together with the FIXME above.
warnings.warn(
"get_num_tokens_per_bs_for_target_verify is deprecated; use "
"get_num_tokens_per_req_for_target_verify instead.",
DeprecationWarning,
stacklevel=2,
)
return self.get_num_tokens_per_req_for_target_verify(
num_draft_tokens, is_draft_worker
)
def create_worker(
self, server_args: ServerArgs
) -> Optional[Union[Type[BaseSpecWorker], Type[TpModelWorker], Type[NGRAMWorker]]]:
@@ -5,7 +5,6 @@ should use that classmethod API; do not import from this module directly.
from __future__ import annotations
import logging
import warnings
from typing import TYPE_CHECKING, Callable, Dict, Optional, Type
import torch
@@ -162,20 +161,6 @@ class CustomSpecAlgo:
# Here, we expose this interface to allow the other use cases.
return num_draft_tokens
def get_num_tokens_per_bs_for_target_verify(
self, num_draft_tokens: int, is_draft_worker: bool
) -> int:
# Deprecated alias; remove together with the FIXME above.
warnings.warn(
"get_num_tokens_per_bs_for_target_verify is deprecated; use "
"get_num_tokens_per_req_for_target_verify instead.",
DeprecationWarning,
stacklevel=2,
)
return self.get_num_tokens_per_req_for_target_verify(
num_draft_tokens, is_draft_worker
)
def build_disagg_draft_input(
self,
batch: ScheduleBatch,
+1 -1
View File
@@ -2407,7 +2407,7 @@ def monkey_patch_p2p_access_check():
setattr(tgt, "gpu_p2p_access_check", lambda *arg, **kwargs: True)
# Suppress the warnings from this delete function when using sglang.bench_one_batch
# Suppress the warnings from this delete function when using sglang.benchmark.one_batch
from sglang.srt.distributed.device_communicators.custom_all_reduce import (
CustomAllreduce,
)
@@ -962,7 +962,7 @@ class TestNpuMultiNodePdMixTestCaseBase(CustomTestCase):
num_questions=num_questions,
max_new_tokens=max_new_tokens,
parallel=parallel,
host=f"http://{self.host}",
host=self.host,
port=self.port,
)
logger.info("Starting gsm8k test...")
@@ -1072,7 +1072,7 @@ class TestNpuMultiNodePdSepTestCaseBase(CustomTestCase):
num_questions=num_questions,
max_new_tokens=max_new_tokens,
parallel=parallel,
host=f"http://{self.host}",
host=self.host,
port=self.port,
)
logger.info("Starting gsm8k test...")
-4
View File
@@ -467,7 +467,3 @@ class MMMUMultiModelTestBase(CustomTestCase):
print(f"Error reading {tag.lower()} file: {e}")
return "\n".join(output_lines)
# Backward compatibility alias
MMMUVLMTestBase = MMMUMultiModelTestBase
@@ -45,7 +45,7 @@ class UnifiedRadixTreeTestMixin:
num_questions=self.num_gsm8k_questions,
max_new_tokens=16000,
parallel=128,
host=f"http://{url.hostname}",
host=url.hostname,
port=int(url.port),
)
metrics = run_few_shot_gsm8k(args)
@@ -160,7 +160,7 @@ class AccuracyTwoPassMixin:
num_questions=self.num_gsm8k_questions,
max_new_tokens=16000,
parallel=self.gsm8k_parallel,
host=f"http://{url.hostname}",
host=url.hostname,
port=int(url.port),
)
metrics = run_few_shot_gsm8k(args)
-9
View File
@@ -11,7 +11,6 @@ import sys
import time
import traceback
import urllib.request
import warnings
import weakref
from collections import OrderedDict
from concurrent.futures import ThreadPoolExecutor
@@ -162,14 +161,6 @@ def dump_state_text(filename: str, states: list, mode: str = "w"):
def normalize_base_url(host: str, port: int) -> str:
from sglang.srt.utils.network import NetworkAddress
if host.startswith("http://") or host.startswith("https://"):
warnings.warn(
f"Including the scheme in --host ('{host}') is deprecated. "
f"Pass just the hostname (e.g. '127.0.0.1') instead.",
DeprecationWarning,
stacklevel=2,
)
return f"{host}:{port}"
return NetworkAddress(host, port).to_url()