Skip to content

Commit 6cac650

Browse files
committed
Style: use switch in supports_ops
1 parent 7d8ea73 commit 6cac650

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

ggml/src/ggml-openvino/ggml-openvino.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ static ggml_backend_buffer_t ggml_backend_openvino_device_buffer_from_host_ptr(g
240240
}
241241

242242
static bool is_op_unsupported_case(const ggml_tensor* op) {
243-
if (op->op == GGML_OP_SOFT_MAX) {
243+
switch (op->op) {
244+
case GGML_OP_SOFT_MAX: {
244245
if (op->src[2] != nullptr) {
245246
GGML_LOG_WARN("OpenVINO backend does not support SOFT_MAX with sinks\n");
246247
return true;
@@ -254,9 +255,9 @@ static bool is_op_unsupported_case(const ggml_tensor* op) {
254255
GGML_LOG_WARN("OpenVINO backend does not support SOFT_MAX with max_bias > 0\n");
255256
return true;
256257
}
258+
break;
257259
}
258-
259-
if (op->op == GGML_OP_FLASH_ATTN_EXT) {
260+
case GGML_OP_FLASH_ATTN_EXT: {
260261
if (op->src[4] != nullptr) {
261262
GGML_LOG_WARN("OpenVINO backend does not support FLASH_ATTN_EXT with sinks\n");
262263
return true;
@@ -276,32 +277,32 @@ static bool is_op_unsupported_case(const ggml_tensor* op) {
276277
GGML_LOG_WARN("OpenVINO backend does not support FLASH_ATTN_EXT with logit_softcap != 0\n");
277278
return true;
278279
}
280+
break;
279281
}
280-
281-
if (op->op == GGML_OP_PERMUTE) {
282+
case GGML_OP_PERMUTE: {
282283
if (op->type == GGML_TYPE_BF16) {
283284
// err msg: [GPU] Could not find a suitable kernel for transpose
284285
GGML_LOG_WARN("OpenVINO backend does not support PERMUTE with BF16 type\n");
285286
return true;
286287
}
288+
break;
287289
}
288-
289-
if (op->op == GGML_OP_CPY) {
290+
case GGML_OP_CPY: {
290291
if (op->src[1] != op) {
291292
GGML_LOG_WARN("OpenVINO backend only supports CPY that is a cast\n");
292293
return true;
293294
}
295+
break;
294296
}
295-
296-
if (op->op == GGML_OP_MUL_MAT) {
297+
case GGML_OP_MUL_MAT: {
297298
if (op->src[0]->type == GGML_TYPE_F16 && op->src[1]->type == GGML_TYPE_F16) {
298299
// Has accuracy issue, try enabling this and see `test-backend-ops -o "MUL_MAT"`
299300
GGML_LOG_WARN("OpenVINO backend does not support MUL_MAT with two F16 tensors\n");
300301
return true;
301302
}
303+
break;
302304
}
303-
304-
if (op->op == GGML_OP_ROPE) {
305+
case GGML_OP_ROPE: {
305306
const int32_t* op_params = op->op_params;
306307
const int n_dims = op_params[1];
307308
const int mode = op_params[2];
@@ -330,12 +331,17 @@ static bool is_op_unsupported_case(const ggml_tensor* op) {
330331
if (op->src[0]->op == GGML_OP_VIEW) {
331332
if (op->src[0]->view_src->ne[1] != op->src[0]->ne[2]) {
332333
GGML_LOG_WARN(
333-
"OpenVINO backend does not support ROPE with src[0]->view_src->ne[1] %ld != src[0]->ne[2] %ld\n",
334+
"OpenVINO backend does not support ROPE with src[0]->view_src->ne[1] %ld != src[0]->ne[2] "
335+
"%ld\n",
334336
op->src[0]->view_src->ne[1],
335337
op->src[0]->ne[2]);
336338
return true;
337339
}
338340
}
341+
break;
342+
}
343+
default:
344+
break;
339345
}
340346
return false;
341347
}

0 commit comments

Comments
 (0)