Skip to content

Commit a4b54f2

Browse files
committed
cont : add warning about unsupported ops
1 parent 3aa835b commit a4b54f2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/mtmd/clip.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <numeric>
2929
#include <functional>
3030

31+
// TODO: allow to pass callback from user code
3132
struct clip_logger_state g_logger_state = {GGML_LOG_LEVEL_CONT, clip_log_callback_default, NULL};
3233

3334
enum ffn_op_type {
@@ -3188,6 +3189,11 @@ struct clip_model_loader {
31883189
size / 1024.0 / 1024.0);
31893190
}
31903191
}
3192+
3193+
const int n_splits = ggml_backend_sched_get_n_splits(ctx_clip.sched.get());
3194+
const int n_nodes = ggml_graph_n_nodes(gf);
3195+
3196+
LOG_INF("%s: graph splits = %d, nodes = %d\n", __func__, n_splits, n_nodes);
31913197
}
31923198

31933199
void get_bool(const std::string & key, bool & output, bool required = true) {
@@ -4373,6 +4379,15 @@ bool clip_image_batch_encode(clip_ctx * ctx, const int n_threads, const clip_ima
43734379
return false; // only support batch size of 1
43744380
}
43754381

4382+
if (ggml_backend_sched_get_n_splits(ctx->sched.get()) > 1) {
4383+
LOG_WRN("%s: *****************************************************************\n", __func__);
4384+
LOG_WRN("%s: WARNING: the CLIP graph uses unsupported operators by the backend\n", __func__);
4385+
LOG_WRN("%s: the performance will be suboptimal \n", __func__);
4386+
LOG_WRN("%s: \n", __func__);
4387+
LOG_WRN("%s: ref: https://github.com/ggml-org/llama.cpp/pull/16837#issuecomment-3461676118\n", __func__);
4388+
LOG_WRN("%s: *****************************************************************\n", __func__);
4389+
}
4390+
43764391
// build the inference graph
43774392
ctx->debug_print_tensors.clear();
43784393
ggml_backend_sched_reset(ctx->sched.get());

0 commit comments

Comments
 (0)