Commit 50e96127 authored by Jayaram Bobba's avatar Jayaram Bobba Committed by Scott Cyphers

Handle zero sized buffer requests (#1764)

* Handle zero sized buffer requests

* Removed aligned buffer initialize() and moved allocation to constructor instead
parent 9debc0bc
...@@ -29,11 +29,6 @@ runtime::AlignedBuffer::AlignedBuffer() ...@@ -29,11 +29,6 @@ runtime::AlignedBuffer::AlignedBuffer()
} }
runtime::AlignedBuffer::AlignedBuffer(size_t byte_size, size_t alignment) runtime::AlignedBuffer::AlignedBuffer(size_t byte_size, size_t alignment)
{
initialize(byte_size, alignment);
}
void runtime::AlignedBuffer::initialize(size_t byte_size, size_t alignment)
{ {
m_byte_size = byte_size; m_byte_size = byte_size;
if (m_byte_size > 0) if (m_byte_size > 0)
...@@ -48,6 +43,11 @@ void runtime::AlignedBuffer::initialize(size_t byte_size, size_t alignment) ...@@ -48,6 +43,11 @@ void runtime::AlignedBuffer::initialize(size_t byte_size, size_t alignment)
m_aligned_buffer += (alignment - mod); m_aligned_buffer += (alignment - mod);
} }
} }
else
{
m_allocated_buffer = nullptr;
m_aligned_buffer = nullptr;
}
} }
runtime::AlignedBuffer::~AlignedBuffer() runtime::AlignedBuffer::~AlignedBuffer()
......
...@@ -34,7 +34,6 @@ class ngraph::runtime::AlignedBuffer ...@@ -34,7 +34,6 @@ class ngraph::runtime::AlignedBuffer
public: public:
AlignedBuffer(size_t byte_size, size_t alignment); AlignedBuffer(size_t byte_size, size_t alignment);
AlignedBuffer(); AlignedBuffer();
void initialize(size_t byte_size, size_t alignment);
~AlignedBuffer(); ~AlignedBuffer();
size_t size() const { return m_byte_size; } size_t size() const { return m_byte_size; }
......
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