MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / ggml_gallocr_free_node

Function ggml_gallocr_free_node

external/ggml/src/ggml-alloc.c:690–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688}
689
690static void ggml_gallocr_free_node(ggml_gallocr_t galloc, struct ggml_tensor * node) {
691 // graph outputs are never freed
692 if (node->flags & GGML_TENSOR_FLAG_OUTPUT) {
693 AT_PRINTF("not freeing output %s\n", node->name);
694 return;
695 }
696
697 struct hash_node * hn = ggml_gallocr_hash_get(galloc, node);
698 int buffer_id = hn->buffer_id;
699 struct ggml_dyn_tallocr * alloc = galloc->buf_tallocs[buffer_id];
700 ggml_backend_buffer_type_t buft = galloc->bufts[buffer_id];
701 size_t size = ggml_backend_buft_get_alloc_size(buft, node);
702
703 AT_PRINTF("%s: freeing %s at {chunk=%d, offset=%zu} (%zu bytes) - n_free_blocks = %d\n",
704 __func__, node->name, hn->addr.chunk, hn->addr.offset, size, alloc->chunks[hn->addr.chunk]->n_free_blocks);
705#ifdef GGML_ALLOCATOR_DEBUG
706 remove_allocated_tensor(alloc, hn->addr, node);
707#endif
708
709 ggml_dyn_tallocr_free_bytes(alloc, hn->addr, size);
710 hn->allocated = false;
711}
712
713static int get_node_buffer_id(const int * node_buffer_ids, int i) {
714 return node_buffer_ids ? node_buffer_ids[i] : 0;

Callers 1

Calls 4

ggml_gallocr_hash_getFunction · 0.85
remove_allocated_tensorFunction · 0.85

Tested by

no test coverage detected