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 15, 06:00 UTC
[Bugfix] Don't attempt to use triton if no driver is active (#19561)
Konrad Zawora committed
Jun 14, 2025 at 21:30 UTC
861a0a0a39d1d4c5051e31dd6ea802faf706d14f
1 file changed
+30
vllm/triton_utils/importing.py
+30
@@ -12,6 +12,36 @@ HAS_TRITON = (
12
find_spec("triton") is not None
13
or find_spec("pytorch-triton-xpu") is not None # Not compatible
14
)
15
+if HAS_TRITON:
16
+ try:
17
+ from triton.backends import backends
18
+
19
+ # It's generally expected that x.driver exists and has
20
+ # an is_active method.
21
+ # The `x.driver and` check adds a small layer of safety.
22
+ active_drivers = [
23
+ x.driver for x in backends.values()
24
+ if x.driver and x.driver.is_active()
25
+ ]
26
+ if len(active_drivers) != 1:
27
+ logger.info(
28
+ "Triton is installed but %d active driver(s) found "
29
+ "(expected 1). Disabling Triton to prevent runtime errors.",
30
+ len(active_drivers))
31
+ HAS_TRITON = False
32
+ except ImportError:
33
+ # This can occur if Triton is partially installed or triton.backends
34
+ # is missing.
35
+ logger.warning(
36
+ "Triton is installed, but `triton.backends` could not be imported. "
37
+ "Disabling Triton.")
38
+ HAS_TRITON = False
39
+ except Exception as e:
40
+ # Catch any other unexpected errors during the check.
41
+ logger.warning(
42
+ "An unexpected error occurred while checking Triton active drivers:"
43
+ " %s. Disabling Triton.", e)
44
+ HAS_TRITON = False
45
46
if not HAS_TRITON:
47
logger.info("Triton not installed or not compatible; certain GPU-related"