Skip to content

[Bugfix] Don't attempt to use triton if no driver is active #19561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions vllm/triton_utils/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@
find_spec("triton") is not None
or find_spec("pytorch-triton-xpu") is not None # Not compatible
)
if HAS_TRITON:
try:
from triton.backends import backends

# It's generally expected that x.driver exists and has
# an is_active method.
# The `x.driver and` check adds a small layer of safety.
active_drivers = [
x.driver for x in backends.values()
if x.driver and x.driver.is_active()
]
if len(active_drivers) != 1:
logger.info(
"Triton is installed but %d active driver(s) found "
"(expected 1). Disabling Triton to prevent runtime errors.",
len(active_drivers))
HAS_TRITON = False
except ImportError:
# This can occur if Triton is partially installed or triton.backends
# is missing.
logger.warning(
"Triton is installed, but `triton.backends` could not be imported. "
"Disabling Triton.")
HAS_TRITON = False
except Exception as e:
# Catch any other unexpected errors during the check.
logger.warning(
"An unexpected error occurred while checking Triton active drivers:"
" %s. Disabling Triton.", e)
HAS_TRITON = False

if not HAS_TRITON:
logger.info("Triton not installed or not compatible; certain GPU-related"
Expand Down