Skip to content

[Hardware][Power]Add Power VSX Attention Backend and fix l2 Cache Crash - #40451

Merged
vllm-bot merged 11 commits into
vllm-project:mainfrom
Akashcodes732:feat/power_vsx_backend
May 5, 2026
Merged

[Hardware][Power]Add Power VSX Attention Backend and fix l2 Cache Crash#40451
vllm-bot merged 11 commits into
vllm-project:mainfrom
Akashcodes732:feat/power_vsx_backend

Conversation

@Akashcodes732

Copy link
Copy Markdown
Contributor

Purpose

This PR adds native PowerPC (ppc64le) VSX support for the vLLM CPU backend and resolves a initialization crash caused by IndexError: unordered_map::at.

Test Plan

vllm serve ibm-granite/granite-3.3-8b-instruct --port 8000 --max-model-len 512 --max-num-batched-tokens 8192 --dtype bfloat16 

Test Result

============ Serving Benchmark Result ============
Successful requests:                     100       
Failed requests:                         0         
Benchmark duration (s):                  87.22     
Total input tokens:                      12800     
Total generated tokens:                  3200      
Request throughput (req/s):              1.15      
Output token throughput (tok/s):         36.69     
Peak output token throughput (tok/s):    200.00    
Peak concurrent requests:                100.00    
Total token throughput (tok/s):          183.44    
---------------Time to First Token----------------
Mean TTFT (ms):                          46663.89  
Median TTFT (ms):                        39152.59  
P99 TTFT (ms):                           61091.73  
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          1297.55   
Median TPOT (ms):                        1534.57   
P99 TPOT (ms):                           1546.81   
---------------Inter-token Latency----------------
Mean ITL (ms):                           1297.55   
Median ITL (ms):                         854.39    
P99 ITL (ms):                            21945.52  

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.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added cpu Related to CPU backends v1 labels Apr 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 introduces VSX (PowerPC) support for the CPU attention backend, including a dedicated VSX implementation for attention kernels and updates to the dispatch and architecture detection logic. Critical issues were identified in the new VSX implementation, including a vector merging bug on little-endian systems and incorrect pointer arithmetic when handling 16-bit types. Furthermore, there are opportunities to optimize performance by vectorizing the half-precision loading logic and to improve the robustness of the L2 cache size detection globally to prevent potential crashes.

Comment thread csrc/cpu/cpu_attn_vsx.hpp
Comment thread csrc/cpu/cpu_attn_vsx.hpp Outdated
Comment on lines +306 to +324
if constexpr (is_bf16) {
__vector float v0, v1;
load_row8_B_as_f32<scalar_t>(curr_src + d, v0, v1);

v0 = vec_mul(v0, scale_vec);
v1 = vec_mul(v1, scale_vec);

vec_xst(v0, 0, curr_dst + d);
vec_xst(v1, 0, curr_dst + d + 4);
} else {
__vector float v0 = vec_xl(0, (float*)curr_src + d);
__vector float v1 = vec_xl(0, (float*)curr_src + d + 4);

v0 = vec_mul(v0, scale_vec);
v1 = vec_mul(v1, scale_vec);

vec_xst(v0, 0, curr_dst + d);
vec_xst(v1, 0, curr_dst + d + 4);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The else block in copy_q_heads_tile contains a critical bug when scalar_t is c10::Half. The pointer arithmetic (float*)curr_src + d incorrectly increments the address by d * sizeof(float) instead of d * sizeof(scalar_t). Additionally, it loads data using vec_xl and treats it as float without proper conversion, which is invalid for 16-bit types. Since load_row8_B_as_f32 is already specialized to handle float, BFloat16, and Half correctly, it should be used here to fix the bug and simplify the implementation.

          __vector float v0, v1;
          load_row8_B_as_f32<scalar_t>(curr_src + d, v0, v1);

          v0 = vec_mul(v0, scale_vec);
          v1 = vec_mul(v1, scale_vec);

          vec_xst(v0, 0, curr_dst + d);
          vec_xst(v1, 0, curr_dst + d + 4);

Comment thread csrc/cpu/cpu_attn_vsx.hpp Outdated
Comment on lines +54 to +70
FORCE_INLINE void load_row8_B_as_f32<c10::Half>(const c10::Half* p,
__vector float& b0,
__vector float& b1) {
alignas(16) float tmp[8];

tmp[0] = static_cast<float>(p[0]);
tmp[1] = static_cast<float>(p[1]);
tmp[2] = static_cast<float>(p[2]);
tmp[3] = static_cast<float>(p[3]);
tmp[4] = static_cast<float>(p[4]);
tmp[5] = static_cast<float>(p[5]);
tmp[6] = static_cast<float>(p[6]);
tmp[7] = static_cast<float>(p[7]);

b0 = vec_xl(0, (float*)tmp);
b1 = vec_xl(0, (float*)(tmp + 4));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The load_row8_B_as_f32 specialization for c10::Half uses a scalar loop for half-to-float conversion. This function is called within the inner loop of the attention micro-kernel (gemm_micro_ppc64le_Mx8_Ku4), making this a significant performance bottleneck for FP16 models. For Power9 and newer architectures, you should use the xvcvhpsp intrinsic for vectorized conversion. Even for older architectures, bitwise vector operations can be used to perform this conversion more efficiently than the current scalar fallback.

Comment thread csrc/cpu/utils.hpp
@Akashcodes732
Akashcodes732 marked this pull request as draft April 21, 2026 10:07
@Akashcodes732 Akashcodes732 changed the title [Hardware][Power]Add Power VSX Attention Backend and fix l2 Cache Crash [WIP][Hardware][Power]Add Power VSX Attention Backend and fix l2 Cache Crash Apr 21, 2026
@Akashcodes732
Akashcodes732 marked this pull request as ready for review April 21, 2026 10:59
@Akashcodes732 Akashcodes732 changed the title [WIP][Hardware][Power]Add Power VSX Attention Backend and fix l2 Cache Crash [Hardware][Power]Add Power VSX Attention Backend and fix l2 Cache Crash Apr 21, 2026
@Akashcodes732

Copy link
Copy Markdown
Contributor Author

Hi @bigPYJ1151 , can you please take a look at the changes ?

@Akashcodes732

Copy link
Copy Markdown
Contributor Author

Hi @bigPYJ1151 ,

Can you please take a look at the changes made in this PR ?

@Akashcodes732

Copy link
Copy Markdown
Contributor Author

Hi @bigPYJ1151 ,

Any update on this PR on when this can be reviewed ?

@bigPYJ1151

Copy link
Copy Markdown
Member

Hi @Akashcodes732 Please reslove the conflicts.

Comment thread csrc/cpu/utils.hpp
Comment thread csrc/cpu/utils.hpp
Akash Kaothalkar and others added 5 commits April 30, 2026 14:54
Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
@Akashcodes732
Akashcodes732 force-pushed the feat/power_vsx_backend branch from 02051c0 to 397a9e7 Compare April 30, 2026 09:33
@mergify

mergify Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Hi @Akashcodes732, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
@mergify

mergify Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Hi @Akashcodes732, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Akash kaothalkar added 2 commits April 30, 2026 05:58
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Comment thread csrc/cpu/cpu_attn_vec.hpp Outdated
Akash kaothalkar
fix
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
@bigPYJ1151
bigPYJ1151 enabled auto-merge (squash) May 1, 2026 04:49
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label May 1, 2026
@Akashcodes732

Copy link
Copy Markdown
Contributor Author

Hi @bigPYJ1151 , the failures look unrelated

@Akashcodes732

Copy link
Copy Markdown
Contributor Author

Hi @bigPYJ1151 , can we merge this ?

@Akashcodes732

Copy link
Copy Markdown
Contributor Author

Hi @DarkLight1337 @mgoin ,

The changes are approved and the failures look unrelated. Can we merge this PR ?

@vllm-bot
vllm-bot merged commit 420b0a5 into vllm-project:main May 5, 2026
61 of 65 checks passed
@DarkLight1337

Copy link
Copy Markdown
Member

Done

chaojun-zhang pushed a commit to chaojun-zhang/vllm that referenced this pull request May 6, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
Copilot AI pushed a commit to hongbolv/vllm that referenced this pull request May 7, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
Co-authored-by: hongbolv <33214277+hongbolv@users.noreply.github.com>
ikaadil pushed a commit to ikaadil/vllm that referenced this pull request May 7, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
Signed-off-by: Ifta Khairul Alam Adil <ikaadil007@gmail.com>
libinta pushed a commit to libinta/vllm that referenced this pull request May 8, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
Signed-off-by: Libin Tang <libin.tang@intel.com>
weifang231 pushed a commit to weifang231/eb-vllm that referenced this pull request May 13, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
mfylcek pushed a commit to mfylcek/vllm that referenced this pull request May 19, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
jhu960213 pushed a commit to jhu960213/vllm that referenced this pull request May 20, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
mvanhorn pushed a commit to mvanhorn/vllm that referenced this pull request Jun 4, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
MingqiWang-coder added a commit to vLLM-HUST/vllm-hust that referenced this pull request Jul 1, 2026
Cherry-pick 12 runner/worker/compilation PRs from upstream vllm-project/vllm main.

Applied (12):
vllm-project#40451 [Hardware][Power] Add Power VSX Attention Backend
vllm-project#35520 [Model Runner V2] support qwen35 / mamba hybrid model
vllm-project#41882 Add NVFP4 all-gather GEMM fusion for AsyncTP
vllm-project#40392 [Performance][DSR1]: Fused RoPE+KVCache+q_concat for MLA
vllm-project#40082 Integrate flashinfer b12x MoE and FP4 GEMM kernels for SM120
vllm-project#43746 [Model Refactoring] Remove torch compile dependency in DSv4
vllm-project#41714 [MM][CG] Profile encoder CUDA graph pool memory
vllm-project#40470 [Attention] Extract KV-cache update from CPU attention backend
vllm-project#45163 [Model] Add DiffusionGemma Support (partial, vllm-hust compat)
vllm-project#45473 [Kernel] Support DS Mamba tail copy for MTP align mode
vllm-project#45868 [ModelRunnerV2] Various model/config compatibility fixes
vllm-project#44635 Speed up docs build

Skipped (4, ROCm/XPU/hardware-specific):
vllm-project#41972 [ROCm] Fix AITER AR+RMSNorm
vllm-project#41771 [XPU] keep generator state
vllm-project#43016 [ROCm][CI] Stabilize 400 error
vllm-project#42604 DeepSeekV4-Pro ROCm sparse

Test: scheduler 107/107 passed

Co-authored-by: GitHub Copilot
Signed-off-by: MingqiWang-coder <mingqiwang@hust.edu.cn>
plasticchris pushed a commit to plasticchris/vllm that referenced this pull request Jul 20, 2026
…sh (vllm-project#40451)

Signed-off-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Signed-off-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash Kaothalkar <akashkaothalkar@akashs-mbp.bl1-in.ibm.com>
Co-authored-by: Akash Kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cpu Related to CPU backends ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants