Skip to content

Commit 33b4308

Browse files
committed
fix: page align to GGUF_DEFAULT_ALIGNMENT
1 parent df67ae3 commit 33b4308

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ggml/src/ggml.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void ggml_log_callback_default(enum ggml_log_level level, const char * text, voi
387387

388388
void * ggml_aligned_malloc(size_t size) {
389389
#if defined(_MSC_VER) || defined(__MINGW32__)
390-
return _aligned_malloc(size, GGML_MEM_ALIGN);
390+
return _aligned_malloc(size, GGUF_DEFAULT_ALIGNMENT);
391391
#else
392392
if (size == 0) {
393393
GGML_LOG_WARN("Behavior may be unexpected when allocating 0 bytes for ggml_aligned_malloc!\n");
@@ -416,7 +416,7 @@ void * ggml_aligned_malloc(size_t size) {
416416
#elif GGML_USE_METAL
417417
int result = posix_memalign(&aligned_memory, sysconf(_SC_PAGESIZE), size);
418418
#else
419-
int result = posix_memalign(&aligned_memory, GGML_MEM_ALIGN, size);
419+
int result = posix_memalign(&aligned_memory, GGUF_DEFAULT_ALIGNMENT, size);
420420
#endif
421421
if (result != 0) {
422422
// Handle allocation failure
@@ -442,11 +442,11 @@ void ggml_aligned_free(void * ptr, size_t size) {
442442
#if defined(_MSC_VER) || defined(__MINGW32__)
443443
_aligned_free(ptr);
444444
#elif GGML_USE_CPU_HBM
445-
if(ptr != NULL) {
445+
if (ptr != NULL) {
446446
hbw_free(ptr);
447447
}
448448
#elif TARGET_OS_OSX
449-
if(ptr != NULL) {
449+
if (ptr != NULL) {
450450
vm_deallocate((vm_map_t)mach_task_self(), (vm_address_t)ptr, size);
451451
}
452452
#else

0 commit comments

Comments
 (0)