Skip to content

Commit

Permalink
metal : add/mul/div use general kernel when src1 not cont
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Dec 9, 2023
1 parent 06dfde3 commit 7e2006b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ggml-metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7e2006b

Please sign in to comment.