metal : add/mul/div use general kernel when src1 not cont

This commit is contained in:
Georgi Gerganov 2023-12-09 14:24:58 +02:00
parent 06dfde3e94
commit 7e2006b0c0
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -1003,14 +1003,13 @@ void ggml_metal_graph_compute(
case GGML_OP_MUL:
case GGML_OP_DIV:
{
GGML_ASSERT(ggml_is_contiguous(src0));
GGML_ASSERT(ggml_is_contiguous(src1));
bool bcast_row = false;
int64_t nb = ne00;
if (ggml_nelements(src1) == ne10 && ne00 % 4 == 0) {
if (ggml_nelements(src1) == ne10 && ggml_is_contiguous(src1) && ne00 % 4 == 0) {
GGML_ASSERT(ggml_is_contiguous(src0));
// src1 is a row
GGML_ASSERT(ne11 == 1);