@@ -18,6 +18,26 @@ void ggml_metal_cv_free(ggml_metal_cv_t cv);
18
18
void ggml_metal_cv_set_int32 (ggml_metal_cv_t cv , int32_t value , int32_t idx );
19
19
void ggml_metal_cv_set_bool (ggml_metal_cv_t cv , bool value , int32_t idx );
20
20
21
+ //
22
+ // MTLComputePipelineState wrapper
23
+ //
24
+
25
+ typedef struct ggml_metal_pipeline * ggml_metal_pipeline_t ;
26
+
27
+ ggml_metal_pipeline_t ggml_metal_pipeline_init (void );
28
+ void ggml_metal_pipeline_free (ggml_metal_pipeline_t pipeline );
29
+
30
+ void * ggml_metal_pipeline_get_obj (ggml_metal_pipeline_t pipeline );
31
+
32
+ // a collection of pipelines
33
+ typedef struct ggml_metal_pipelines * ggml_metal_pipelines_t ;
34
+
35
+ ggml_metal_pipelines_t ggml_metal_pipelines_init (void );
36
+ void ggml_metal_pipelines_free (ggml_metal_pipelines_t ppls );
37
+
38
+ void ggml_metal_pipelines_add (ggml_metal_pipelines_t ppls , const char * name , ggml_metal_pipeline_t pipeline );
39
+ ggml_metal_pipeline_t ggml_metal_pipelines_get (ggml_metal_pipelines_t ppls , const char * name );
40
+
21
41
//
22
42
// backend
23
43
//
@@ -27,20 +47,16 @@ typedef struct ggml_metal * ggml_metal_t;
27
47
ggml_metal_t ggml_metal_init (ggml_metal_device_t ctx_dev );
28
48
void ggml_metal_free (ggml_metal_t ctx );
29
49
30
- typedef void * ggml_metal_pipeline_t ;
31
-
32
- ggml_metal_pipeline_t ggml_metal_get_pipeline (ggml_metal_t ctx , const char * name );
33
-
50
+ ggml_metal_pipeline_t ggml_metal_get_pipeline (ggml_metal_t ctx , const char * name );
34
51
ggml_metal_pipeline_t ggml_metal_compile_pipeline (ggml_metal_t ctx , const char * base , const char * name , ggml_metal_cv_t cv );
35
52
36
53
void ggml_metal_synchronize (ggml_metal_t ctx );
37
54
38
55
void ggml_metal_set_tensor_async (ggml_metal_t ctx , struct ggml_tensor * tensor , const void * data , size_t offset , size_t size );
39
56
void ggml_metal_get_tensor_async (ggml_metal_t ctx , const struct ggml_tensor * tensor , void * data , size_t offset , size_t size );
40
57
41
- enum ggml_status ggml_metal_graph_compute (ggml_metal_t ctx , struct ggml_cgraph * gf );
42
-
43
- void ggml_metal_graph_optimize (ggml_metal_t ctx , struct ggml_cgraph * gf );
58
+ enum ggml_status ggml_metal_graph_compute (ggml_metal_t ctx , struct ggml_cgraph * gf );
59
+ void ggml_metal_graph_optimize (ggml_metal_t ctx , struct ggml_cgraph * gf );
44
60
45
61
void ggml_metal_set_n_cb (ggml_metal_t ctx , int n_cb );
46
62
void ggml_metal_set_abort_callback (ggml_metal_t ctx , ggml_abort_callback abort_callback , void * user_data );
0 commit comments