summaryrefslogtreecommitdiff
path: root/ggml-alloc.c
diff options
context:
space:
mode:
authorJhen-Jie Hong <iainst0409@gmail.com>2023-09-02 20:23:45 +0800
committerGitHub <noreply@github.com>2023-09-02 15:23:45 +0300
commit21f3d1be867b4d7be07c26f5da6e4bc69bcf4d27 (patch)
tree45c20ca06d8cbdfb72cbbba38a08fa0b988b53d0 /ggml-alloc.c
parent571083f508266c4eb5cb5457d836df5dd3c173ce (diff)
k-quants : fix build on armv7 (android only) (#2920)
* k-quants : fix build on armv7 * ggml : cleanup unused arm32 specific impl * k-quants : avoid some unused vzero / mzero define * ggml-alloc : use 4g for MEASURE_MAX_SIZE in 32-bit arm
Diffstat (limited to 'ggml-alloc.c')
-rw-r--r--ggml-alloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ggml-alloc.c b/ggml-alloc.c
index f07a4a21..459f121c 100644
--- a/ggml-alloc.c
+++ b/ggml-alloc.c
@@ -284,7 +284,14 @@ struct ggml_allocr * ggml_allocr_new(void * data, size_t size, size_t alignment)
// address and size of the buffer when measuring
// it needs to be large enough to fit all the tensors, but it cannot overlap with other existing buffers
static void * const MEASURE_BASE_ADDR = (void *) 0x1000;
+#if defined(__ARM_NEON) && !defined(__aarch64__)
+// 32-bit
+// TODO: Use for 32-bit x86 as well
+static const size_t MEASURE_MAX_SIZE = (1ULL<<32) - 1; // 4 GB
+#else
+// 64-bit
static const size_t MEASURE_MAX_SIZE = 1ULL<<40; // 1 TB
+#endif
struct ggml_allocr * ggml_allocr_new_measure(size_t alignment) {
struct ggml_allocr * alloc = (struct ggml_allocr *)malloc(sizeof(struct ggml_allocr) /* + n_free_blocks * sizeof(struct free_block) */);