Skip to content

ggml-cpu : disable tiled matmul on AIX to fix page boundary segfault#22293

Open
shalinib-ibm wants to merge 2 commits intoggml-org:masterfrom
shalinib-ibm:aix_matmul_fix
Open

ggml-cpu : disable tiled matmul on AIX to fix page boundary segfault#22293
shalinib-ibm wants to merge 2 commits intoggml-org:masterfrom
shalinib-ibm:aix_matmul_fix

Conversation

@shalinib-ibm
Copy link
Copy Markdown
Contributor

vec_xst operations in the tiled path crash on AIX when writing near 4KB page boundaries due to strict memory protection. Fall back to mnpack implementation on AIX for stable execution.

Overview

This patch fixes segmentation faults in q4_0 model inference on AIX/PowerPC systems by disabling the tiled matrix multiplication path in llamafile's sgemm implementation.
vec_xst operations crash on AIX when writing near 4KB page boundaries due to strict memory protection. The vec_xst instruction cannot write across page boundaries on AIX, and when the buffer offset lands at addresses like 0x1100ed000 (exactly at a page boundary), the write operation attempts to access unmapped memory, triggering a segfault.

This issue does not occur on Linux because Linux has more lenient memory management and may have adjacent pages already mapped. On AIX, page boundaries are strictly enforced.

Additional information

Requirements

vec_xst operations in the tiled path crash on AIX when writing
near 4KB page boundaries due to strict memory protection. Fall
back to mnpack implementation on AIX for stable execution.

Signed-off-by: Shalini Salomi Bodapati <Shalini.Salomi.Bodapati@ibm.com>
@shalinib-ibm shalinib-ibm requested a review from ggerganov as a code owner April 23, 2026 13:49
@shalinib-ibm
Copy link
Copy Markdown
Contributor Author

@taronaeo Request to review this patch . Thanks in advance.

@shalinib-ibm
Copy link
Copy Markdown
Contributor Author

@ggerganov Request to review this patch. Thanks in advance

Copy link
Copy Markdown
Member

@taronaeo taronaeo left a comment

Choose a reason for hiding this comment

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

Minor change. Triggered CI.

Comment thread ggml/src/ggml-cpu/llamafile/sgemm.cpp Outdated
Co-authored-by: Aaron Teo <taronaeo@gmail.com>
@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Apr 23, 2026
@shalinib-ibm
Copy link
Copy Markdown
Contributor Author

@taronaeo
ubuntu-cpu-riscv64-native : failed because if no root access.
ggml-ci-win-intel-vulkan: failed to load backed ( -m model path not found)
oher two test failures do not seem to be related to this PR. Can you please take a look and re-trigger these tests ?

@taronaeo
Copy link
Copy Markdown
Member

Noted on the CI failures. All seem unrelated to this PR.

@taronaeo taronaeo requested a review from a team April 24, 2026 14:14
mnpack(0, m, n_aligned, n);
}
} else {
#if defined(_AIX) || defined(__BIG_ENDIAN__)
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.

You should probably unindent the directives style-wise.

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