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 9, 01:15 UTC
[Misc] Remove deprecated profiler environment variables (#33536)
Signed-off-by: carlory <baofa.fan@daocloud.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
杨朱 · Kiki committed
Feb 3, 2026 at 14:58 UTC
ef248ff740200c91791ba952b3458a5d5a016d26
2 files changed
-95
vllm/config/profiler.py
-81
@@ -8,7 +8,6 @@ from pydantic import Field, model_validator
8
from pydantic.dataclasses import dataclass
9
from typing_extensions import Self
10
11
-import vllm.envs as envs
11
from vllm.config.utils import config
12
from vllm.logger import init_logger
13
from vllm.utils.hashing import safe_hash
@@ -102,88 +101,8 @@ class ProfilerConfig:
101
hash_str = safe_hash(str(factors).encode(), usedforsecurity=False).hexdigest()
102
return hash_str
103
105
- def _get_from_env_if_set(self, field_name: str, env_var_name: str) -> None:
106
- """Get field from env var if set, with deprecation warning."""
107
-
108
- if envs.is_set(env_var_name):
109
- value = getattr(envs, env_var_name)
110
- logger.warning_once(
111
- "Using %s environment variable is deprecated and will be removed in "
112
- "v0.15.0 or v1.0.0, whichever is soonest. Please use "
113
- "--profiler-config.%s command line argument or "
114
- "ProfilerConfig(%s=...) config field instead.",
115
- env_var_name,
116
- field_name,
117
- field_name,
118
- )
119
- return value
120
- return None
121
-
122
- def _set_from_env_if_set(
123
- self,
124
- field_name: str,
125
- env_var_name: str,
126
- to_bool: bool = True,
127
- to_int: bool = False,
128
- ) -> None:
129
- """Set field from env var if set, with deprecation warning."""
130
- value = self._get_from_env_if_set(field_name, env_var_name)
131
- if value is not None:
132
- if to_bool:
133
- value = value == "1"
134
- if to_int:
135
- value = int(value)
136
- setattr(self, field_name, value)
137
-
104
@model_validator(mode="after")
105
def _validate_profiler_config(self) -> Self:
140
- maybe_use_cuda_profiler = self._get_from_env_if_set(
141
- "profiler", "VLLM_TORCH_CUDA_PROFILE"
142
- )
143
- if maybe_use_cuda_profiler is not None:
144
- self.profiler = "cuda" if maybe_use_cuda_profiler == "1" else None
145
- else:
146
- self._set_from_env_if_set(
147
- "torch_profiler_dir", "VLLM_TORCH_PROFILER_DIR", to_bool=False
148
- )
149
- if self.torch_profiler_dir:
150
- self.profiler = "torch"
151
- self._set_from_env_if_set(
152
- "torch_profiler_record_shapes",
153
- "VLLM_TORCH_PROFILER_RECORD_SHAPES",
154
- )
155
- self._set_from_env_if_set(
156
- "torch_profiler_with_memory",
157
- "VLLM_TORCH_PROFILER_WITH_PROFILE_MEMORY",
158
- )
159
- self._set_from_env_if_set(
160
- "torch_profiler_with_stack",
161
- "VLLM_TORCH_PROFILER_WITH_STACK",
162
- )
163
- self._set_from_env_if_set(
164
- "torch_profiler_with_flops",
165
- "VLLM_TORCH_PROFILER_WITH_FLOPS",
166
- )
167
- self._set_from_env_if_set(
168
- "ignore_frontend",
169
- "VLLM_TORCH_PROFILER_DISABLE_ASYNC_LLM",
170
- )
171
- self._set_from_env_if_set(
172
- "torch_profiler_use_gzip",
173
- "VLLM_TORCH_PROFILER_USE_GZIP",
174
- )
175
- self._set_from_env_if_set(
176
- "torch_profiler_dump_cuda_time_total",
177
- "VLLM_TORCH_PROFILER_DUMP_CUDA_TIME_TOTAL",
178
- )
179
-
180
- self._set_from_env_if_set(
181
- "delay_iterations", "VLLM_PROFILER_DELAY_ITERS", to_bool=False, to_int=True
182
- )
183
- self._set_from_env_if_set(
184
- "max_iterations", "VLLM_PROFILER_MAX_ITERS", to_bool=False, to_int=True
185
- )
186
-
106
has_delay_or_limit = self.delay_iterations > 0 or self.max_iterations > 0
107
if self.profiler == "torch" and has_delay_or_limit and not self.ignore_frontend:
108
logger.warning_once(
vllm/envs.py
-14
@@ -88,20 +88,6 @@ if TYPE_CHECKING:
88
VLLM_PLUGINS: list[str] | None = None
89
VLLM_LORA_RESOLVER_CACHE_DIR: str | None = None
90
VLLM_LORA_RESOLVER_HF_REPO_LIST: str | None = None
91
- # Deprecated env variables for profiling, kept for backward compatibility
92
- # See also vllm/config/profiler.py and `--profiler-config` argument
93
- VLLM_TORCH_CUDA_PROFILE: str | None = None
94
- VLLM_TORCH_PROFILER_DIR: str | None = None
95
- VLLM_TORCH_PROFILER_RECORD_SHAPES: str | None = None
96
- VLLM_TORCH_PROFILER_WITH_PROFILE_MEMORY: str | None = None
97
- VLLM_TORCH_PROFILER_DISABLE_ASYNC_LLM: str | None = None
98
- VLLM_TORCH_PROFILER_WITH_STACK: str | None = None
99
- VLLM_TORCH_PROFILER_WITH_FLOPS: str | None = None
100
- VLLM_TORCH_PROFILER_USE_GZIP: str | None = None
101
- VLLM_TORCH_PROFILER_DUMP_CUDA_TIME_TOTAL: str | None = None
102
- VLLM_PROFILER_DELAY_ITERS: str | None = None
103
- VLLM_PROFILER_MAX_ITERS: str | None = None
104
- # End of deprecated env variables for profiling
91
VLLM_USE_AOT_COMPILE: bool = False
92
VLLM_USE_BYTECODE_HOOK: bool = False
93
VLLM_FORCE_AOT_LOAD: bool = False