Commit 153053fa authored by pruthvi's avatar pruthvi

Addressed PR comments

parent 5abfaebf
...@@ -38,7 +38,7 @@ runtime::AlignedBuffer::AlignedBuffer(size_t byte_size, size_t alignment, Alloca ...@@ -38,7 +38,7 @@ runtime::AlignedBuffer::AlignedBuffer(size_t byte_size, size_t alignment, Alloca
{ {
m_byte_size = std::max<size_t>(1, byte_size); m_byte_size = std::max<size_t>(1, byte_size);
size_t allocation_size = m_byte_size + alignment; size_t allocation_size = m_byte_size + alignment;
m_allocated_buffer = static_cast<char*>(m_allocator->Malloc(allocation_size, alignment)); m_allocated_buffer = static_cast<char*>(m_allocator->malloc(allocation_size, alignment));
m_aligned_buffer = m_allocated_buffer; m_aligned_buffer = m_allocated_buffer;
size_t mod = size_t(m_aligned_buffer) % alignment; size_t mod = size_t(m_aligned_buffer) % alignment;
...@@ -52,6 +52,6 @@ runtime::AlignedBuffer::~AlignedBuffer() ...@@ -52,6 +52,6 @@ runtime::AlignedBuffer::~AlignedBuffer()
{ {
if (m_allocated_buffer != nullptr) if (m_allocated_buffer != nullptr)
{ {
m_allocator->Free(m_allocated_buffer); m_allocator->free(m_allocated_buffer);
} }
} }
...@@ -23,7 +23,7 @@ ngraph::runtime::Allocator::~Allocator() ...@@ -23,7 +23,7 @@ ngraph::runtime::Allocator::~Allocator()
class ngraph::runtime::DefaultAllocator : public ngraph::runtime::Allocator class ngraph::runtime::DefaultAllocator : public ngraph::runtime::Allocator
{ {
public: public:
void* Malloc(size_t size, size_t alignment) void* malloc(size_t size, size_t alignment)
{ {
// If allocation succeeds, returns a pointer to the lowest (first) byte in the // If allocation succeeds, returns a pointer to the lowest (first) byte in the
// allocated memory block that is suitably aligned for any scalar type. // allocated memory block that is suitably aligned for any scalar type.
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
return ptr; return ptr;
} }
void Free(void* ptr) void free(void* ptr)
{ {
if (ptr) if (ptr)
{ {
...@@ -51,6 +51,6 @@ public: ...@@ -51,6 +51,6 @@ public:
ngraph::runtime::Allocator* ngraph::runtime::get_ngraph_allocator() ngraph::runtime::Allocator* ngraph::runtime::get_ngraph_allocator()
{ {
auto allocator = new ngraph::runtime::DefaultAllocator(); static DefaultAllocator* allocator = new DefaultAllocator();
return allocator; return allocator;
} }
...@@ -42,9 +42,9 @@ public: ...@@ -42,9 +42,9 @@ public:
/// \brief allocates memory with the given size and alignment requirement /// \brief allocates memory with the given size and alignment requirement
/// \param size exact size of bytes to allocate /// \param size exact size of bytes to allocate
/// \param alignment specifies the alignment. Must be a valid alignment supported by the implementation. /// \param alignment specifies the alignment. Must be a valid alignment supported by the implementation.
virtual void* Malloc(size_t size, size_t alignment) = 0; virtual void* malloc(size_t size, size_t alignment) = 0;
/// \brief deallocates the memory pointed by ptr /// \brief deallocates the memory pointed by ptr
/// \param ptr pointer to the aligned memory to be released /// \param ptr pointer to the aligned memory to be released
virtual void Free(void* ptr) = 0; virtual void free(void* ptr) = 0;
}; };
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