Skip to content

Conversation

@mgoin
Copy link
Member

@mgoin mgoin commented Nov 10, 2025

Purpose

In #24490 there was an addition of a new import for rocm.py

Without this change, you can see the rocm import warnings on nvidia devices by default

WARNING 11-10 22:31:06 [rocm.py:39] Failed to import from amdsmi with ModuleNotFoundError("No module named 'amdsmi'")
WARNING 11-10 22:31:06 [rocm.py:50] Failed to import from vllm._rocm_C with ModuleNotFoundError("No module named 'vllm._rocm_C'")

Thanks to @tjtanaa, he pointed out there was an oversight and the ops class should act as a no-op when it is on non-ROCm platform and aiter is not installed.

I found the culprit using

import traceback
print(traceback.print_stack())

Output:

python benchmarks/kernels/bench_block_fp8_gemm.py
Printing stack trace
  File "/home/mgoin/code/vllm/benchmarks/kernels/bench_block_fp8_gemm.py", line 6, in <module>
    from vllm.model_executor.layers.quantization.utils.fp8_utils import (
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/mgoin/code/vllm/vllm/model_executor/layers/quantization/utils/fp8_utils.py", line 15, in <module>
    from vllm._aiter_ops import rocm_aiter_ops
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/mgoin/code/vllm/vllm/_aiter_ops.py", line 941, in <module>
    rocm_aiter_ops.register_ops_once()
  File "/home/mgoin/code/vllm/vllm/_aiter_ops.py", line 35, in wrapper
    from vllm.platforms.rocm import on_gfx9
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/mgoin/code/vllm/vllm/platforms/rocm.py", line 27, in <module>
    print(traceback.print_stack())

Test Plan

Test Result


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.

@mergify mergify bot added the rocm Related to AMD ROCm label Nov 10, 2025
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 correctly addresses an issue where importing rocm_aiter_ops at the module level in fp8_utils.py caused unnecessary warnings on non-ROCm platforms. By moving the import into the _run_aiter method, it becomes a lazy import, ensuring that ROCm-specific code is only loaded when it is actually used. This change is clean, effective, and has no significant performance impact. The fix is well-implemented and resolves the reported problem.

Copy link
Member

@yewentao256 yewentao256 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the work!

@yewentao256 yewentao256 added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 10, 2025
Signed-off-by: mgoin <[email protected]>
@mgoin mgoin requested a review from tjtanaa as a code owner November 10, 2025 23:07
@mgoin mgoin changed the title Lazy import aiter rocm in fp8_utils.py Only register rocm_aiter_ops if aiter is found Nov 10, 2025
Signed-off-by: mgoin <[email protected]>
@mgoin mgoin added this to the v0.11.1 milestone Nov 10, 2025
Copy link
Collaborator

@tjtanaa tjtanaa left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for the fix.

@tjtanaa tjtanaa enabled auto-merge (squash) November 10, 2025 23:51
@tjtanaa tjtanaa merged commit f2d9ad0 into vllm-project:main Nov 11, 2025
47 checks passed
@mgoin mgoin deleted the lazy-aiter-import-fp8 branch November 11, 2025 12:28
xuebwang-amd pushed a commit to xuebwang-amd/vllm that referenced this pull request Nov 13, 2025
khluu pushed a commit that referenced this pull request Nov 16, 2025
khluu pushed a commit that referenced this pull request Nov 16, 2025
devpatelio pushed a commit to SumanthRH/vllm that referenced this pull request Nov 29, 2025
charlotte12l pushed a commit to charlotte12l/vllm that referenced this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants