@@ -18,6 +18,26 @@ void ggml_metal_cv_free(ggml_metal_cv_t cv);
1818void  ggml_metal_cv_set_int32 (ggml_metal_cv_t  cv , int32_t  value , int32_t  idx );
1919void  ggml_metal_cv_set_bool  (ggml_metal_cv_t  cv , bool     value , int32_t  idx );
2020
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+ 
2141// 
2242// backend 
2343// 
@@ -27,20 +47,16 @@ typedef struct ggml_metal * ggml_metal_t;
2747ggml_metal_t  ggml_metal_init (ggml_metal_device_t  ctx_dev );
2848void  ggml_metal_free (ggml_metal_t  ctx );
2949
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 );
3451ggml_metal_pipeline_t  ggml_metal_compile_pipeline (ggml_metal_t  ctx , const  char  *  base , const  char  *  name , ggml_metal_cv_t  cv );
3552
3653void  ggml_metal_synchronize (ggml_metal_t  ctx );
3754
3855void  ggml_metal_set_tensor_async (ggml_metal_t  ctx , struct  ggml_tensor  *  tensor , const  void  *  data , size_t  offset , size_t  size );
3956void  ggml_metal_get_tensor_async (ggml_metal_t  ctx , const  struct  ggml_tensor  *  tensor , void  *  data , size_t  offset , size_t  size );
4057
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 );
4460
4561void  ggml_metal_set_n_cb             (ggml_metal_t  ctx , int  n_cb );
4662void  ggml_metal_set_abort_callback   (ggml_metal_t  ctx , ggml_abort_callback  abort_callback , void  *  user_data );
0 commit comments