Skip to content

Commit dd008a4

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

File tree

5 files changed

+51
-4
lines changed

5 files changed

+51
-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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,8 +1419,18 @@ static bool ggml_backend_kompute_device_supports_op(ggml_backend_dev_t dev, cons
14191419
case GGML_OP_SOFT_MAX:
14201420
case GGML_OP_RMS_NORM:
14211421
case GGML_OP_NORM:
1422-
case GGML_OP_ROPE:
14231422
return true;
1423+
case GGML_OP_ROPE:
1424+
{
1425+
const int mode = ((const int32_t *) op->op_params)[2];
1426+
if (mode && GGML_ROPE_TYPE_MROPE) {
1427+
return false;
1428+
}
1429+
if (mode && GGML_ROPE_TYPE_VISION) {
1430+
return false;
1431+
}
1432+
return true;
1433+
}
14241434
case GGML_OP_DUP:
14251435
case GGML_OP_CPY:
14261436
case GGML_OP_CONT:

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,18 @@ static bool ggml_metal_supports_op(const struct ggml_backend_metal_device_contex
11251125
return has_simdgroup_reduction && (op->ne[0] % 4 == 0);
11261126
case GGML_OP_ARGMAX:
11271127
case GGML_OP_NORM:
1128-
case GGML_OP_ROPE:
11291128
return true;
1129+
case GGML_OP_ROPE:
1130+
{
1131+
const int mode = ((const int32_t *) op->op_params)[2];
1132+
if (mode && GGML_ROPE_TYPE_MROPE) {
1133+
return false;
1134+
}
1135+
if (mode && GGML_ROPE_TYPE_VISION) {
1136+
return false;
1137+
}
1138+
return true;
1139+
}
11301140
case GGML_OP_IM2COL:
11311141
return op->src[0]->type == GGML_TYPE_F16;
11321142
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)