Skip to content

Commit 54b3ecc

Browse files
committed
ggml_aligned_malloc : use posix_memalign in macOS too
ggml-ci
1 parent 8aee1a8 commit 54b3ecc

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

ggml/src/ggml.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -232,23 +232,6 @@ void * ggml_aligned_malloc(size_t size) {
232232
void * aligned_memory = NULL;
233233
#ifdef GGML_USE_CPU_HBM
234234
int result = hbw_posix_memalign(&aligned_memory, alignment, size);
235-
#elif TARGET_OS_OSX
236-
kern_return_t alloc_status = vm_allocate((vm_map_t) mach_task_self(), (vm_address_t *) &aligned_memory, size, VM_FLAGS_ANYWHERE);
237-
int result = EFAULT;
238-
switch (alloc_status) {
239-
case KERN_SUCCESS:
240-
result = 0;
241-
break;
242-
case KERN_INVALID_ADDRESS:
243-
result = EINVAL;
244-
break;
245-
case KERN_NO_SPACE:
246-
result = ENOMEM;
247-
break;
248-
default:
249-
result = EFAULT;
250-
break;
251-
}
252235
#else
253236
int result = posix_memalign(&aligned_memory, alignment, size);
254237
#endif
@@ -278,10 +261,6 @@ void ggml_aligned_free(void * ptr, size_t size) {
278261
if (ptr != NULL) {
279262
hbw_free(ptr);
280263
}
281-
#elif TARGET_OS_OSX
282-
if (ptr != NULL) {
283-
vm_deallocate((vm_map_t)mach_task_self(), (vm_address_t)ptr, size);
284-
}
285264
#else
286265
free(ptr);
287266
#endif

0 commit comments

Comments
 (0)