aboutsummaryrefslogtreecommitdiff
path: root/ggml-metal.h
diff options
context:
space:
mode:
authorQingyou Meng <meng.qingyou@gmail.com>2023-07-08 00:24:01 +0800
committerGitHub <noreply@github.com>2023-07-07 19:24:01 +0300
commit1d656d6360359cfdaaf5d64ed9690047b600dbcb (patch)
treeea41daf563633ab0552f24fd0bacce51833e04eb /ggml-metal.h
parent72421402834141df6cbdcf595fe46dbd11874dce (diff)
ggml : change ggml_graph_compute() API to not require context (#1999)
* ggml_graph_compute: deprecate using ggml_context, try resolve issue #287 * rewrite: no longer consider backward compitability; plan and make_plan * minor: rename ctx as plan; const * remove ggml_graph_compute from tests/test-grad0.c, but current change breaks backward * add static ggml_graph_compute_sugar() * minor: update comments * reusable buffers * ggml : more consistent naming + metal fixes * ggml : fix docs * tests : disable grad / opt + minor naming changes * ggml : add ggml_graph_compute_with_ctx() - backwards compatible API - deduplicates a lot of copy-paste * ci : enable test-grad0 * examples : factor out plan allocation into a helper function * llama : factor out plan stuff into a helper function * ci : fix env * llama : fix duplicate symbols + refactor example benchmark * ggml : remove obsolete assert + refactor n_tasks section * ggml : fix indentation in switch * llama : avoid unnecessary bool * ggml : remove comments from source file and match order in header --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Diffstat (limited to 'ggml-metal.h')
-rw-r--r--ggml-metal.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/ggml-metal.h b/ggml-metal.h
index b9e50ac..928f170 100644
--- a/ggml-metal.h
+++ b/ggml-metal.h
@@ -34,9 +34,13 @@ extern "C" {
struct ggml_metal_context;
-struct ggml_metal_context * ggml_metal_init(void);
+// number of command buffers to use
+struct ggml_metal_context * ggml_metal_init(int n_cb);
void ggml_metal_free(struct ggml_metal_context * ctx);
+// set the number of command buffers to use
+void ggml_metal_set_n_cb(struct ggml_metal_context * ctx, int n_cb);
+
// creates a mapping between a host memory buffer and a device memory buffer
// - make sure to map all buffers used in the graph before calling ggml_metal_graph_compute
// - the mapping is used during computation to determine the arguments of the compute kernels