Skip to content

Conversation

Liangliang-Ma
Copy link
Contributor

@Liangliang-Ma Liangliang-Ma commented Jun 27, 2025

Purpose

We went through all the tests under v1/ with some local modification on xpu device and we found that to reuse v1 tests, the biggest gap is device hardcode. So in this PR we use current_platform class attributes and methods to take place them. After this one we will keep contributing some changes to let xpu(intel GPU) users get guaranteed by vllm tests.

Test Plan

To reuse tests on intel gpu.

Test Result

passed on cuda/xpu.

Copy link

👋 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 the rocm Related to AMD ROCm label Jun 27, 2025
Copy link

mergify bot commented Jun 27, 2025

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

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

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.

Summary of Changes

Hello @Liangliang-Ma, 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 addresses the issue of device hardcoding in the v1 tests, replacing them with a platform-agnostic approach using the current_platform class. This change enables the reuse of these tests on Intel GPUs (XPU) and other platforms, ensuring broader compatibility and easier testing across different hardware.

Highlights

  • Device Hardcoding: Replaced hardcoded device names (e.g., 'cuda') with the current_platform.device_name attribute in several test files to enable reusability across different platforms (Intel GPU/XPU, CUDA, ROCm).
  • Platform Abstraction: Utilized the current_platform class to abstract device-specific logic, allowing tests to adapt to the underlying hardware.
  • Device Count: Replaced cuda_device_count_stateless() with current_platform.device_count() to get the number of available devices in tests/conftest.py.
  • FlashInfer Availability: Added a conditional import for flashinfer.sampling based on is_flashinfer_available in tests/v1/sample/test_topk_topp_sampler.py.
  • V1 Support: Added XPU to the list of supported hardware platforms for V1 in vllm/engine/arg_utils.py.
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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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

The code changes aim to make the test suite platform-agnostic. A potential NameError and a bug in the test setup logic have been identified and addressed.

Comment on lines 219 to 222
# For rocm use upstream flash attention
from flash_attn import flash_attn_varlen_func
if current_platform.is_rocm():
from flash_attn import flash_attn_varlen_func
is_vllm_fa = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

If vllm._vllm_flash_attn is not importable, and the platform is not ROCm, then flash_attn_varlen_func will not be defined, leading to a NameError. To prevent this, ensure flash_attn_varlen_func is defined in the except block.

Suggested change
# For rocm use upstream flash attention
from flash_attn import flash_attn_varlen_func
if current_platform.is_rocm():
from flash_attn import flash_attn_varlen_func
is_vllm_fa = False
except ImportError:
# For rocm use upstream flash attention
if current_platform.is_rocm():
from flash_attn import flash_attn_varlen_func
else:
flash_attn_varlen_func = None
is_vllm_fa = False

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
@mergify mergify bot removed the needs-rebase label Jun 27, 2025
Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
@Liangliang-Ma
Copy link
Contributor Author

@chaojun-zhang thanks for comment. Yes it should be device_type especially when some platform have different value of device_name and device_type like rocm. Fixed in latest commit.

@Liangliang-Ma
Copy link
Contributor Author

@WoosukKwon @Isotr0py @DarkLight1337 @simon-mo could you please help to review this one? thanks

Copy link
Member

@Isotr0py Isotr0py left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look reasonable to me as long as tests can still pass!

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
@Isotr0py Isotr0py added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 1, 2025
@DarkLight1337 DarkLight1337 merged commit a0389e0 into vllm-project:main Jul 2, 2025
80 checks passed
@Liangliang-Ma Liangliang-Ma deleted the xpu branch July 2, 2025 01:11
CSWYF3634076 pushed a commit to CSWYF3634076/vllm that referenced this pull request Jul 2, 2025
… tests (vllm-project#20169)

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
avigny pushed a commit to avigny/vllm that referenced this pull request Jul 31, 2025
… tests (vllm-project#20169)

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
Signed-off-by: avigny <47987522+avigny@users.noreply.github.com>
Pradyun92 pushed a commit to Pradyun92/vllm that referenced this pull request Aug 6, 2025
… tests (vllm-project#20169)

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
… tests (vllm-project#20169)

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
googlercolin pushed a commit to googlercolin/vllm that referenced this pull request Aug 29, 2025
… tests (vllm-project#20169)

Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants