@@ -689,7 +689,7 @@ static int ggml_backend_sched_backend_id(ggml_backend_sched_t sched, ggml_backen
689
689
}
690
690
691
691
static int ggml_backend_sched_backend_from_buffer (ggml_backend_sched_t sched, const struct ggml_tensor * tensor, const struct ggml_tensor * op) {
692
- ggml_backend_buffer_t buffer = tensor->buffer ;
692
+ ggml_backend_buffer_t buffer = tensor->view_src ? tensor-> view_src -> buffer : tensor-> buffer ;
693
693
if (buffer == NULL ) {
694
694
return -1 ;
695
695
}
@@ -722,8 +722,6 @@ static char causes[GGML_DEFAULT_GRAPH_SIZE*16 + GGML_SCHED_MAX_SPLITS_DEBUG*GGML
722
722
723
723
// returns the backend that should be used for the node based on the current locations
724
724
static int ggml_backend_sched_backend_id_from_cur (ggml_backend_sched_t sched, struct ggml_tensor * tensor) {
725
- // TODO: use supports_op to check if the backend supports the op
726
-
727
725
// assign pre-allocated nodes to their backend
728
726
int cur_backend_id = ggml_backend_sched_backend_from_buffer (sched, tensor, tensor);
729
727
if (cur_backend_id != -1 ) {
@@ -742,7 +740,7 @@ static int ggml_backend_sched_backend_id_from_cur(ggml_backend_sched_t sched, st
742
740
743
741
if (tensor->buffer || (tensor->view_src && tensor->view_src ->buffer )) {
744
742
// since the tensor is pre-allocated, it cannot be moved to another backend
745
- GGML_ABORT (" pre-allocated tensor in a backend that cannot run the operation" );
743
+ GGML_ABORT (" pre-allocated tensor (%s) in a backend that cannot run the operation" , tensor-> name );
746
744
}
747
745
748
746
// graph input
@@ -886,6 +884,9 @@ static void ggml_backend_sched_split_graph(ggml_backend_sched_t sched, struct gg
886
884
for (int i = 0 ; i < graph->n_nodes ; i++) {
887
885
struct ggml_tensor * node = graph->nodes [i];
888
886
int * node_backend_id = &tensor_backend_id (node);
887
+ if (ggml_is_view_op (node->op )) {
888
+ continue ;
889
+ }
889
890
// do not overwrite user assignments
890
891
if (*node_backend_id == -1 ) {
891
892
*node_backend_id = ggml_backend_sched_backend_id_from_cur (sched, node);
0 commit comments