Skip to content

[Bug] [ROCm] Fix AiterFAMetadata Import Error when AITER is not installed#23106

Closed
tjtanaa wants to merge 1 commit intovllm-project:mainfrom
EmbeddedLLM:fix-spec-dec-noaiter
Closed

[Bug] [ROCm] Fix AiterFAMetadata Import Error when AITER is not installed#23106
tjtanaa wants to merge 1 commit intovllm-project:mainfrom
EmbeddedLLM:fix-spec-dec-noaiter

Conversation

@tjtanaa
Copy link
Copy Markdown
Collaborator

@tjtanaa tjtanaa commented Aug 18, 2025

Purpose

Simple fix to the issue raised in #22795

Test Plan

Test Result

(Optional) Documentation Update


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.

Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
@mergify mergify bot added rocm Related to AMD ROCm v1 labels Aug 18, 2025
Copy link
Copy Markdown
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

The pull request aims to fix an ImportError for the ROCm AITer FlashAttention backend when the aiter package is not installed. The change correctly adds a check for the aiter package before attempting to import it. However, this fix is incomplete and can lead to a runtime error if the backend is selected for use without aiter being installed. My review includes a comment explaining the issue and suggesting a more robust fix by making all aiter-dependent class definitions conditional, which is a common pattern in this codebase for handling optional dependencies.

_PARTITION_SIZE_ROCM = 256

if current_platform.is_rocm():
if current_platform.is_rocm() and find_spec("aiter"):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

While this change correctly prevents an ImportError at module load time if aiter is not installed, it can lead to a RuntimeError later.

The classes AiterFlashAttentionMetadata, AiterFlashAttentionMetadataBuilder, AiterFlashAttentionBackend, and AiterFlashAttentionImpl are defined later in this file (from line 207 onwards) and they depend on the aiter package and the custom ops registered within this if block.

If aiter is not installed, this if block is skipped, but the classes are still defined. When AiterFlashAttentionBackend is used, it will try to call ops that were not registered, leading to a crash.

To fix this properly, all the definitions that depend on aiter should be moved inside this if block. This includes lines 204 through 547. This will ensure that the AiterFlashAttentionBackend is only available when aiter is installed, preventing runtime errors.

A similar pattern is used for other attention backends with optional dependencies, like flash_attn.

@github-actions
Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

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

Labels

rocm Related to AMD ROCm v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant