Skip to content

Commit 03aced6

Browse files
committed
update ggml_backend_*_supports_op of unsupported backends
1 parent a02a190 commit 03aced6

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
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: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,16 @@ 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-
return true;
1423+
{
1424+
const int mode = ((const int32_t *) op->op_params)[2];
1425+
if (mode && GGML_ROPE_TYPE_MROPE) {
1426+
return false;
1427+
}
1428+
if (mode && GGML_ROPE_TYPE_VISION) {
1429+
return false;
1430+
}
1431+
return true;
1432+
}
14241433
case GGML_OP_DUP:
14251434
case GGML_OP_CPY:
14261435
case GGML_OP_CONT:

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,16 @@ 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-
return true;
1129+
{
1130+
const int mode = ((const int32_t *) op->op_params)[2];
1131+
if (mode && GGML_ROPE_TYPE_MROPE) {
1132+
return false;
1133+
}
1134+
if (mode && GGML_ROPE_TYPE_VISION) {
1135+
return false;
1136+
}
1137+
return true;
1138+
}
11301139
case GGML_OP_IM2COL:
11311140
return op->src[0]->type == GGML_TYPE_F16;
11321141
case GGML_OP_POOL_1D:

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4488,7 +4488,16 @@ 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-
return ggml_is_contiguous(op->src[0]);
4491+
{
4492+
const int mode = ((const int32_t *) op->op_params)[2];
4493+
if (mode && GGML_ROPE_TYPE_MROPE) {
4494+
return false;
4495+
}
4496+
if (mode && GGML_ROPE_TYPE_VISION) {
4497+
return false;
4498+
}
4499+
return ggml_is_contiguous(op->src[0]);
4500+
}
44924501
case GGML_OP_IM2COL:
44934502
// TODO: add support for the new F32 operations
44944503
return op->src[0]->type == GGML_TYPE_F16;

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7687,7 +7687,16 @@ 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-
return ggml_is_contiguous(op->src[0]);
7690+
{
7691+
const int mode = ((const int32_t *) op->op_params)[2];
7692+
if (mode && GGML_ROPE_TYPE_MROPE) {
7693+
return false;
7694+
}
7695+
if (mode && GGML_ROPE_TYPE_VISION) {
7696+
return false;
7697+
}
7698+
return ggml_is_contiguous(op->src[0]);
7699+
}
76917700
case GGML_OP_NONE:
76927701
case GGML_OP_RESHAPE:
76937702
case GGML_OP_VIEW:

0 commit comments

Comments
 (0)