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() ...@@ -21,3 +21,10 @@ ngraph::runtime::cpu::CPUAllocator::CPUAllocator()
, m_byte_size(0) , 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: ...@@ -57,9 +57,13 @@ public:
~CPUAllocator(); ~CPUAllocator();
private: private:
char* m_buffer; void* m_buffer;
size_t m_byte_size; size_t m_byte_size;
inline void* MallocHook(size_t size) { m_buffer = static_cast<char*>(ngraph_malloc(size)); } static inline void* MallocHook(size_t size)
inline void FreeHook() { ngraph_free(m_buffer); } {
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