[MLAS] Add kleidiai pad ptr invalidation test case#27465
Merged
hariharans29 merged 2 commits intomicrosoft:mainfrom Feb 26, 2026
Merged
[MLAS] Add kleidiai pad ptr invalidation test case#27465hariharans29 merged 2 commits intomicrosoft:mainfrom
hariharans29 merged 2 commits intomicrosoft:mainfrom
Conversation
Signed-off-by: Jonathan Clohessy <Jonathan.Clohessy@arm.com>
Signed-off-by: Jonathan Clohessy <Jonathan.Clohessy@arm.com>
Member
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces minor improvements to the MLAS KleidiAI implementation, addressing include suggestions from PR #27439 and adding a regression test for the padding buffer pointer invalidation issue fixed in PR #27215.
Changes:
- Added missing standard library header includes (
<vector>,<cstring>,<cstddef>,<array>) to kleidiai implementation files - Improved cache invalidation strategy to only clear entries associated with the old pad buffer address rather than clearing the entire cache
- Added regression test case that exercises pad buffer growth scenario with convolutions of varying channel sizes
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| onnxruntime/test/mlas/unittest/test_conv2d.h | Added regression test that forces pad buffer growth by running convolutions with different channel sizes to verify cache invalidation works correctly |
| onnxruntime/core/mlas/lib/kleidiai/sgemm_kleidiai.cpp | Added missing standard library includes (<vector>, <cstring>, <cstddef>) used throughout the file |
| onnxruntime/core/mlas/lib/kleidiai/qgemm_kleidiai.cpp | Added missing standard library includes (<array>, <cstddef>, <vector>) used throughout the file |
| onnxruntime/core/mlas/lib/kleidiai/convolve_kleidiai.cpp | Added missing includes and improved cache invalidation to only remove old pad buffer's cache entries rather than clearing all caches, reducing unnecessary cache misses |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hariharans29
approved these changes
Feb 26, 2026
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 introduces some minor code changes which do the following:
Testing
This patch was tested in two ways.
for i in $(seq 1 2000); do echo "ITER=$i"; ./onnxruntime_mlas_test --long --gtest_filter='*Conv2d*' || break; doneExplanation of Subsequent logs
KLEIDIAI_CONV_LHS pad_buf MOVED ci=320 padsize=512 old=0x12e80d800 new=0x12e81ac00old→new). Any previously-built indirection table entries that pointed at the old padding buffer are now stale.KLEIDIAI_CONV_LHS indirection_cache HIT ci=64 m=121 **pad=0x12e81ac00 old_pad=0x12e80d800 (after_pad_move)**ci=64) the indirection-table cache returned a HIT. The log prints the current pad buffer address (pad=...) and the most recent prior padding-buffer address (old_pad=...) captured during the move. The(after_pad_move)tag indicates that this cache HIT occurred after a pad-buffer relocation event, which is the dangerous case in the pre-fix implementation (cached tables may still contain pointers toold_pad).In failing runs, the output mismatch occurs immediately after this sequence, showing a clear correlation: pad buffer moved → cached indirection table reused → incorrect results.