Skip to content

Commit

Permalink
update ggml_backend_*_supports_op of supported backends
Browse files Browse the repository at this point in the history
  • Loading branch information
HimariO committed Dec 13, 2024
1 parent a02a190 commit a1689ac
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ggml/src/ggml-cann/ggml-cann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,15 @@ static bool ggml_backend_cann_supports_op(ggml_backend_dev_t dev,
if (*ext_factor != 0) {
return false;
}

const int mode = ((const int32_t *) op->op_params)[2];
if (mode && GGML_ROPE_TYPE_MROPE) {
return false;
}
if (mode && GGML_ROPE_TYPE_VISION) {
return false;
}

return true;
}
case GGML_OP_UPSCALE: {
Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-kompute/ggml-kompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,13 @@ static bool ggml_backend_kompute_device_supports_op(ggml_backend_dev_t dev, cons
case GGML_OP_RMS_NORM:
case GGML_OP_NORM:
case GGML_OP_ROPE:
const int mode = ((const int32_t *) op->op_params)[2];
if (mode && GGML_ROPE_TYPE_MROPE) {
return false;
}
if (mode && GGML_ROPE_TYPE_VISION) {
return false;
}
return true;
case GGML_OP_DUP:
case GGML_OP_CPY:
Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-metal/ggml-metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,13 @@ static bool ggml_metal_supports_op(const struct ggml_backend_metal_device_contex
case GGML_OP_ARGMAX:
case GGML_OP_NORM:
case GGML_OP_ROPE:
const int mode = ((const int32_t *) op->op_params)[2];
if (mode && GGML_ROPE_TYPE_MROPE) {
return false;
}
if (mode && GGML_ROPE_TYPE_VISION) {
return false;
}
return true;
case GGML_OP_IM2COL:
return op->src[0]->type == GGML_TYPE_F16;
Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-sycl/ggml-sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4488,6 +4488,13 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
case GGML_OP_SOFT_MAX:
return true;
case GGML_OP_ROPE:
const int mode = ((const int32_t *) op->op_params)[2];
if (mode && GGML_ROPE_TYPE_MROPE) {
return false;
}
if (mode && GGML_ROPE_TYPE_VISION) {
return false;
}
return ggml_is_contiguous(op->src[0]);
case GGML_OP_IM2COL:
// TODO: add support for the new F32 operations
Expand Down
7 changes: 7 additions & 0 deletions ggml/src/ggml-vulkan/ggml-vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7687,6 +7687,13 @@ static bool ggml_backend_vk_device_supports_op(ggml_backend_dev_t dev, const ggm
case GGML_OP_REPEAT:
return ggml_type_size(op->type) == sizeof(float) && ggml_type_size(op->src[0]->type) == sizeof(float);
case GGML_OP_ROPE:
const int mode = ((const int32_t *) op->op_params)[2];
if (mode && GGML_ROPE_TYPE_MROPE) {
return false;
}
if (mode && GGML_ROPE_TYPE_VISION) {
return false;
}
return ggml_is_contiguous(op->src[0]);
case GGML_OP_NONE:
case GGML_OP_RESHAPE:
Expand Down

0 comments on commit a1689ac

Please sign in to comment.