-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
[UT][intel GPU] use current_platform instead of device hardcode in v1 tests #20169
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
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 |
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 @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()
withcurrent_platform.device_count()
to get the number of available devices intests/conftest.py
. - FlashInfer Availability: Added a conditional import for
flashinfer.sampling
based onis_flashinfer_available
intests/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
-
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. ↩
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
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.
# 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 |
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.
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.
# 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>
Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
@chaojun-zhang thanks for comment. Yes it should be |
@WoosukKwon @Isotr0py @DarkLight1337 @simon-mo could you please help to review this one? thanks |
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.
Look reasonable to me as long as tests can still pass!
Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
… tests (vllm-project#20169) Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
… tests (vllm-project#20169) Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com> Signed-off-by: avigny <47987522+avigny@users.noreply.github.com>
… tests (vllm-project#20169) Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
… tests (vllm-project#20169) Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com> Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
… tests (vllm-project#20169) Signed-off-by: Ma, Liangliang <liangliang.ma@intel.com>
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.