@@ -1040,35 +1040,6 @@ struct GGMLRunner {
1040
1040
}
1041
1041
}
1042
1042
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
-
1072
1043
bool alloc_compute_buffer (get_graph_cb_t get_graph) {
1073
1044
if (compute_allocr != NULL ) {
1074
1045
return true ;
@@ -1082,7 +1053,9 @@ struct ggml_gallocr * ggml_gallocr_new_n_multi(ggml_backend_buffer_type_t * buft
1082
1053
ggml_backend_get_default_buffer_type (backend)
1083
1054
};
1084
1055
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);
1086
1059
1087
1060
int n_nodes = gf->n_nodes ;
1088
1061
int n_leafs = gf->n_leafs ;
0 commit comments