Skip to content

Commit 5ec713d

Browse files
committed
Adjust device_support_op for unary OPs
1 parent fc8d0a6 commit 5ec713d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ggml/src/ggml-sycl/ggml-sycl.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3853,7 +3853,11 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
38533853
case GGML_UNARY_OP_GELU_QUICK:
38543854
case GGML_UNARY_OP_TANH:
38553855
case GGML_UNARY_OP_EXP:
3856-
return ggml_is_contiguous(op->src[0]);
3856+
#if defined (GGML_SYCL_F16)
3857+
return ggml_is_contiguous(op->src[0]) && (op->type == op->src[0]->type);
3858+
#else
3859+
return ggml_is_contiguous(op->src[0]) && (op->src[0]->type == GGML_TYPE_F32 && op->type == GGML_TYPE_F32) && (op->type == op->src[0]->type);
3860+
#endif
38573861
default:
38583862
return false;
38593863
}
@@ -3982,6 +3986,11 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
39823986
case GGML_OP_COS:
39833987
case GGML_OP_CLAMP:
39843988
case GGML_OP_LOG:
3989+
#if defined (GGML_SYCL_F16)
3990+
return ((op->type == GGML_TYPE_F32 || op->type == GGML_SYCL_F16) && (op->src[0]->type == GGML_TYPE_F32 || op->src[0]->type == GGML_SYCL_F16) && (op->type == op->src[0]->type));
3991+
#else
3992+
return (op->type == GGML_TYPE_F32 && op->src[0]->type == GGML_TYPE_F32) && (op->type == op->src[0]->type);
3993+
#endif
39853994
case GGML_OP_NORM:
39863995
case GGML_OP_RMS_NORM:
39873996
case GGML_OP_L2_NORM:

0 commit comments

Comments
 (0)