vllm.env_override
¶
_apply_inductor_pattern_matcher_patch()
¶
Allow custom ops and functionalization wrappers with unsupported dtypes.
Source code in vllm/env_override.py
_get_torch_cuda_version()
¶
_get_torch_root()
¶
Locate the installed torch package without importing it.
Source code in vllm/env_override.py
_get_torch_version_attr(attr)
¶
Read an attribute of torch.version without importing torch.
PyTorch version must not be determined by importing directly because it will trigger the CUDA initialization, losing the chance to set the LD_LIBRARY_PATH beforehand.
Source code in vllm/env_override.py
_maybe_promote_torch_symbols_for_rocm()
¶
Put libtorch_cpu.so in the global symbol scope on ROCm, for GPU profiling.
Must run before 'import torch'. libkineto advertises itself to rocprofiler-sdk by exporting rocprofiler_configure from libtorch_cpu.so, and rocprofiler-sdk looks for that symbol exactly once, from a lazy initializer that runs during 'import torch'. CPython loads extension modules RTLD_LOCAL, so unless something has already placed the symbol in the global scope the lookup misses and no client is ever registered.
The failure is silent and total: no queue interception, so roctracer yields no GPU records, while torch.profiler still writes a complete CPU-only trace and reports success.
Best effort. If the library cannot be loaded early we leave the process exactly as it would have been, losing only GPU tracing.
Source code in vllm/env_override.py
_maybe_set_cuda_compatibility_path()
¶
Set LD_LIBRARY_PATH for CUDA forward compatibility if enabled.
Must run before 'import torch' since torch loads CUDA shared libraries at import time and the dynamic linker only consults LD_LIBRARY_PATH when a library is first loaded.
CUDA forward compatibility is only supported on select professional and datacenter NVIDIA GPUs. Consumer GPUs (GeForce, RTX) do not support it and will get Error 803 if compat libs are loaded.
Source code in vllm/env_override.py
_patch_inductor_operator_str_if_needed()
¶
Shorten the implicit-fallback message for vllm ops on torch < 2.13.
Defers application until torch._inductor.exc is imported, so that importing vllm does not import torch._inductor.
Source code in vllm/env_override.py
_patch_inductor_pattern_matcher()
¶
Apply the backport when Inductor imports its pattern matcher.