@@ -36,64 +36,13 @@ struct ggml_cgraph;
3636extern "C" {
3737#endif
3838
39- //
40- // internal API
41- // temporary exposed to user-code
42- //
43-
44- struct ggml_metal_context ;
45-
46- void ggml_metal_log_set_callback (ggml_log_callback log_callback , void * user_data );
47-
48- // number of command buffers to use
49- struct ggml_metal_context * ggml_metal_init (int n_cb );
50- void ggml_metal_free (struct ggml_metal_context * ctx );
51-
52- void * ggml_metal_host_malloc (size_t n );
53- void ggml_metal_host_free (void * data );
54-
55- // set the number of command buffers to use
56- void ggml_metal_set_n_cb (struct ggml_metal_context * ctx , int n_cb );
57-
58- // creates a mapping between a host memory buffer and a device memory buffer
59- // - make sure to map all buffers used in the graph before calling ggml_metal_graph_compute
60- // - the mapping is used during computation to determine the arguments of the compute kernels
61- // - you don't need to keep the host memory buffer allocated as it is never accessed by Metal
62- // - max_size specifies the maximum size of a tensor and is used to create shared views such
63- // that it is guaranteed that the tensor will fit in at least one of the views
64- //
65- bool ggml_metal_add_buffer (
66- struct ggml_metal_context * ctx ,
67- const char * name ,
68- void * data ,
69- size_t size ,
70- size_t max_size );
71-
72- // set data from host memory into the device
73- void ggml_metal_set_tensor (struct ggml_metal_context * ctx , struct ggml_tensor * t );
74-
75- // get data from the device into host memory
76- void ggml_metal_get_tensor (struct ggml_metal_context * ctx , struct ggml_tensor * t );
77-
78- // try to find operations that can be run concurrently in the graph
79- // you should run it again if the topology of your graph changes
80- void ggml_metal_graph_find_concurrency (struct ggml_metal_context * ctx , struct ggml_cgraph * gf , bool check_mem );
81-
82- // if the graph has been optimized for concurrently dispatch, return length of the concur_list if optimized
83- int ggml_metal_if_optimized (struct ggml_metal_context * ctx );
84-
85- // output the concur_list for ggml_alloc
86- int * ggml_metal_get_concur_list (struct ggml_metal_context * ctx );
87-
88- // same as ggml_graph_compute but uses Metal
89- // creates gf->n_threads command buffers in parallel
90- bool ggml_metal_graph_compute (struct ggml_metal_context * ctx , struct ggml_cgraph * gf );
91-
9239//
9340// backend API
9441// user-code should use only these functions
9542//
9643
44+ GGML_API void ggml_backend_metal_log_set_callback (ggml_log_callback log_callback , void * user_data );
45+
9746GGML_API ggml_backend_t ggml_backend_metal_init (void );
9847
9948GGML_API bool ggml_backend_is_metal (ggml_backend_t backend );
0 commit comments