Skip to content

Commit 913536f

Browse files
committed
kompute: op_unary: reject unsupported parameters
Signed-off-by: Sergio Lopez <[email protected]>
1 parent 9e2301f commit 913536f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ggml/src/ggml-kompute/ggml-kompute.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,11 +1351,15 @@ static void ggml_vk_cpy_f16_f32(Args&&... args) {
13511351
}
13521352

13531353
static bool ggml_backend_kompute_device_supports_op(ggml_backend_dev_t dev, const struct ggml_tensor * op) {
1354+
int64_t n = ggml_nelements(op);
13541355
switch (op->op) {
13551356
case GGML_OP_UNARY:
1357+
if (n % 4 != 0) return false;
13561358
switch (ggml_get_unary_op(op)) {
1357-
case GGML_UNARY_OP_RELU:
13581359
case GGML_UNARY_OP_GELU:
1360+
if (n % 8 != 0) return false;
1361+
// fall through
1362+
case GGML_UNARY_OP_RELU:
13591363
case GGML_UNARY_OP_SILU:
13601364
return ggml_is_contiguous(op->src[0]);
13611365
default:

0 commit comments

Comments
 (0)