summaryrefslogtreecommitdiff
path: root/ggml-alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ggml-alloc.c')
-rw-r--r--ggml-alloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ggml-alloc.c b/ggml-alloc.c
index 140e9a2a..63beb1d4 100644
--- a/ggml-alloc.c
+++ b/ggml-alloc.c
@@ -107,6 +107,10 @@ static size_t ggml_allocator_get_alloc_size(struct ggml_allocr * alloc, struct g
}
void ggml_allocr_alloc(struct ggml_allocr * alloc, struct ggml_tensor * tensor) {
+#ifdef GGML_ALLOCATOR_DEBUG
+ GGML_ASSERT(ggml_is_view(tensor) == false); // views generally get data pointer from one of their sources
+ GGML_ASSERT(tensor->data == NULL); // avoid allocating tensor which already has memory allocated
+#endif
size_t size = ggml_allocator_get_alloc_size(alloc, tensor);
size = aligned_offset(NULL, size, alloc->alignment);