| 983 | } |
| 984 | |
| 985 | static bool ggml_backend_sched_buffer_supported(ggml_backend_sched_t sched, struct ggml_tensor * t, int backend_id) { |
| 986 | ggml_backend_buffer_t buf = t->view_src ? t->view_src->buffer : t->buffer; |
| 987 | ggml_backend_buffer_type_t buft = NULL; |
| 988 | |
| 989 | if (buf) { |
| 990 | // the tensor is already allocated |
| 991 | buft = buf->buft; |
| 992 | } else { |
| 993 | // see if the tensor already has a backend assigned, and use the buffer type of that backend |
| 994 | int tensor_backend_id = tensor_backend_id(t); |
| 995 | if (tensor_backend_id == -1 && t->view_src) { |
| 996 | tensor_backend_id = tensor_backend_id(t->view_src); |
| 997 | } |
| 998 | if (tensor_backend_id != -1) { |
| 999 | buft = sched->bufts[tensor_backend_id]; |
| 1000 | } |
| 1001 | } |
| 1002 | |
| 1003 | return buft != NULL && ggml_backend_supports_buft(sched->backends[backend_id], buft); |
| 1004 | } |
| 1005 | |
| 1006 | static void ggml_backend_sched_set_if_supported(ggml_backend_sched_t sched, struct ggml_tensor * node, int cur_backend_id, int * node_backend_id) { |
| 1007 | if (ggml_backend_supports_op(sched->backends[cur_backend_id], node)) { |
no test coverage detected