Skip to content

Conversation

minosfuture
Copy link
Contributor

Summary: Handle triton kernel import exception in cases it is not available.

Test Plan: AMD DeepSeek test

Reviewed By: houseroad

Differential Revision:
D82899108

Privacy Context Container: L1370295

@minosfuture minosfuture requested a review from mgoin as a code owner September 20, 2025 21:28
@facebook-github-bot
Copy link

@minosfuture has exported this pull request. If you are a Meta employee, you can view the originating diff in D82899108.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to gracefully handle import exceptions for Triton kernels, which is a good addition. However, the implementation introduces a critical issue by changing the function call has_triton_kernels() to a simple reference has_triton_kernels. This will cause the condition to always be true, attempting to import Triton kernels even when they are not available, thus defeating the purpose of the check. I've provided a suggestion to correct this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The check if has_triton_kernels: is incorrect. has_triton_kernels is a function and needs to be called with parentheses, like has_triton_kernels(). Without the parentheses, this condition will always evaluate to True because it's checking the truthiness of the function object itself, not its return value. This would cause an ImportError when triton_kernels is not installed, which this check is supposed to prevent.

Suggested change
if has_triton_kernels:
if has_triton_kernels():

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit

@facebook-github-bot
Copy link

@minosfuture has exported this pull request. If you are a Meta employee, you can view the originating diff in D82899108.

@facebook-github-bot
Copy link

@minosfuture has exported this pull request. If you are a Meta employee, you can view the originating diff in D82899108.

@facebook-github-bot
Copy link

@minosfuture has exported this pull request. If you are a Meta employee, you can view the originating diff in D82899108.

@facebook-github-bot
Copy link

@minosfuture has exported this pull request. If you are a Meta employee, you can view the originating diff in D82899108.

Summary:
Signed-off-by: Ming Yang <minos.future@gmail.com>

Pull Request resolved: vllm-project#25319

Handle triton kernel import exception in cases it is not available.

Test Plan: AMD DeepSeek test

Reviewed By: houseroad

Differential Revision:
D82899108

Privacy Context Container: L1370295

Signed-off-by: Ming Yang <minos.future@gmail.com>
@mgoin mgoin added ready ONLY add when PR is ready to merge/full CI is needed bug Something isn't working rocm Related to AMD ROCm labels Sep 22, 2025
@yeqcharlotte yeqcharlotte merged commit ba8d216 into vllm-project:main Sep 23, 2025
54 of 55 checks passed
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
Signed-off-by: Ming Yang <minos.future@gmail.com>
charlifu pushed a commit to ROCm/vllm that referenced this pull request Sep 25, 2025
Signed-off-by: Ming Yang <minos.future@gmail.com>
Signed-off-by: charlifu <charlifu@amd.com>
yewentao256 pushed a commit that referenced this pull request Oct 3, 2025
Signed-off-by: Ming Yang <minos.future@gmail.com>
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants