File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1616#include < cstring>
1717#include < memory>
1818
19+ #ifdef GGML_USE_NUMA_MIGRATE
20+ #include < numa.h>
21+ #endif
22+
1923#if defined(__AMX_INT8__) && defined(__AVX512VNNI__)
2024
2125// AMX type_trais
@@ -43,7 +47,11 @@ static ggml::cpu::tensor_traits * get_tensor_traits(ggml_backend_buffer_t, struc
4347
4448// AMX buffer interface
4549static void ggml_backend_amx_buffer_free_buffer (ggml_backend_buffer_t buffer) {
50+ #ifdef GGML_USE_NUMA_MIGRATE
51+ numa_free (buffer->context , buffer->size );
52+ #else
4653 free (buffer->context );
54+ #endif
4755}
4856
4957static void * ggml_backend_amx_buffer_get_base (ggml_backend_buffer_t buffer) {
@@ -123,7 +131,11 @@ static const char * ggml_backend_amx_buffer_type_get_name(ggml_backend_buffer_ty
123131}
124132
125133static ggml_backend_buffer_t ggml_backend_amx_buffer_type_alloc_buffer (ggml_backend_buffer_type_t buft, size_t size) {
134+ #ifdef GGML_USE_NUMA_MIGRATE
135+ void * data = numa_alloc_onnode (size, 0 );
136+ #else
126137 void * data = ggml_aligned_malloc (size);
138+ #endif
127139 if (data == NULL ) {
128140 fprintf (stderr, " %s: failed to allocate buffer of size %zu\n " , __func__, size);
129141 return NULL ;
You can’t perform that action at this time.
0 commit comments