summaryrefslogtreecommitdiff
path: root/ggml-metal.h
diff options
context:
space:
mode:
authorGeorgi Gerganov <ggerganov@gmail.com>2023-10-08 20:19:14 +0300
committerGitHub <noreply@github.com>2023-10-08 20:19:14 +0300
commitdb3abcc114d5d1790ba814aa1a80ac673d4ccc3e (patch)
tree954cce12ac9d40fccf5dd3d9298efedd1d67e7d0 /ggml-metal.h
parenteee42c670e6fa6df9cf17e7ffc319f74cbd81354 (diff)
sync : ggml (ggml-backend) (#3548)
* sync : ggml (ggml-backend) ggml-ci * zig : add ggml-backend to the build
Diffstat (limited to 'ggml-metal.h')
-rw-r--r--ggml-metal.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/ggml-metal.h b/ggml-metal.h
index 790cf0bf..096b844e 100644
--- a/ggml-metal.h
+++ b/ggml-metal.h
@@ -20,6 +20,7 @@
#pragma once
#include "ggml.h"
+#include "ggml-backend.h"
#include <stddef.h>
#include <stdbool.h>
@@ -35,10 +36,15 @@ struct ggml_cgraph;
extern "C" {
#endif
-void ggml_metal_log_set_callback(ggml_log_callback log_callback, void * user_data);
+//
+// internal API
+// temporary exposed to user-code
+//
struct ggml_metal_context;
+void ggml_metal_log_set_callback(ggml_log_callback log_callback, void * user_data);
+
// 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);
@@ -83,6 +89,17 @@ int * ggml_metal_get_concur_list(struct ggml_metal_context * ctx);
// creates gf->n_threads command buffers in parallel
void ggml_metal_graph_compute(struct ggml_metal_context * ctx, struct ggml_cgraph * gf);
+//
+// backend API
+// user-code should use only these functions
+//
+
+GGML_API ggml_backend_t ggml_backend_metal_init(void);
+
+GGML_API bool ggml_backend_is_metal(ggml_backend_t backend);
+
+GGML_API void ggml_backend_metal_set_n_cb(ggml_backend_t backend, int n_cb);
+
#ifdef __cplusplus
}
#endif