Skip to content

Commit 1ee1843

Browse files
committed
opencl: disable fp16 for ADD, MUL, SCALE, RELU, GELU, SILU, CLAMP
1 parent 3eca4f6 commit 1ee1843

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ggml/src/ggml-opencl/ggml-opencl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,17 +1007,18 @@ static bool ggml_opencl_supports_op(ggml_backend_dev_t dev, const struct ggml_te
10071007
case GGML_OP_ADD:
10081008
case GGML_OP_SCALE:
10091009
case GGML_OP_MUL:
1010-
return true;
1010+
return op->src[0]->type == GGML_TYPE_F32;
10111011
case GGML_OP_UNARY:
10121012
switch (ggml_get_unary_op(op)) {
10131013
case GGML_UNARY_OP_GELU:
10141014
case GGML_UNARY_OP_SILU:
10151015
case GGML_UNARY_OP_RELU:
1016-
return ggml_is_contiguous(op->src[0]);
1016+
return ggml_is_contiguous(op->src[0]) && op->src[0]->type == GGML_TYPE_F32;
10171017
default:
10181018
return false;
10191019
}
10201020
case GGML_OP_CLAMP:
1021+
return op->src[0]->type == GGML_TYPE_F32;
10211022
case GGML_OP_SOFT_MAX:
10221023
case GGML_OP_NORM:
10231024
case GGML_OP_RMS_NORM:

0 commit comments

Comments
 (0)