Skip to content

Commit 0c27730

Browse files
committed
update ggml_backend_*_supports_op of unsupported backends
1 parent a02a190 commit 0c27730

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

ggml/src/ggml-cann/ggml-cann.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,15 @@ static bool ggml_backend_cann_supports_op(ggml_backend_dev_t dev,
17471747
if (*ext_factor != 0) {
17481748
return false;
17491749
}
1750+
1751+
const int mode = ((const int32_t *) op->op_params)[2];
1752+
if (mode && GGML_ROPE_TYPE_MROPE) {
1753+
return false;
1754+
}
1755+
if (mode && GGML_ROPE_TYPE_VISION) {
1756+
return false;
1757+
}
1758+
17501759
return true;
17511760
}
17521761
case GGML_OP_UPSCALE: {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,13 @@ static bool ggml_backend_kompute_device_supports_op(ggml_backend_dev_t dev, cons
14201420
case GGML_OP_RMS_NORM:
14211421
case GGML_OP_NORM:
14221422
case GGML_OP_ROPE:
1423+
const int mode = ((const int32_t *) op->op_params)[2];
1424+
if (mode && GGML_ROPE_TYPE_MROPE) {
1425+
return false;
1426+
}
1427+
if (mode && GGML_ROPE_TYPE_VISION) {
1428+
return false;
1429+
}
14231430
return true;
14241431
case GGML_OP_DUP:
14251432
case GGML_OP_CPY:

ggml/src/ggml-metal/ggml-metal.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,13 @@ static bool ggml_metal_supports_op(const struct ggml_backend_metal_device_contex
11261126
case GGML_OP_ARGMAX:
11271127
case GGML_OP_NORM:
11281128
case GGML_OP_ROPE:
1129+
const int mode = ((const int32_t *) op->op_params)[2];
1130+
if (mode && GGML_ROPE_TYPE_MROPE) {
1131+
return false;
1132+
}
1133+
if (mode && GGML_ROPE_TYPE_VISION) {
1134+
return false;
1135+
}
11291136
return true;
11301137
case GGML_OP_IM2COL:
11311138
return op->src[0]->type == GGML_TYPE_F16;

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,6 +4488,13 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
44884488
case GGML_OP_SOFT_MAX:
44894489
return true;
44904490
case GGML_OP_ROPE:
4491+
const int mode = ((const int32_t *) op->op_params)[2];
4492+
if (mode && GGML_ROPE_TYPE_MROPE) {
4493+
return false;
4494+
}
4495+
if (mode && GGML_ROPE_TYPE_VISION) {
4496+
return false;
4497+
}
44914498
return ggml_is_contiguous(op->src[0]);
44924499
case GGML_OP_IM2COL:
44934500
// TODO: add support for the new F32 operations

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7687,6 +7687,13 @@ static bool ggml_backend_vk_device_supports_op(ggml_backend_dev_t dev, const ggm
76877687
case GGML_OP_REPEAT:
76887688
return ggml_type_size(op->type) == sizeof(float) && ggml_type_size(op->src[0]->type) == sizeof(float);
76897689
case GGML_OP_ROPE:
7690+
const int mode = ((const int32_t *) op->op_params)[2];
7691+
if (mode && GGML_ROPE_TYPE_MROPE) {
7692+
return false;
7693+
}
7694+
if (mode && GGML_ROPE_TYPE_VISION) {
7695+
return false;
7696+
}
76907697
return ggml_is_contiguous(op->src[0]);
76917698
case GGML_OP_NONE:
76927699
case GGML_OP_RESHAPE:

0 commit comments

Comments
 (0)