99#include < iostream>
1010#include < functional>
1111#include < assert.h>
12- #ifdef ENABLE_NUMA
13- #include " numa.h"
14- #endif
12+ #include " memory_alloc.hpp"
1513#include " log.hpp"
1614#include " bf16.hpp"
1715
@@ -30,7 +28,7 @@ struct tensor2D {
3028 tensor2D () = default ;
3129 tensor2D (const tensor2D&) = delete ;
3230 ~tensor2D () {
33- if (own && data) :: free (data);
31+ if (own && data) llmdnn_free (data, capacity );
3432 }
3533
3634 operator bool () {
@@ -104,22 +102,11 @@ struct tensor2D {
104102 if (capacity < need_capacity) {
105103 if (!is_const)
106104 need_capacity *= 2 ;
107- capacity = need_capacity;
108105 // align begin address to cache line is vital, so tile load can
109106 // use all bandwidth (L1D/L2 only deliver data in unit of 64-byte aligned cache-line)
110-
111- #ifdef ENABLE_NUMA
112- if (USE_NUMA) {
113- data = std::shared_ptr<T>(
114- reinterpret_cast <T*>(numa_alloc_local (capacity)),
115- [need_capacity](void * p){ numa_free (p, need_capacity); });
116- } else {
117- #else
118- {
119- #endif
120- if (data) ::free (data);
121- data = reinterpret_cast <T*>(aligned_alloc (64 , capacity));
122- }
107+ if (data) llmdnn_free (data, capacity);
108+ data = reinterpret_cast <T*>(llmdnn_alloc (64 , need_capacity));
109+ capacity = need_capacity;
123110 if (is_const)
124111 memset (static_cast <void *>(data), 0 , need_capacity);
125112 if (reinterpret_cast <uintptr_t >(data) % 64 )
0 commit comments