-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[ROCm][FEAT] Integrate AITER gemm w8a8 ptpc #19417
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
Co-authored-by: tjtanaa tunjian.tan@embeddedllm.com Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
👋 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 🚀 |
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.
Summary of Changes
Hello @vllmellm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces support for using ROCm AITER kernels for W8A8 linear layers, specifically for per-token activation and per-channel weight quantization on MI3XX GPUs. It includes the necessary logic to enable the AITER kernel based on configuration, handles the required weight format, and adds tests to ensure correct functionality and compatibility with PyTorch's compilation features. The author has provided test results showing performance metrics with AITER enabled on specific FP8 dynamic models.
Highlights
- ROCm AITER Integration: Integrated ROCm AITER kernels specifically for W8A8 (per-token activation, per-channel weight) GEMM operations, targeting MI3XX hardware.
- Conditional Kernel Dispatch: Implemented logic to conditionally dispatch the AITER GEMM kernel based on platform (ROCm), hardware (MI3XX), and environment variables (
VLLM_ROCM_USE_AITER
,VLLM_ROCM_USE_AITER_LINEAR
). - Weight Layout Handling: Modified the weight processing for W8A8 compressed tensors to handle AITER's requirement for a shuffled (N, K) weight layout, applying the shuffle during weight loading if AITER is enabled.
- New AITER Tests: Added a new test file to verify the registration of the custom AITER GEMM op and its compatibility with
torch.compile
. - AITER Dependency Update: Updated the AITER dependency version specified in the ROCm base Dockerfile.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request integrates AITER GEMM w8a8 operations for ROCm, including tests, utility functions, and dispatch logic. Key areas for attention include numerical tolerances in tests, clarifying parameter usage, and adding comments to explain key steps.
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
Signed-off-by: vllmellm <vllm.ellm@embeddedllm.com>
This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you! |
Essential Elements of an Effective PR Description Checklist
Purpose
This PR introduces a new kernel from the
aiter package
,gemm_a8w8_bpreshuffle_CK
, which supports FP8 quantization of per-token activations and per-channel weights for linear layers.This PR upgrades
aiter package
to a newer commit 636a9f0.Important:
vllm/vllm/model_executor/layers/quantization/utils/w8a8_utils.py
Line 368 in da9b523
We have added to check the dimension of the tensors due to the following reason in Per-Token Quantization Scheme:
the
x_scale.shape
is the edge case that the condition fails to catch. This is when there is1
token and it is a per-token scaled weight.x_scale
has the shape(num_tokens, num_of_scale_value)
:torch.Size([1, 1])
Model that has been used to test this is
EmbeddedLLM/Qwen2.5-7B-Instruct-FP8-Dynamic
linkThe following is the shape of the
weight_scale
andx_scale
for Per-Tensor quantized model:RedHatAI/Meta-Llama-3-8B-Instruct-FP8-KV
We used the condition
x_scale.dim() < 2
to cover the case to handle the case where the per-tensor scale can take the form of zero-dimension tensor or single dimension tensor of size 1.Test Plan
VLLM_USE_V1=1 VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_MOE=0 VLLM_ROCM_USE_AITER_RMSNORM=0 SAFETENSORS_FAST_GPU=1 lm_eval --model vllm --model_args pretrained=RedHatAI/Llama-4-Scout-17B-16E-Instruct-FP8-dynamic,tensor_parallel_size=4,max_model_len=4086 --tasks gsm8k --num_fewshot 5 --batch_size auto
VLLM_USE_V1=1 VLLM_ROCM_USE_AITER=1 VLLM_ROCM_USE_AITER_MOE=0 VLLM_ROCM_USE_AITER_RMSNORM=0 SAFETENSORS_FAST_GPU=1 lm_eval --model vllm --model_args pretrained=RedHatAI/Qwen3-235B-A22B-FP8-dynamic,tensor_parallel_size=4,max_model_len=4086 --tasks gsm8k --num_fewshot 5 --batch_size auto
Test Result
Online Serving Benchmarking Results
commands:
vllm serve $model_name --distributed-executor-backend mp --swap-space 16 --disable-log-requests
python benchmarks/benchmark_serving.py --backend vllm --model "$model_name" --dataset-name random --num-prompts 50 --goodput "ttft:3000" "tpot:50" --random-input-len 1000 --random-output-len 1000 --random-range-ratio 0.9