Skip to content

[ROCm] [Feature] [Doc] [Dockerfile] Support Per-Token-Activation Per-Channel-Weight FP8 Quantization Inferencing #12499

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

Closed
wants to merge 104 commits into from

Conversation

tjtanaa
Copy link
Contributor

@tjtanaa tjtanaa commented Jan 28, 2025

Support Per-Token-Activation Per-Channel-Weight FP8 Quantization Inferencing

Note: This PR feature requires ROCm 6.3 and later and GPU Arch MI300 and later.

Description

This PR involves the following enhancements

  1. This is a PR specific to support Per-Token-Activation Per-Channel-Weight (PTPC-FP8) FP8 Quantization Inferencing.
    The model will be quantized on-the-fly from BFloat16 to FP8. Model weight which are store in Float16 will need to be casted into BFloat16.

  2. It used PyTorch latest rowwise scaled GEMM feature in torch._scaled_mm which is introduced in [ROCm] hipblaslt rowwise f8 gemm pytorch/pytorch#144432 , which speeds up current naive implementation by at least 2 times. For more details check out the Performance section

  • To support this feature, the Dockerfile.rocm_base PyTorch repo commit has been updated to 3a585126.
  • Dockerfile.rocm is left untouched as the base image is referencing to AMD docker hub registry. That base image at this point in time has already installed with PyTorch repo commit 3a585126.
  1. Small enhancement. The documentation has been updated to ROCm 6.3 and various commits in the installation step has been updated to match the commits in Dockerfile.rocm_base.

Performance

Perplexity Test

Model: Llama-3.1-8B-Instruct
Dataset: Wikitexts
GPU: MI300X

Model Quantization KVCacheDtype Tasks Metric Metric Score
Llama-3.1-8B-Instruct/ auto (bf16) auto (bf16) wikitext word_perplexity 9.4281
Llama-3.1-8B-Instruct/ fp8 fp8_e4m3 wikitext word_perplexity 9.5124
Llama-3.1-8B-Instruct/ ptpc_fp8 fp8_e4m3 wikitext word_perplexity 9.5093
Llama-3.1-8B-Instruct/ ptpc_fp8 (naive) fp8_e4m3 wikitext word_perplexity 9.5095

Speed Test (Old naive implementation vs torch._scaled_mm rowwise scaled GEMM feature)

Model: Llama-3.1-70B-Instruct
Dataset: SharedGPT
GPU: 1xMI300X

Quantization KVCacheDType Req/s Total token/s Output tokens/s
ptpc_fp8 (naive) fp8_e4m3 2.43 1003.46 481.28
ptpc_fp8 (torch._scaled_mm rowwise scaled GEMM feature) fp8_e4m3 6.36 2631.04 1261.91

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added documentation Improvements or additions to documentation ci/build labels Jan 28, 2025
kliuae and others added 24 commits January 28, 2025 06:04
Signed-off-by: kliuae <kuanfu.liu@embeddedllm.com>
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
…12244)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: Mengqing Cao <cmq0113@163.com>
Signed-off-by: youkaichao <youkaichao@gmail.com>
…ed (vllm-project#10802)

Signed-off-by: Jannis Schönleber <joennlae@gmail.com>
Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
Signed-off-by: Andy Lo <andy@mistral.ai>
Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
…shes (vllm-project#12277)

Signed-off-by: maleksan85 <maleksan@amd.com>
Co-authored-by: maleksan85 <maleksan@amd.com>
…for perf validation purpose (vllm-project#12281)

Signed-off-by: Hongxia Yang <hongxyan@amd.com>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
DarkLight1337 and others added 12 commits January 28, 2025 06:11
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…12454)

Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
Signed-off-by: Isotr0py <2037008807@qq.com>
…t#12339)

Signed-off-by: Lucas Wilkinson <lwilkinson@neuralmagic.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
…12469)

Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
Signed-off-by: Bowen Wang <abmfy@icloud.com>
Signed-off-by: youkaichao <youkaichao@gmail.com>
Co-authored-by: youkaichao <youkaichao@gmail.com>
…robs` with ChunkedPrefill (vllm-project#10132)

Signed-off-by: NickLucche <nlucches@redhat.com>
Signed-off-by: wallashss <wallashss@ibm.com>
Co-authored-by: wallashss <wallashss@ibm.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…vllm-project#11277)

Signed-off-by: Liangfu Chen <liangfc@amazon.com>
Co-authored-by: Jiangfei Duan <jfduan@outlook.com>
Signed-off-by: mgoin <michael@neuralmagic.com>
Copy link

mergify bot commented Jan 28, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @tjtanaa.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@tjtanaa tjtanaa marked this pull request as draft January 28, 2025 06:12
@tjtanaa
Copy link
Contributor Author

tjtanaa commented Jan 28, 2025

This PR is closed as the git history is messed up. The PR is replaced by #12501

@tjtanaa tjtanaa closed this Jan 28, 2025
@tjtanaa tjtanaa deleted the ptpc-fp8-rocm branch February 25, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build documentation Improvements or additions to documentation frontend needs-rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.