Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions ggml/src/ggml-metal/kernels/mul_mm.metal
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,15 @@ kernel void kernel_mul_mm(
}

// Store result tile to output matrix (with batch offset)
// cT.store handles bounds checking via tD's extents (M, N)
device float * dstBatch = (device float *)dst + im * N * M;
// a slice is not used because its byte offset is int32 and wraps at 2 GiB
// ref: https://github.com/ggml-org/llama.cpp/pull/28748
const int tileM = min(NRA, M - ra);
Comment thread
SecondSeed marked this conversation as resolved.
const int tileN = min(NRB, N - rb);

auto tD = tensor(dstBatch, dextents<int32_t, 2>(M, N), array<int, 2>({1, M}));
cT.store(tD.slice(ra, rb));
device float * dstTile = (device float *)dst + (uint64_t) im * N * M + (uint64_t) rb * M + ra;

auto tD = tensor(dstTile, dextents<int32_t, 2>(tileM, tileN), array<int, 2>({1, M}));
cT.store(tD);
}

#else
Expand Down