From ded6382961e1b34b1da8dc108f068a2cf2856cb7 Mon Sep 17 00:00:00 2001 From: xaedes Date: Sat, 2 Sep 2023 20:52:25 +0200 Subject: [PATCH] add some more allocator debug prints --- ggml-alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ggml-alloc.c b/ggml-alloc.c index ab34e7077..045392a3b 100644 --- a/ggml-alloc.c +++ b/ggml-alloc.c @@ -158,6 +158,7 @@ void ggml_allocr_alloc(struct ggml_allocr * alloc, struct ggml_tensor * tensor) } tensor->data = addr; + AT_PRINTF("%s: allocated data at 0x%p\n", __func__, tensor->data); #ifdef GGML_ALLOCATOR_DEBUG add_allocated_tensor(alloc, tensor); @@ -189,7 +190,8 @@ static void ggml_allocator_free_tensor(struct ggml_allocr * alloc, struct ggml_t size_t size = ggml_allocator_get_alloc_size(alloc, tensor); size = aligned_offset(NULL, size, alloc->alignment); - AT_PRINTF("%s: freeing %s (%zu bytes) - n_free_blocks = %d\n", __func__, tensor->name, size, alloc->n_free_blocks); + AT_PRINTF("%s: freeing %s at 0x%p (%zu bytes) - n_free_blocks = %d\n", __func__, tensor->name, ptr, size, alloc->n_free_blocks); + AT_PRINTF("%s: alloc->data = 0x%p alloc->data+alloc->size = 0x%p alloc->data+alloc->max_size = 0x%p\n", __func__, alloc->data, (char*)alloc->data + alloc->size, (char*)alloc->data + alloc->max_size); #ifdef GGML_ALLOCATOR_DEBUG remove_allocated_tensor(alloc, tensor); @@ -382,7 +384,7 @@ static void allocate_node(struct ggml_allocr * alloc, struct ggml_tensor * node) // if the node's data is external, then we cannot re-use it if ((char *) parent->data < (char *) alloc->data || (char *) parent->data >= ((char *) alloc->data + alloc->size)) { - AT_PRINTF("not reusing parent %s for %s as %p is external\n", parent->name, node->name, parent->data); + AT_PRINTF("not reusing parent %s for %s as 0x%p is external\n", parent->name, node->name, parent->data); continue; }