Skip to content

Commit 1cbc846

Browse files
ggml-cpu : disable tiled matmul on AIX to fix page boundary segfault (#22293)
* ggml-cpu : disable tiled matmul on AIX to fix page boundary segfault 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> * Update ggml/src/ggml-cpu/llamafile/sgemm.cpp Co-authored-by: Aaron Teo <taronaeo@gmail.com> * Update sgemm.cpp * Update sgemm.cpp --------- Signed-off-by: Shalini Salomi Bodapati <Shalini.Salomi.Bodapati@ibm.com> Co-authored-by: Aaron Teo <taronaeo@gmail.com>
1 parent 3142f1d commit 1cbc846

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ggml/src/ggml-cpu/llamafile/sgemm.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,9 @@ class tinyBLAS_Q0_PPC {
23212321
}
23222322

23232323
void matmul(int64_t m, int64_t n) {
2324+
#if defined(_AIX) || defined(__BIG_ENDIAN__)
2325+
mnpack(0, m, 0, n);
2326+
#else
23242327
const int64_t mc = 64;
23252328
const int64_t kc = 64;
23262329
int64_t nc = 64;
@@ -2334,7 +2337,6 @@ class tinyBLAS_Q0_PPC {
23342337
} else {
23352338
n_aligned = (n / 64) * 64;
23362339
}
2337-
23382340
if (n_aligned > 0) {
23392341
if (n_aligned % 64 == 0) nc = 64;
23402342
else if (n_aligned == n) nc = n;
@@ -2352,6 +2354,7 @@ class tinyBLAS_Q0_PPC {
23522354
} else {
23532355
mnpack(0, m, 0, n);
23542356
}
2357+
#endif
23552358
}
23562359

23572360
private:
@@ -3191,12 +3194,16 @@ class tinyBLAS_PPC {
31913194
}
31923195

31933196
void matmul(int64_t m, int64_t n) {
3197+
#if defined(_AIX) || defined(__BIG_ENDIAN__)
3198+
mnpack(0, m, 0, n);
3199+
#else
31943200
int64_t mc = 256; int64_t nc = 256; int64_t kc = 256;
31953201
if (m % mc == 0 && n % nc == 0 && k % kc == 0) {
31963202
matmul_tiled(m, n, mc, nc, kc);
31973203
} else {
31983204
mnpack(0, m, 0, n);
31993205
}
3206+
#endif
32003207
}
32013208

32023209
private:

0 commit comments

Comments
 (0)