diff --git a/src/core/ggml_compat.cpp b/src/core/ggml_compat.cpp index 061b33706..f6e8e7fc3 100644 --- a/src/core/ggml_compat.cpp +++ b/src/core/ggml_compat.cpp @@ -151,17 +151,6 @@ bool ggml_graph_cpy_use_counts(const ggml_cgraph* src, ggml_cgraph* dst) { } return true; } - -ggml_status ggml_backend_graph_compute_async_range(ggml_backend_t backend, ggml_cgraph* graph, int first, int last) { - if (!backend || !graph || first < 0 || last < first || last > graph->n_nodes) { - return GGML_STATUS_FAILED; - } - if (first == last) { - return GGML_STATUS_SUCCESS; - } - auto view = ggml_graph_view(graph, first, last); - return ggml_backend_graph_compute_async(backend, &view); -} #endif #ifdef SD_USE_UPSTREAM_GGML diff --git a/src/core/ggml_compat.h b/src/core/ggml_compat.h index 9f64262fb..9a367a8bc 100644 --- a/src/core/ggml_compat.h +++ b/src/core/ggml_compat.h @@ -29,13 +29,6 @@ bool ggml_graph_cpy_mapped(const struct ggml_cgraph* src, struct ggml_cgraph* ds // This preserves external consumers when constructing an inference graph segment. bool ggml_graph_cpy_use_counts(const struct ggml_cgraph* src, struct ggml_cgraph* dst); -// Executes nodes [first, last) with the original graph's use counts. No graph ownership -// is transferred. Tensor storage must already be allocated; invalid bounds fail. -enum ggml_status ggml_backend_graph_compute_async_range(ggml_backend_t backend, - struct ggml_cgraph* graph, - int first, - int last); - #else #error "Patched ggml requires ggml-graph.h; select SD_USE_UPSTREAM_GGML for upstream compatibility" #endif diff --git a/src/core/ggml_extend_backend.cpp b/src/core/ggml_extend_backend.cpp index 70f2ae2ec..fa4a3efcb 100644 --- a/src/core/ggml_extend_backend.cpp +++ b/src/core/ggml_extend_backend.cpp @@ -638,50 +638,6 @@ void sd_backend_clear_buffer_cache(ggml_backend_t backend) { } } -ggml_status sd_backend_graph_compute_with_eval_callback(ggml_backend_t backend, - ggml_cgraph* gf, - sd_graph_eval_callback_t callback_eval, - void* callback_eval_user_data) { - if (callback_eval == nullptr) { - return ggml_backend_graph_compute(backend, gf); - } - - ggml_status status = GGML_STATUS_SUCCESS; - const int n_nodes = ggml_graph_n_nodes(gf); - bool stopped = false; - - for (int j0 = 0; j0 < n_nodes; ++j0) { - ggml_tensor* t = ggml_graph_node(gf, j0); - bool need = callback_eval(t, true, callback_eval_user_data); - int j1 = j0; - - while (!need && j1 < n_nodes - 1) { - t = ggml_graph_node(gf, ++j1); - need = callback_eval(t, true, callback_eval_user_data); - } - - status = ggml_backend_graph_compute_async_range(backend, gf, j0, j1 + 1); - if (status != GGML_STATUS_SUCCESS) { - break; - } - - ggml_backend_synchronize(backend); - - if (need && !callback_eval(t, false, callback_eval_user_data)) { - stopped = true; - break; - } - - j0 = j1; - } - - ggml_backend_synchronize(backend); - if (stopped && status == GGML_STATUS_SUCCESS) { - status = GGML_STATUS_ABORTED; - } - return status; -} - const char* sd_get_system_info() { static std::string cache_info = []() -> std::string { ggml_backend_load_all_once(); diff --git a/src/core/ggml_extend_backend.h b/src/core/ggml_extend_backend.h index 037ef0d86..a535ab984 100644 --- a/src/core/ggml_extend_backend.h +++ b/src/core/ggml_extend_backend.h @@ -99,10 +99,6 @@ bool sd_backend_cpu_set_n_threads(ggml_backend_t backend_cpu, int n_threads); void sd_backend_set_buffer_cache_enabled(ggml_backend_t backend, bool enabled); void sd_backend_clear_buffer_cache(ggml_backend_t backend); -ggml_status sd_backend_graph_compute_with_eval_callback(ggml_backend_t backend, - ggml_cgraph* gf, - sd_graph_eval_callback_t callback_eval, - void* callback_eval_user_data); std::string sd_backend_resolve_name(const std::string& name); bool sd_parse_backend_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error); bool sd_parse_flash_attention_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error);