Skip to content

ggml-cpu: Enable tiled matmul on AIX#25199

Merged
taronaeo merged 1 commit into
ggml-org:masterfrom
shalinib-ibm:patch-2
Jul 6, 2026
Merged

ggml-cpu: Enable tiled matmul on AIX#25199
taronaeo merged 1 commit into
ggml-org:masterfrom
shalinib-ibm:patch-2

Conversation

@shalinib-ibm

Copy link
Copy Markdown
Contributor

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

@shalinib-ibm shalinib-ibm requested a review from ggerganov as a code owner July 1, 2026 12:17
@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Jul 1, 2026
@shalinib-ibm

Copy link
Copy Markdown
Contributor Author

@taronaeo @ggerganov Can you please help review this PR ?

Comment thread ggml/src/ggml-cpu/llamafile/sgemm.cpp Outdated
Comment thread ggml/src/ggml-cpu/llamafile/sgemm.cpp Outdated
@shalinib-ibm

Copy link
Copy Markdown
Contributor Author

Thanks @taronaeo . I've addressed your review comments. Can you please take a look ?

Comment thread ggml/src/ggml-cpu/llamafile/sgemm.cpp Outdated
#else
int64_t mc = 256; int64_t nc = 256; int64_t kc = 256;
#if defined(_AIX) || defined(__BIG_ENDIAN__)
mc = 128; nc = 128; kc = 128;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one too please :)

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
@taronaeo

taronaeo commented Jul 3, 2026

Copy link
Copy Markdown
Member

@ggml-org/maintainers Another approval please.

@taronaeo taronaeo merged commit 3b4fca1 into ggml-org:master Jul 6, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants