Commit 827d35ac authored by pruthvi's avatar pruthvi

- rename get_ngraph_allocator to get_default_allocator

- return nullptr if caller queries get_device_allocator from allocator base ptr
parent 9d731ea3
...@@ -36,7 +36,7 @@ class ngraph::runtime::AlignedBuffer ...@@ -36,7 +36,7 @@ class ngraph::runtime::AlignedBuffer
public: public:
AlignedBuffer(size_t byte_size, AlignedBuffer(size_t byte_size,
size_t alignment, size_t alignment,
Allocator* allocator = get_ngraph_allocator()); Allocator* allocator = get_default_allocator());
AlignedBuffer(); AlignedBuffer();
~AlignedBuffer(); ~AlignedBuffer();
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
} }
}; };
ngraph::runtime::Allocator* ngraph::runtime::get_ngraph_allocator() ngraph::runtime::Allocator* ngraph::runtime::get_default_allocator()
{ {
static DefaultAllocator* allocator = new DefaultAllocator(); static DefaultAllocator* allocator = new DefaultAllocator();
return allocator; return allocator;
......
...@@ -30,7 +30,7 @@ namespace ngraph ...@@ -30,7 +30,7 @@ namespace ngraph
class DefaultAllocator; class DefaultAllocator;
/// \brief Returns a statically allocated default ngraph allocator /// \brief Returns a statically allocated default ngraph allocator
// that calls into system allocation libraries // that calls into system allocation libraries
Allocator* get_ngraph_allocator(); Allocator* get_default_allocator();
} }
} }
......
...@@ -145,7 +145,7 @@ public: ...@@ -145,7 +145,7 @@ public:
/// \brief Returns memory allocator used by backend for host allocations /// \brief Returns memory allocator used by backend for host allocations
virtual Allocator* get_host_memory_allocator() virtual Allocator* get_host_memory_allocator()
{ {
return ngraph::runtime::get_ngraph_allocator(); return ngraph::runtime::get_default_allocator();
} }
/// \brief Set the host memory allocator to be used by the backend /// \brief Set the host memory allocator to be used by the backend
...@@ -154,7 +154,9 @@ public: ...@@ -154,7 +154,9 @@ public:
/// \brief Returns memory allocator used by backend for device allocations /// \brief Returns memory allocator used by backend for device allocations
virtual Allocator* get_device_memory_allocator() virtual Allocator* get_device_memory_allocator()
{ {
return ngraph::runtime::get_ngraph_allocator(); // override this method from each supported backend to return
// its own device memory allocator
return nullptr;
} }
/// \brief method for each supported backend to determine if the passed pointer is in device pinned memory or not /// \brief method for each supported backend to determine if the passed pointer is in device pinned memory or not
......
...@@ -165,7 +165,7 @@ runtime::Allocator* runtime::cpu::CPU_Backend::get_host_memory_allocator() ...@@ -165,7 +165,7 @@ runtime::Allocator* runtime::cpu::CPU_Backend::get_host_memory_allocator()
} }
else else
{ {
return runtime::get_ngraph_allocator(); return runtime::get_default_allocator();
} }
} }
......
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