Commit d227de8e authored by pruthvi's avatar pruthvi

reseat MKL memory allocators to ngraph functions

parent e17237de
......@@ -21,3 +21,10 @@ ngraph::runtime::cpu::CPUAllocator::CPUAllocator()
, m_byte_size(0)
{
}
ngraph::runtime::cpu::CPUAllocator::CPUAllocator(size_t size)
{
m_byte_size = size;
mkl::i_malloc = MallocHook;
mkl::i_free = FreeHook;
}
......@@ -57,9 +57,13 @@ public:
~CPUAllocator();
private:
char* m_buffer;
void* m_buffer;
size_t m_byte_size;
inline void* MallocHook(size_t size) { m_buffer = static_cast<char*>(ngraph_malloc(size)); }
inline void FreeHook() { ngraph_free(m_buffer); }
static inline void* MallocHook(size_t size)
{
void* ptr = static_cast<void*>(ngraph_malloc(size));
return ptr;
}
static inline void FreeHook(void* ptr) { ngraph_free(ptr); }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment