Skip to content

Commit d052a3f

Browse files
authored
ggml_graph_n_nodes
1 parent 0a14f0e commit d052a3f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ggml_extend.hpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -1055,23 +1055,17 @@ struct GGMLRunner {
10551055

10561056
compute_allocr = ggml_gallocr_new_n(bufts, 2);
10571057

1058-
int n_nodes = gf->n_nodes;
1059-
int n_leafs = gf->n_leafs;
1058+
int n_nodes = ggml_graph_n_nodes(gf);
10601059

1061-
int total_n_half = (n_nodes + n_leafs) / 2;
1060+
int total_n_half = n_nodes / 2;
10621061

10631062
int * node_buffer_ids = (int *)calloc(n_nodes, sizeof(int));
1064-
int * leaf_buffer_ids = (int *)calloc(n_leafs, sizeof(int));
10651063

10661064
for (int i = 0; i < n_nodes; i++) {
10671065
node_buffer_ids[i] = i < total_n_half ? 0 : 1;
10681066
}
10691067

1070-
for (int i = 0; i < n_leafs; i++) {
1071-
leaf_buffer_ids[i] = (n_nodes + i) < total_n_half ? 0 : 1;
1072-
}
1073-
1074-
if (!ggml_gallocr_reserve_n(compute_allocr, gf, node_buffer_ids, leaf_buffer_ids)) {
1068+
if (!ggml_gallocr_reserve_n(compute_allocr, gf, node_buffer_ids, null)) {
10751069
// failed to allocate the compute buffer
10761070
LOG_ERROR("%s: failed to allocate the compute buffer\n", get_desc().c_str());
10771071
free_compute_buffer();

0 commit comments

Comments
 (0)