KleidiAI SVE2p1 halfgemm kernel integrated - #32670
Draft
Melike Kaptan (melkap01-Arm) wants to merge 2 commits into
Draft
Melike Kaptan (melkap01-Arm) wants to merge 2 commits into
Melike Kaptan (melkap01-Arm) wants to merge 2 commits into
Conversation
Copilot started reviewing on behalf of
Melike Kaptan (melkap01-Arm)
September 17, 2026 09:21
View session
Melike Kaptan (melkap01-Arm)
marked this pull request as draft
September 17, 2026 09:23
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Native-packed batched execution can reject a later vector-length mismatch after earlier outputs have already been modified.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds KleidiAI SVE2.1 acceleration for MLAS FP16 HalfGemm while retaining SME/SME2 priority.
Changes:
- Adds Linux/Windows SVE2.1 detection and dispatch.
- Integrates SVE2.1 packing, execution, and vector-length handling.
- Updates KleidiAI and adds targeted tests.
File summaries
| File | Description |
|---|---|
cmake/deps.txt |
Updates KleidiAI to v1.30.0. |
onnxruntime/core/common/cpuid_info.cc |
Detects SVE2.1 capabilities. |
onnxruntime/core/common/cpuid_info.h |
Exposes SVE2.1 capability state. |
onnxruntime/core/mlas/lib/platform.cpp |
Enables HalfGemm overrides on SVE2.1. |
onnxruntime/core/mlas/lib/kleidiai/halfgemm_kleidiai.cpp |
Implements SVE2.1 packing and execution. |
onnxruntime/core/mlas/lib/kleidiai/mlasi_kleidiai.h |
Declares test hooks. |
onnxruntime/test/mlas/unittest/test_halfgemm.cpp |
Adds SVE2.1 kernel tests. |
onnxruntime/test/mlas/unittest/test_halfgemm.h |
Adds stride, packing, and canary helpers. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+468
to
+469
| if (!ReadSve2p1PackedRhsMetadata(data.B, rhs_vector_length, rhs_packed)) { | ||
| return false; |
Contributor
Author
There was a problem hiding this comment.
done
Signed-off-by: melkap01 <melike.kaptan@arm.com>
Signed-off-by: melkap01 <melike.kaptan@arm.com>
Melike Kaptan (melkap01-Arm)
force-pushed
the
SVE2p1_kernel_integration
branch
from
September 18, 2026 09:23
1952e4b to
19c53eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds SVE2.1 acceleration for MLAS FP16 HalfGemm using the KleidiAI 6x16vs dot-product kernel.
The change:
Updates KleidiAI from v1.20.0 to v1.30.0.
Adds native SVE2.1 capability detection:
Linux through HWCAP2_SVE2P1.
Windows through PF_ARM_SVE2_1_INSTRUCTIONS_AVAILABLE.
Preserves the architectural relationship that SVE2.1 implies SVE.
Enables only the HalfGemm overrides on SVE2.1 systems; other KleidiAI GEMM and convolution overrides remain restricted to SME/SME2.
Preserves SME/SME2 priority when both SME and SVE2.1 are available.
Motivation and Context
The new backend uses:
MatMul kernel: kai_matmul_clamp_f16_f16_f16p16vsx2bf16_6x16vs_sve2p1_dot
RHS packer: kai_rhs_pack_kxn_x16p16vsx2bx16_x16_x16_sve
Both supported B paths are covered:
Runtime packing of ordinary row-major B, including optional bias.
Direct consumption of backend-native prepacked B.
Execution is divided into six-row M tiles and vector-length-dependent N tiles, with support for M/N tails and MLAS thread-pool parallelism.