Skip to content

Commit c530d4e

Browse files
slarenhodlen
authored andcommitted
backend_sched : fix assignments
ggml-ci
1 parent c19100d commit c530d4e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ggml-backend.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,24 @@ static void sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgraph * g
10871087
}
10881088
}
10891089
}
1090+
1091+
// pass 2.4 expand rest down
1092+
{
1093+
ggml_tallocr_t cur_allocr = NULL;
1094+
for (int i = 0; i < graph->n_nodes; i++) {
1095+
struct ggml_tensor * node = graph->nodes[i];
1096+
if (ggml_is_view_op(node->op)) {
1097+
continue;
1098+
}
1099+
ggml_tallocr_t node_allocr = node_allocr(node);
1100+
if (node_allocr != NULL) {
1101+
cur_allocr = node_allocr;
1102+
} else {
1103+
node_allocr(node) = cur_allocr;
1104+
SET_CAUSE(node, "2.4");
1105+
}
1106+
}
1107+
}
10901108
#ifdef DEBUG_PASS2
10911109
fprintf(stderr, "PASS 2 ASSIGNMENTS\n"); sched_print_assignments(sched, graph);
10921110
#endif
@@ -1146,6 +1164,8 @@ static void sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgraph * g
11461164

11471165
ggml_tallocr_t node_allocr = node_allocr(node);
11481166

1167+
GGML_ASSERT(node_allocr != NULL); // all nodes should be assigned by now
1168+
11491169
if (node_allocr != cur_allocr) {
11501170
sched->splits[cur_split].i_end = i;
11511171
cur_split++;

0 commit comments

Comments
 (0)