aboutsummaryrefslogtreecommitdiff
path: root/ggml-alloc.h
diff options
context:
space:
mode:
authorslaren <slarengh@gmail.com>2023-07-30 15:58:01 +0200
committerGitHub <noreply@github.com>2023-07-30 15:58:01 +0200
commita113689571420fb4d6540f1a324d12965781356a (patch)
tree7ae5da392644f6c72e49aa88137a77875239dfe8 /ggml-alloc.h
parent11f3ca06b8c66b0427aab0a472479da22553b472 (diff)
ggml : add graph tensor allocator (#2411)
* ggml : add graph tensor allocator * ggml : don't calculate data pointer of unallocated tensors when creating a view with an offset * ggml : refactor ggml_view_Nd into ggml_view_tensor_offset
Diffstat (limited to 'ggml-alloc.h')
-rw-r--r--ggml-alloc.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/ggml-alloc.h b/ggml-alloc.h
new file mode 100644
index 0000000..a5ec8f8
--- /dev/null
+++ b/ggml-alloc.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "ggml.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+GGML_API struct ggml_allocr * ggml_allocr_new(void * data, size_t size, size_t alignment);
+GGML_API struct ggml_allocr * ggml_allocr_new_measure(size_t alignment);
+
+GGML_API void ggml_allocr_free(struct ggml_allocr * alloc);
+GGML_API bool ggml_allocr_is_measure(struct ggml_allocr * alloc);
+GGML_API void ggml_allocr_reset(struct ggml_allocr * alloc);
+GGML_API void ggml_allocr_alloc(struct ggml_allocr * alloc, struct ggml_tensor * tensor);
+GGML_API size_t ggml_allocr_alloc_graph(struct ggml_allocr * alloc, struct ggml_cgraph * graph);
+
+
+#ifdef __cplusplus
+}
+#endif