Skip to content

Conversation

MengqingCao
Copy link
Contributor

@MengqingCao MengqingCao commented Oct 13, 2025

Purpose

Fix triton import error in the scenario that triton is not installed. Actually we have make CI on this problem in #17716. However not sure why it is ineffective since this commit in https://github.com/vllm-project/vllm/pull/24440/commits. This pr is a quick fix on this issue

Test Plan

CI passed with pre-commit

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

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 fix a Triton import error when Triton is not installed by using the project's utility vllm.triton_utils. The change is correct in principle, but it introduces a runtime AttributeError because the TritonPlaceholder does not implement cdiv. I've added a critical comment with a suggestion to fix this within the changed file.

import triton.language as tl
from torch.library import wrap_triton

from vllm.triton_utils import tl, triton
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

While this change correctly uses the vllm.triton_utils placeholder for optional Triton import, it introduces a runtime error. The TritonPlaceholder used when Triton is not installed does not define the cdiv method. This file calls triton.cdiv in triton_mx_block_rearrange (lines 108, 109, 126, 127), which will raise an AttributeError if Triton is not present.

To fix this, you should replace all calls to triton.cdiv in this file with the local ceil_div function. This function is already defined at line 144 and used for the same purpose in the to_blocked function.

Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

See #26654

@MengqingCao
Copy link
Contributor Author

See #26654

Closing as duplicated with #26654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants