| 
28 | 28 | #include <numeric>  | 
29 | 29 | #include <functional>  | 
30 | 30 | 
 
  | 
 | 31 | +// TODO: allow to pass callback from user code  | 
31 | 32 | struct clip_logger_state g_logger_state = {GGML_LOG_LEVEL_CONT, clip_log_callback_default, NULL};  | 
32 | 33 | 
 
  | 
33 | 34 | enum ffn_op_type {  | 
@@ -3188,6 +3189,11 @@ struct clip_model_loader {  | 
3188 | 3189 |                         size / 1024.0 / 1024.0);  | 
3189 | 3190 |             }  | 
3190 | 3191 |         }  | 
 | 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);  | 
3191 | 3197 |     }  | 
3192 | 3198 | 
 
  | 
3193 | 3199 |     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  | 
4373 | 4379 |         return false; // only support batch size of 1  | 
4374 | 4380 |     }  | 
4375 | 4381 | 
 
  | 
 | 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 | + | 
4376 | 4391 |     // build the inference graph  | 
4377 | 4392 |     ctx->debug_print_tensors.clear();  | 
4378 | 4393 |     ggml_backend_sched_reset(ctx->sched.get());  | 
 | 
0 commit comments