| 994 | } |
| 995 | |
| 996 | static bool ggml_gallocr_node_needs_realloc(ggml_gallocr_t galloc, struct ggml_tensor * node, struct tensor_alloc * talloc) { |
| 997 | size_t node_size = 0; |
| 998 | if (!node->data && !node->view_src) { |
| 999 | // If we previously had data but don't now then reallocate |
| 1000 | if (talloc->buffer_id < 0) { |
| 1001 | return false; |
| 1002 | } |
| 1003 | node_size = ggml_backend_buft_get_alloc_size(galloc->bufts[talloc->buffer_id], node); |
| 1004 | } |
| 1005 | return talloc->size_max >= node_size; |
| 1006 | } |
| 1007 | |
| 1008 | static bool ggml_gallocr_needs_realloc(ggml_gallocr_t galloc, struct ggml_cgraph * graph) { |
| 1009 | if (galloc->n_nodes != graph->n_nodes) { |
no test coverage detected