A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 3, 03:00 UTC
[Deprecation] Mark env vars covered by --moe-backend / --linear-backend (#43148)
Signed-off-by: mgoin <mgoin64@gmail.com> Signed-off-by: Michael Goin <mgoin64@gmail.com>
Michael Goin committed
May 21, 2026 at 15:51 UTC
9b54e50e2c1c61ea3b7def032fbafc56dd3179c1
2 files changed
+113
-54
vllm/envs.py
+112
-33
@@ -8,6 +8,7 @@ import os
8
import sys
9
import tempfile
10
import uuid
11
+import warnings
12
from collections.abc import Callable
13
from typing import TYPE_CHECKING, Any, Literal
14
@@ -342,6 +343,27 @@ def use_mega_aot_artifact():
343
return os.environ.get("VLLM_USE_MEGA_AOT_ARTIFACT", default_value) == "1"
344
345
346
+def deprecated_env(
347
+ env_name: str,
348
+ removal_version: str,
349
+ replacement: str,
350
+ getter: Callable[[], Any],
351
+) -> Callable[[], Any]:
352
+ """Wrap an env-var getter to emit a FutureWarning when the var is set."""
353
+
354
+ def _read() -> Any:
355
+ if env_name in os.environ:
356
+ warnings.warn(
357
+ f"{env_name} is deprecated and will be removed in "
358
+ f"{removal_version}. {replacement}",
359
+ FutureWarning,
360
+ stacklevel=2,
361
+ )
362
+ return getter()
363
+
364
+ return _read
365
+
366
+
367
def env_with_choices(
368
env_name: str,
369
default: str | None,
@@ -1294,8 +1316,13 @@ environment_variables: dict[str, Callable[[], Any]] = {
1316
os.environ.get("VLLM_MARLIN_USE_ATOMIC_ADD", "0") == "1"
1317
),
1318
# Whether to use marlin kernel in mxfp4 quantization method
1297
- "VLLM_MXFP4_USE_MARLIN": lambda: maybe_convert_bool(
1298
- os.environ.get("VLLM_MXFP4_USE_MARLIN", None)
1319
+ # Deprecated: use --moe-backend marlin (MoE) or --linear-backend marlin
1320
+ # (linear) instead.
1321
+ "VLLM_MXFP4_USE_MARLIN": deprecated_env(
1322
+ "VLLM_MXFP4_USE_MARLIN",
1323
+ "v0.23",
1324
+ "Use --moe-backend marlin or --linear-backend marlin.",
1325
+ lambda: maybe_convert_bool(os.environ.get("VLLM_MXFP4_USE_MARLIN", None)),
1326
),
1327
# The activation dtype for marlin kernel
1328
"VLLM_MARLIN_INPUT_DTYPE": env_with_choices(
@@ -1390,16 +1417,29 @@ environment_variables: dict[str, Callable[[], Any]] = {
1417
int(os.getenv("VLLM_BLOCKSCALE_FP8_GEMM_FLASHINFER", "1"))
1418
),
1419
# Allow use of FlashInfer BF16 MoE kernels for fused moe ops.
1393
- "VLLM_USE_FLASHINFER_MOE_FP16": lambda: bool(
1394
- int(os.getenv("VLLM_USE_FLASHINFER_MOE_FP16", "0"))
1420
+ # Deprecated: use --moe-backend to select a kernel explicitly.
1421
+ "VLLM_USE_FLASHINFER_MOE_FP16": deprecated_env(
1422
+ "VLLM_USE_FLASHINFER_MOE_FP16",
1423
+ "v0.23",
1424
+ "Use --moe-backend (e.g. flashinfer_trtllm, flashinfer_cutlass).",
1425
+ lambda: bool(int(os.getenv("VLLM_USE_FLASHINFER_MOE_FP16", "0"))),
1426
),
1427
# Allow use of FlashInfer FP8 MoE kernels for fused moe ops.
1397
- "VLLM_USE_FLASHINFER_MOE_FP8": lambda: bool(
1398
- int(os.getenv("VLLM_USE_FLASHINFER_MOE_FP8", "0"))
1428
+ # Deprecated: use --moe-backend to select a kernel explicitly.
1429
+ "VLLM_USE_FLASHINFER_MOE_FP8": deprecated_env(
1430
+ "VLLM_USE_FLASHINFER_MOE_FP8",
1431
+ "v0.23",
1432
+ "Use --moe-backend (e.g. flashinfer_trtllm, flashinfer_cutlass).",
1433
+ lambda: bool(int(os.getenv("VLLM_USE_FLASHINFER_MOE_FP8", "0"))),
1434
),
1435
# Allow use of FlashInfer NVFP4 MoE kernels for fused moe ops.
1401
- "VLLM_USE_FLASHINFER_MOE_FP4": lambda: bool(
1402
- int(os.getenv("VLLM_USE_FLASHINFER_MOE_FP4", "0"))
1436
+ # Deprecated: use --moe-backend to select a kernel explicitly.
1437
+ "VLLM_USE_FLASHINFER_MOE_FP4": deprecated_env(
1438
+ "VLLM_USE_FLASHINFER_MOE_FP4",
1439
+ "v0.23",
1440
+ "Use --moe-backend (e.g. flashinfer_trtllm, flashinfer_cutlass, "
1441
+ "flashinfer_cutedsl).",
1442
+ lambda: bool(int(os.getenv("VLLM_USE_FLASHINFER_MOE_FP4", "0"))),
1443
),
1444
# Allow use of FlashInfer MxInt4 MoE kernels for fused moe ops.
1445
"VLLM_USE_FLASHINFER_MOE_INT4": lambda: bool(
@@ -1407,20 +1447,36 @@ environment_variables: dict[str, Callable[[], Any]] = {
1447
),
1448
# If set to 1, use the FlashInfer
1449
# MXFP8 (activation) x MXFP4 (weight) MoE backend.
1410
- "VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8": lambda: bool(
1411
- int(os.getenv("VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8", "0"))
1450
+ # Deprecated: use --moe-backend flashinfer_trtllm combined with
1451
+ # --quantization_config.moe.activation mxfp8.
1452
+ "VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8": deprecated_env(
1453
+ "VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8",
1454
+ "v0.23",
1455
+ "Use --moe-backend flashinfer_trtllm with "
1456
+ "--quantization_config.moe.activation mxfp8.",
1457
+ lambda: bool(int(os.getenv("VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8", "0"))),
1458
),
1459
# If set to 1, use the FlashInfer CUTLASS backend for
1460
# MXFP8 (activation) x MXFP4 (weight) MoE.
1415
- # This is separate from the TRTLLMGEN path controlled by
1416
- # VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8.
1417
- "VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8_CUTLASS": lambda: bool(
1418
- int(os.getenv("VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8_CUTLASS", "0"))
1461
+ # Deprecated: use --moe-backend flashinfer_cutlass combined with
1462
+ # --quantization_config.moe.activation mxfp8.
1463
+ "VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8_CUTLASS": deprecated_env(
1464
+ "VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8_CUTLASS",
1465
+ "v0.23",
1466
+ "Use --moe-backend flashinfer_cutlass with "
1467
+ "--quantization_config.moe.activation mxfp8.",
1468
+ lambda: bool(
1469
+ int(os.getenv("VLLM_USE_FLASHINFER_MOE_MXFP4_MXFP8_CUTLASS", "0"))
1470
+ ),
1471
),
1472
# If set to 1, use the FlashInfer
1473
# BF16 (activation) x MXFP4 (weight) MoE backend.
1422
- "VLLM_USE_FLASHINFER_MOE_MXFP4_BF16": lambda: bool(
1423
- int(os.getenv("VLLM_USE_FLASHINFER_MOE_MXFP4_BF16", "0"))
1474
+ # Deprecated: use --moe-backend to select a kernel explicitly.
1475
+ "VLLM_USE_FLASHINFER_MOE_MXFP4_BF16": deprecated_env(
1476
+ "VLLM_USE_FLASHINFER_MOE_MXFP4_BF16",
1477
+ "v0.23",
1478
+ "Use --moe-backend (e.g. flashinfer_trtllm, flashinfer_cutlass).",
1479
+ lambda: bool(int(os.getenv("VLLM_USE_FLASHINFER_MOE_MXFP4_BF16", "0"))),
1480
),
1481
# Control the cache sized used by the xgrammar compiler. The default
1482
# of 512 MB should be enough for roughly 1000 JSON schemas.
@@ -1480,10 +1536,17 @@ environment_variables: dict[str, Callable[[], Any]] = {
1536
# Uses CUTLASS kernels optimized for high-throughput batch inference.
1537
# - "latency":
1538
# Uses TensorRT-LLM kernels optimized for low-latency inference.
1483
- "VLLM_FLASHINFER_MOE_BACKEND": env_with_choices(
1539
+ # Deprecated: pass --moe-backend flashinfer_{trtllm,cutlass,cutedsl} directly.
1540
+ "VLLM_FLASHINFER_MOE_BACKEND": deprecated_env(
1541
"VLLM_FLASHINFER_MOE_BACKEND",
1485
- "latency",
1486
- ["throughput", "latency", "masked_gemm"],
1542
+ "v0.23",
1543
+ "Use --moe-backend flashinfer_trtllm, flashinfer_cutlass, or "
1544
+ "flashinfer_cutedsl.",
1545
+ env_with_choices(
1546
+ "VLLM_FLASHINFER_MOE_BACKEND",
1547
+ "latency",
1548
+ ["throughput", "latency", "masked_gemm"],
1549
+ ),
1550
),
1551
# Override the directory for the FlashInfer autotune config cache.
1552
"VLLM_FLASHINFER_AUTOTUNE_CACHE_DIR": lambda: os.getenv(
@@ -1565,8 +1628,12 @@ environment_variables: dict[str, Callable[[], Any]] = {
1628
# Controls whether or not emulations are used for NVFP4
1629
# generations on machines < 100 for compressed-tensors
1630
# models
1568
- "VLLM_USE_NVFP4_CT_EMULATIONS": lambda: bool(
1569
- int(os.getenv("VLLM_USE_NVFP4_CT_EMULATIONS", "0"))
1631
+ # Deprecated: use --linear-backend emulation instead.
1632
+ "VLLM_USE_NVFP4_CT_EMULATIONS": deprecated_env(
1633
+ "VLLM_USE_NVFP4_CT_EMULATIONS",
1634
+ "v0.23",
1635
+ "Use --linear-backend emulation.",
1636
+ lambda: bool(int(os.getenv("VLLM_USE_NVFP4_CT_EMULATIONS", "0"))),
1637
),
1638
# Controls the read mode for the Mori-IO connector
1639
"VLLM_MORIIO_CONNECTOR_READ_MODE": lambda: (
@@ -1601,18 +1668,24 @@ environment_variables: dict[str, Callable[[], Any]] = {
1668
# This is only meant for research purposes to run on devices where NVFP4
1669
# GEMM kernels are not available.
1670
# - <none>: automatically pick an available backend
1604
- "VLLM_NVFP4_GEMM_BACKEND": env_with_choices(
1671
+ # Deprecated: use --linear-backend instead.
1672
+ "VLLM_NVFP4_GEMM_BACKEND": deprecated_env(
1673
"VLLM_NVFP4_GEMM_BACKEND",
1606
- None,
1607
- [
1608
- "flashinfer-b12x",
1609
- "flashinfer-cudnn",
1610
- "flashinfer-trtllm",
1611
- "flashinfer-cutlass",
1612
- "cutlass",
1613
- "marlin",
1614
- "emulation",
1615
- ],
1674
+ "v0.23",
1675
+ "Use --linear-backend.",
1676
+ env_with_choices(
1677
+ "VLLM_NVFP4_GEMM_BACKEND",
1678
+ None,
1679
+ [
1680
+ "flashinfer-b12x",
1681
+ "flashinfer-cudnn",
1682
+ "flashinfer-trtllm",
1683
+ "flashinfer-cutlass",
1684
+ "cutlass",
1685
+ "marlin",
1686
+ "emulation",
1687
+ ],
1688
+ ),
1689
),
1690
# Controls garbage collection during CUDA graph capture.
1691
# If set to 0 (default), enables GC freezing to speed up capture time.
@@ -1763,7 +1836,13 @@ environment_variables: dict[str, Callable[[], Any]] = {
1836
# NCCL header path
1837
"VLLM_NCCL_INCLUDE_PATH": lambda: os.environ.get("VLLM_NCCL_INCLUDE_PATH", None),
1838
# Flag to enable FBGemm kernels on model execution
1766
- "VLLM_USE_FBGEMM": lambda: bool(int(os.getenv("VLLM_USE_FBGEMM", "0"))),
1839
+ # Deprecated: use --linear-backend fbgemm instead.
1840
+ "VLLM_USE_FBGEMM": deprecated_env(
1841
+ "VLLM_USE_FBGEMM",
1842
+ "v0.23",
1843
+ "Use --linear-backend fbgemm.",
1844
+ lambda: bool(int(os.getenv("VLLM_USE_FBGEMM", "0"))),
1845
+ ),
1846
# GC debug config
1847
# - VLLM_GC_DEBUG=0: disable GC debugger
1848
# - VLLM_GC_DEBUG=1: enable GC debugger with gc.collect elpased times
vllm/model_executor/kernels/linear/__init__.py
+1
-21
@@ -13,7 +13,6 @@ or kernel implementation, add it to this __init__.py to maintain
13
import stability.
14
"""
15
16
-import warnings
16
from typing import TypeVar
17
18
import torch
@@ -851,31 +850,12 @@ def init_nvfp4_linear_kernel() -> NvFp4LinearKernel:
850
force_kernel = EmulationNvFp4LinearKernel
851
elif linear_backend == "auto":
852
# Deprecated env-var overrides — only honoured when --linear-backend
854
- # is "auto". Will be removed in v0.21; users should migrate to
855
- # --linear-backend.
853
+ # is "auto". Deprecation warnings are emitted from vllm/envs.py.
854
if envs.VLLM_USE_FBGEMM:
857
- warnings.warn(
858
- "VLLM_USE_FBGEMM is deprecated and will be removed in "
859
- "v0.21. Use --linear-backend fbgemm instead.",
860
- DeprecationWarning,
861
- stacklevel=2,
862
- )
855
force_kernel = FbgemmNvFp4LinearKernel
856
elif envs.VLLM_USE_NVFP4_CT_EMULATIONS:
865
- warnings.warn(
866
- "VLLM_USE_NVFP4_CT_EMULATIONS is deprecated and will be "
867
- "removed in v0.21. Use --linear-backend emulation instead.",
868
- DeprecationWarning,
869
- stacklevel=2,
870
- )
857
force_kernel = EmulationNvFp4LinearKernel
858
elif envs.VLLM_NVFP4_GEMM_BACKEND is not None:
873
- warnings.warn(
874
- "VLLM_NVFP4_GEMM_BACKEND is deprecated and will be "
875
- "removed in v0.21. Use --linear-backend instead.",
876
- DeprecationWarning,
877
- stacklevel=2,
878
- )
859
backend_name = envs.VLLM_NVFP4_GEMM_BACKEND
860
force_kernel = _NVFP4_BACKEND_TO_KERNEL.get(backend_name)
861
if force_kernel is None: