Skip to content

Commit 2f2c367

Browse files
committed
cuda : add ggml-backend split buffer support
1 parent ece0b0d commit 2f2c367

File tree

4 files changed

+318
-74
lines changed

4 files changed

+318
-74
lines changed

ggml-backend.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,9 @@ static void sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgraph * g
10151015
ggml_tallocr_t node_allocr = node_allocr(node);
10161016
if (node_allocr != NULL) {
10171017
if (sched_allocr_prio(sched, node_allocr) == sched->n_backends - 1) {
1018+
// skip cpu
10181019
cur_allocr = NULL;
1019-
}
1020-
else {
1020+
} else {
10211021
cur_allocr = node_allocr;
10221022
}
10231023
} else {
@@ -1038,9 +1038,9 @@ static void sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgraph * g
10381038
ggml_tallocr_t node_allocr = node_allocr(node);
10391039
if (node_allocr != NULL) {
10401040
if (sched_allocr_prio(sched, node_allocr) == sched->n_backends - 1) {
1041+
// skip cpu
10411042
cur_allocr = NULL;
1042-
}
1043-
else {
1043+
} else {
10441044
cur_allocr = node_allocr;
10451045
}
10461046
} else {
@@ -1274,7 +1274,7 @@ static void sched_compute_splits(ggml_backend_sched_t sched) {
12741274
GGML_ASSERT(false);
12751275
}
12761276
// TODO: avoid this copy if it was already copied in a previous split, and the input didn't change
1277-
// this is important to avoid copying constants such as KQ_mask and inp_pos multiple time
1277+
// this is important to avoid copying constants such as KQ_mask and inp_pos multiple times
12781278
ggml_backend_tensor_copy(input, input_cpy);
12791279
}
12801280
// ggml_backend_synchronize(split_backend);

0 commit comments

Comments
 (0)