-
-
Notifications
You must be signed in to change notification settings - Fork 20.4k
[ROCm][AITER] Fix AITER import regression for explicit backend selection #33749
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
Changes from 4 commits
1fc9099
73b955b
5dad48b
d25da82
5694ee3
d035fdf
50a2a3b
4584923
805a370
79218dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,15 @@ def flash_attn_varlen_func(*args: Any, **kwargs: Any) -> Any: # type: ignore[no | |
| "to be installed. Please install flash-attn first." | ||
| ) | ||
|
|
||
| # ROCm doesn't use scheduler metadata (FA3 feature), provide stub | ||
| def get_scheduler_metadata(*args: Any, **kwargs: Any) -> None: # type: ignore[misc] | ||
| return None | ||
|
|
||
| # ROCm uses the C++ custom op for reshape_and_cache | ||
| from vllm import _custom_ops as ops | ||
|
|
||
| reshape_and_cache_flash = ops.reshape_and_cache_flash | ||
|
|
||
|
|
||
| def get_flash_attn_version(requires_alibi: bool = False) -> int | None: | ||
| # import here to avoid circular dependencies | ||
|
|
@@ -128,4 +137,19 @@ def flash_attn_supports_mla(): | |
|
|
||
|
|
||
| def is_flash_attn_varlen_func_available() -> bool: | ||
| return current_platform.is_cuda() or current_platform.is_xpu() | ||
| if current_platform.is_cuda() or current_platform.is_xpu(): | ||
| return True | ||
|
|
||
| # On ROCm, flash_attn_varlen_func is provided by the aiter package | ||
| # not vllm_flash_attn extension. This function checks CAPABILITY | ||
| # (can it work?) not PREFERENCE (should it be used by default?). | ||
| # Tests and other code use this to determine if the functionality | ||
| # exists on the system, regardless of VLLM_ROCM_USE_AITER. | ||
| # We use is_aiter_found_and_supported() instead of importing aiter directly | ||
| # to avoid triggering JIT compilation warnings during the availability check. | ||
| if current_platform.is_rocm(): | ||
| from vllm._aiter_ops import is_aiter_found_and_supported | ||
|
|
||
| return is_aiter_found_and_supported() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This condition does not fit the current situation of the code. This Let me piece up more context. But I will need sometime.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did my recent commit remedy (a little bit) your concern? If possible, we would like this PR merged because the whole AITER_FA pipeline is currently broken on our CI. We could work on optimizing this on a follow-up PR. |
||
|
|
||
| return False | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chain of bugfix is caused by not doing lazy import for aiter. Especially this DTYPE issue.
I have looked further into the issue. I have doubled check the definition of dtype from AITER, it is the same as
current_platform.fp8_dtype(). So we don't have to import dtype here from aiter.https://github.com/ROCm/aiter/blob/6af8b687480509d67f42a69bca7ed092c432e8dc/aiter/utility/dtypes.py#L15 (commit used in
Dockerfile.rocm_base, it is the same definition)https://github.com/ROCm/aiter/blob/12fe5f0291dad871584db71c49a4c33556519bbf/aiter/utility/dtypes.py#L17 (even on latest main commit, it is the same definition)
So the suggested changes in this file is to define this at the top of the file.
replace all the
_FP8_DTYPEandAITER_FP8_DTYPEwithFP8_DTYPE.We don't need this section of the code
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have validated locally with the following command.
The ops that are relying on this OP are fusion pass op of rmsnorm and blockquant.
Log showing replacement occurs
The lmeval score is