@@ -1040,35 +1040,6 @@ struct GGMLRunner {
10401040 }
10411041 }
10421042
1043- struct ggml_gallocr * ggml_gallocr_new_n_multi (ggml_backend_buffer_type_t * bufts, int n_bufs) {
1044- struct ggml_gallocr * galloc = (struct ggml_gallocr *)calloc (1 , sizeof (void *) * 8 + sizeof (int ) * 4 + 256 );
1045- GGML_ASSERT (galloc != NULL );
1046-
1047- galloc->bufts = calloc (n_bufs, sizeof (ggml_backend_buffer_type_t ));
1048- GGML_ASSERT (galloc->bufts != NULL );
1049-
1050- galloc->buffers = calloc (n_bufs, sizeof (ggml_backend_buffer_t ));
1051- GGML_ASSERT (galloc->buffers != NULL );
1052-
1053- galloc->buf_tallocs = calloc (n_bufs, sizeof (struct ggml_dyn_tallocr *));
1054- GGML_ASSERT (galloc->buf_tallocs != NULL );
1055-
1056- for (int i = 0 ; i < n_bufs; i++) {
1057- galloc->bufts [i] = bufts[i];
1058- galloc->buffers [i] = NULL ;
1059-
1060- // don't check if the same buffer type is used multiple times
1061-
1062- if (galloc->buf_tallocs [i] == NULL ) {
1063- size_t alignment = ggml_backend_buft_get_alignment (bufts[i]);
1064- galloc->buf_tallocs [i] = ggml_dyn_tallocr_new (alignment);
1065- }
1066- }
1067- galloc->n_buffers = n_bufs;
1068-
1069- return galloc;
1070- }
1071-
10721043 bool alloc_compute_buffer (get_graph_cb_t get_graph) {
10731044 if (compute_allocr != NULL ) {
10741045 return true ;
@@ -1082,7 +1053,9 @@ struct ggml_gallocr * ggml_gallocr_new_n_multi(ggml_backend_buffer_type_t * buft
10821053 ggml_backend_get_default_buffer_type (backend)
10831054 };
10841055
1085- compute_allocr = ggml_gallocr_new_n_multi (bufts, 2 );
1056+ compute_allocr = ggml_gallocr_new_n (bufts, 2 );
1057+ size_t alignment = ggml_backend_buft_get_alignment (compute_allocr->bufts [1 ]);
1058+ compute_allocr->->buf_tallocs [1 ] = ggml_dyn_tallocr_new (alignment);
10861059
10871060 int n_nodes = gf->n_nodes ;
10881061 int n_leafs = gf->n_leafs ;
0 commit comments