ggml-cpu: Enable tiled matmul on AIX#25199
Open
shalinib-ibm wants to merge 1 commit into
Open
Conversation
The matmul_tiled path uses large local stack buffers for A_pack and B_pack. On AIX this can trigger a segmentation fault, so reduce the buffer footprint there to keep the tiled path usable.
Performance Impact:
~ 2x gains in PP_Speed for FP32, Q4_0 and Q8_0 models tested with llama-bench, llama-batched-bench and llama-cli.
Models used: Llama3.2 3b Instruct F32, qwen 2.5 3b Q4_0 and Q8_0
Update sgemm.cpp
Update sgemm.cpp
Contributor
Author
|
@taronaeo @ggerganov Can you please help review this PR ? |
taronaeo
approved these changes
Jul 2, 2026
| } | ||
| if (n_aligned > 0) { | ||
| if (n_aligned % 64 == 0) nc = 64; | ||
| if (n_aligned % n_chunk == 0) nc = n_chunk; |
Member
There was a problem hiding this comment.
Suggested change
| if (n_aligned % n_chunk == 0) nc = n_chunk; | |
| if (n_aligned % n_chunk == 0) nc = n_chunk; |
Code-align
| } | ||
|
|
||
| void matmul(int64_t m, int64_t n) { | ||
| int64_t mc = 64; int64_t nc = 64; int64_t kc = 64; |
Member
There was a problem hiding this comment.
I'm not sure about this styling. Does clang-format keep this styling or does it expand into 3 separate lines?
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.
The matmul_tiled path uses large local stack buffers for A_pack and B_pack. On AIX this can trigger a segmentation fault, so reduce the buffer footprint there to keep the tiled path usable.
Performance Impact:
~ 2x gains in PP_Speed for FP32, Q4_0 and Q8_0 models tested with llama-bench, llama-batched-bench and llama-cli.
Models used: Llama3.2 3b Instruct F32, qwen 2.5 3b Q4_0 and Q8_0
Overview
Additional information
Requirements