summaryrefslogtreecommitdiff
path: root/ggml.h
diff options
context:
space:
mode:
authorMichael Podvitskiy <podvitskiymichael@gmail.com>2024-02-09 10:42:27 +0100
committerGeorgi Gerganov <ggerganov@gmail.com>2024-02-10 09:29:21 +0200
commit4633d93af08d890ecd00fa6e4f61d76f21cded4c (patch)
tree3c1bc3f11afdca41b89959cd20b52dc29a157bcc /ggml.h
parent4b7b38bef5addbd31f453871d79647fbae6bec8a (diff)
ggml : add abort_callback for cpu backend (ggml/725)
* a way to use abort_callback with the cpu backend * whisper update
Diffstat (limited to 'ggml.h')
-rw-r--r--ggml.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/ggml.h b/ggml.h
index e0a4799f..1360cd8e 100644
--- a/ggml.h
+++ b/ggml.h
@@ -567,6 +567,11 @@ extern "C" {
static const size_t GGML_TENSOR_SIZE = sizeof(struct ggml_tensor);
+ // Abort callback
+ // If not NULL, called before ggml computation
+ // If it returns true, the computation is aborted
+ typedef bool (*ggml_abort_callback)(void * data);
+
// the compute plan that needs to be prepared for ggml_graph_compute()
// since https://github.com/ggerganov/ggml/issues/287
struct ggml_cplan {
@@ -576,8 +581,8 @@ extern "C" {
int n_threads;
// abort ggml_graph_compute when true
- bool (*abort_callback)(void * data);
- void * abort_callback_data;
+ ggml_abort_callback abort_callback;
+ void * abort_callback_data;
};
enum ggml_cgraph_eval_order {