Skip to content

Conversation

@fengli1702
Copy link
Contributor

@fengli1702 fengli1702 commented Aug 8, 2025

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.

Purpose

Add support for running FP4 quantized models on AMD CDNA2 / CDNA3 GPUs via a new quantization backend petit_nvfp4. This enables vLLM to serve models such as Llama-3.1 / Llama-3.3

Test Plan

Verified that ROCm backend without --quantization still runs normally, and automatically selects the petit-kernel FP4 path when loading FP4 quantized models.

Installed optional dependencies via:

pip install -e .[petit-kernel]

Ran test with:

from vllm import LLM, SamplingParams
llm = LLM(model="/path/to/llama-fp4", enforce_eager=True)  # no quantization arg
prompt = "San Francisco is a"
output = llm.generate(prompt, SamplingParams(temperature=0, max_tokens=15))
print(output[0].outputs[0].text)

Confirmed that the FP4 path (petit-kernel) is selected automatically and outputs are generated successfully.

Test Result

Functional test passed: FP4 quantized models load and run inference successfully on ROCm (MI250/MI300 test nodes) without specifying --quantization.

Non-quantized ROCm inference path unaffected.

Verified via log output that petit-kernel module is loaded when using FP4 models.

(Optional) Documentation Update

Added fp4 extras in setup.py for optional dependency installation.

@github-actions
Copy link

github-actions bot commented Aug 8, 2025

👋 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 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 either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added ci/build rocm Related to AMD ROCm labels Aug 8, 2025
@fengli1702 fengli1702 changed the title feat(quantization): support FP4 quantized models on AMD CDNA2/CDNA3 GPUs Quantization: support FP4 quantized models on AMD CDNA2/CDNA3 GPUs Aug 8, 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 adds support for FP4 quantized models on AMD GPUs using the petit-kernel. The changes look mostly good, with new quantization configurations and utility functions. However, I found a critical issue in the PetitNvFp4Config.from_config method where it uses direct dictionary access for optional keys, which can lead to a KeyError and crash the application if the keys are not present in the configuration file. I've suggested a more robust implementation for this method to handle missing keys gracefully.

@fengli1702 fengli1702 force-pushed the main branch 2 times, most recently from 2855577 to 4725634 Compare August 8, 2025 15:58
@mergify
Copy link

mergify bot commented Aug 9, 2025

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

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

@mergify mergify bot added the needs-rebase label Aug 9, 2025
@fengli1702 fengli1702 force-pushed the main branch 2 times, most recently from bbbab70 to 2f217ff Compare August 9, 2025 01:17
@mergify mergify bot removed the needs-rebase label Aug 9, 2025
@fengli1702 fengli1702 force-pushed the main branch 7 times, most recently from 55b4398 to 8e11c88 Compare August 12, 2025 01:09
@mergify
Copy link

mergify bot commented Aug 12, 2025

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

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

Copy link
Member

@mgoin mgoin 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 quick response!

@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 22, 2025
@mgoin mgoin merged commit fa78de9 into vllm-project:main Aug 23, 2025
78 checks passed
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
Signed-off-by: Xiao Yu <xiao.yu@amd.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Sep 3, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
ekagra-ranjan pushed a commit to ekagra-ranjan/vllm that referenced this pull request Sep 4, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
Signed-off-by: Ekagra Ranjan <3116519+ekagra-ranjan@users.noreply.github.com>
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
…llm-project#22527)

Signed-off-by: feng <fengli1702@gmail.com>
Signed-off-by: Michael Goin <mgoin64@gmail.com>
Co-authored-by: Michael Goin <mgoin64@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build 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