-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
[Hardware][PPC64LE] Enable V1 for ppc64le and ARM #20554
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
[Hardware][PPC64LE] Enable V1 for ppc64le and ARM #20554
Conversation
Signed-off-by: Akash Kaothalkar <[email protected]>
Signed-off-by: Akash Kaothalkar <[email protected]>
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 @Akashcodes732, 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 focuses on extending VLLM's V1 engine support to the IBM POWER (ppc64le) architecture. It addresses platform-specific requirements by conditionally disabling chunked prefill and introducing tailored CPU binding optimizations to ensure efficient and compatible operation on POWER systems, in anticipation of the V0 engine's deprecation.
Highlights
- V1 Engine Enablement for PPC64LE: This pull request primarily enables the V1 engine for IBM POWER (ppc64le) architecture, aligning with the ongoing deprecation of the V0 engine.
- Conditional Chunked Prefill Disablement: It introduces logic to automatically disable chunked prefill when the V1 engine is used on POWER CPUs, as this feature is not supported on ppc64le.
- Optimized CPU Binding for PPC64LE: A specialized CPU binding strategy is implemented for ppc64le systems. This new logic selects an optimal subset of threads per core to prevent oversubscription and enhance performance, robustly handling different SMT modes.
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
This pull request enables V1 Engine support for the ppc64le (IBM POWER) architecture by disabling chunked prefill and adding optimized CPU binding logic. Consider refactoring the CPU binding logic in vllm/v1/worker/cpu_worker.py
to reduce code duplication and improve maintainability.
def get_cpus_id_binding_based_on_numa_nodes_ppc64le(self) -> str: | ||
""" | ||
Power (ppc64le) specific: Selects a subset of threads per core for | ||
each NUMA node.This is robust to SMT mode (SMT-8, SMT-4, etc) | ||
because the OS only exposes available threads.This maximizes | ||
performance by avoiding oversubscription of logical CPUs on Power. | ||
""" | ||
|
||
def select_threads_per_power_core(node_cpu_ids): | ||
return [cpu for cpu in node_cpu_ids if cpu % 8 < 4] | ||
|
||
rank_to_cpus = self.local_omp_cpuid | ||
world_size = self.vllm_config.parallel_config.world_size | ||
libnuma_found = util.find_spec("numa") is not None | ||
psutil_found = util.find_spec("psutil") is not None | ||
if libnuma_found and psutil_found: | ||
import psutil | ||
from numa import info | ||
cpus_allow_list = psutil.Process().cpu_affinity() | ||
numa_size = info.get_num_configured_nodes() | ||
|
||
node_to_cpus = [] | ||
for i in range(numa_size): | ||
node_intersect = set( | ||
info.node_to_cpus(i)).intersection(cpus_allow_list) | ||
if bool(node_intersect): | ||
node_to_cpus.append(sorted(list(node_intersect))) | ||
|
||
if world_size > len(node_to_cpus): | ||
logger.error( | ||
"Auto thread-binding failed due to " | ||
"world size: %d is larger than " | ||
"allowed NUMA nodes number: %d." | ||
"Please try to bind threads manually.", world_size, | ||
len(node_to_cpus)) | ||
else: | ||
node_cpus_this_rank = node_to_cpus[self.rank] | ||
node_cpus_this_rank = select_threads_per_power_core( | ||
node_cpus_this_rank) | ||
cpu_count_per_numa = len(node_cpus_this_rank) | ||
num_of_reserved_cpu = min(envs.VLLM_CPU_NUM_OF_RESERVED_CPU, | ||
cpu_count_per_numa // 2) | ||
end = cpu_count_per_numa - num_of_reserved_cpu | ||
rank_to_cpus_list = node_cpus_this_rank[:end] | ||
rank_to_cpus = ','.join(str(x) for x in rank_to_cpus_list) | ||
logger.info("ppc64le thread-binding list: %s", rank_to_cpus) | ||
else: | ||
logger.warning( | ||
"Auto thread-binding is not supported due to " | ||
"the lack of package numa and psutil," | ||
"fallback to no thread-binding. To get better performance," | ||
"please try to manually bind threads.") | ||
return rank_to_cpus |
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.
👋 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 🚀 |
Signed-off-by: Akash Kaothalkar <[email protected]>
Signed-off-by: Akash Kaothalkar <[email protected]>
Hi @WoosukKwon , @njhill , @comaniac , @alexm-redhat , @robertgshaw2-redhat , @ywang96 , can you please review this PR ? |
Co-authored-by: Nikhil Gupta <[email protected]> Signed-off-by: Akash Kaothalkar <[email protected]>
Co-authored-by: Nikhil Gupta <[email protected]> Signed-off-by: Akash Kaothalkar <[email protected]>
55e0687
to
de11286
Compare
Signed-off-by: Akash Kaothalkar <[email protected]>
Hi @DarkLight1337 , @bigPYJ1151 can someone please review this ? |
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.
LGTM, thanks for fixing!
Signed-off-by: Akash Kaothalkar <[email protected]> Co-authored-by: Akash Kaothalkar <[email protected]> Co-authored-by: Nikhil Gupta <[email protected]>
Signed-off-by: Akash Kaothalkar <[email protected]> Co-authored-by: Akash Kaothalkar <[email protected]> Co-authored-by: Nikhil Gupta <[email protected]> Signed-off-by: Patrick von Platen <[email protected]>
Signed-off-by: Akash Kaothalkar <[email protected]> Co-authored-by: Akash Kaothalkar <[email protected]> Co-authored-by: Nikhil Gupta <[email protected]>
# Disable chunked prefill for POWER (ppc64le)/ARM CPUs in V1 | ||
if current_platform.is_cpu( | ||
) and current_platform.get_cpu_architecture() in ( | ||
CpuArchEnum.POWERPC, CpuArchEnum.ARM): | ||
logger.info( | ||
"Chunked prefill is not supported for ARM and POWER CPUs; " | ||
"disabling it for V1 backend.") | ||
self.enable_chunked_prefill = 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.
@Akashcodes732 Curious how the V1 scheduler supports no chunked prefill for POWER (ppc64le)/ARM CPUs? The chunking logic in scheduler cannot be turned off right?
Signed-off-by: Akash Kaothalkar <[email protected]> Co-authored-by: Akash Kaothalkar <[email protected]> Co-authored-by: Nikhil Gupta <[email protected]> Signed-off-by: avigny <[email protected]>
Signed-off-by: Akash Kaothalkar <[email protected]> Co-authored-by: Akash Kaothalkar <[email protected]> Co-authored-by: Nikhil Gupta <[email protected]>
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.FIX #20622
Purpose
This PR enables V1 Engine for IBM POWER, as V0 Engine would be deprecated (#20437, #20412).
As chunked prefill is not supported on ppc64le, this PR turns off chunked prefill in case of ppc64le.
Also, the CPU binding logic is not optimized for POWER (The issue and its impact are described in detail in #20089. #20387 ), this PR adds that logic in case of V1 as well.
Test Plan
Local testing
Test Result
(Optional) Documentation Update