-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[Hardware][AMD] integrate aiter into vllm #17710
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
base: main
Are you sure you want to change the base?
Conversation
👋 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 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 🚀 |
This pull request has merge conflicts that must be resolved before it can be |
This pull request has merge conflicts that must be resolved before it can be |
What is the minimal AITER commit that has the required functionality? |
This pull request has merge conflicts that must be resolved before it can be |
vllm/platforms/rocm.py
Outdated
logger.info("Using Triton Attention backend on V1 engine.") | ||
return ("vllm.v1.attention.backends." | ||
"triton_attn.TritonAttentionBackend") | ||
if envs.VLLM_ROCM_USE_AITER and envs.VLLM_ROCM_USE_AITER_MHA: |
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.
should we add on_mi250_mi300()
to the condition?
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.
MHA should be used in mi350 too. I won't add the condition.
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.
LGTM.
It is fine to leave the condition out if we don't expect Radeon GPU users to use AITER.
How to run? |
The steps are:
Can you provide lm_eval of non-AITER as baseline reference as well? |
# Whether to use aiter mha ops. | ||
# By default is enabled. | ||
"VLLM_ROCM_USE_AITER_MHA": | ||
lambda: (os.getenv("VLLM_ROCM_USE_AITER_MHA", "True").lower() in |
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.
Do we want to override #16828 by default?
Signed-off-by: fsx950223 <[email protected]>
I found there should be a pa kernel to optimize kernel performance when query len=1. A commit will be submitted. |
Signed-off-by: fsx950223 <[email protected]>
Done. |
Signed-off-by: fsx950223 <[email protected]>
Wouldn't it make more sense to create a new v1 attention backend called |
@tdoublep do you think this is a must? We can do it but need some extra time to re-organize the code. as aiter_attn is very similar to flash_attn and it has a big impact to the performance. can we have this flash_attn changed at first and then reconstruct it to a new one as next step? |
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: fsx950223 <[email protected]>
Signed-off-by: fsx950223 <[email protected]>
Done |
@@ -80,6 +80,7 @@ | |||
VLLM_ROCM_USE_AITER_MOE: bool = True | |||
VLLM_ROCM_USE_AITER_RMSNORM: bool = True | |||
VLLM_ROCM_USE_AITER_MLA: bool = True | |||
VLLM_ROCM_USE_AITER_MHA: bool = True |
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.
wondering what's difference between VLLM_ROCM_USE_AITER and VLLM_ROCM_USE_AITER_MHA?
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.
wondering what's difference between VLLM_ROCM_USE_AITER and VLLM_ROCM_USE_AITER_MHA?
Main switch and submodule switch.
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: fsx950223 <[email protected]>
Signed-off-by: fsx950223 <[email protected]>
) | ||
rocm_aiter_rms_norm = torch.ops.vllm.rocm_aiter_rms_norm | ||
|
||
except AttributeError: |
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 think we don't need to use the try catch statement. Because the registration must work as vLLM is going to deprecate V0. If registration does not work when aiter is present on ROCm env, this could mean there is a bug.
An example unit tests to check if the registration works is as follows https://github.com/vllm-project/vllm/blob/main/tests/kernels/moe/test_rocm_aiter_topk.py
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.
Done
Signed-off-by: fsx950223 <[email protected]>
@fsx950223 does this feature works with AITER commit: c1debd87ce0391aa27438d9e07e76e4fea7c4b70 ? If you could share us the AITER commit that you are using, we could also try to validate if other AITER kernels needs to be fixed. |
I use aiter main branch directly. |
CMD: VLLM_TORCH_PROFILER_DIR=/mnt/raid0/sixifang/vllm/vllm_profile HIP_VISIBLE_DEVICES=4,5,6,7 VLLM_ROCM_USE_AITER=1 VLLM_USE_V1=1 vllm serve /models/models--amd--Meta-Llama-3.1-8B-Instruct-FP8-KV/snapshots/fa42f9a9105c545755fea25cf69f49ac8c8b40e1/ --tensor-parallel-size 4 --gpu-memory-utilization 0.9 --trust-remote-code --disable-log-requests --block-size 16 --max-model-len 32768 --dtype float16 --quantization fp8 --no-enable-prefix-caching --max-num-batched-tokens=8192
Performance without aiter:

Performance with aiter:
