aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/Runtime.cpp
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2021-08-12 11:55:21 +0100
committerFrancis Murtagh <francis.murtagh@arm.com>2021-08-12 11:56:04 +0100
commit62573b6aa595a0ee469d7beb8ef4ac8e82211570 (patch)
tree21cc7d8a23e9fd0df6bc226293a9d5f0316d2a5b /src/armnn/Runtime.cpp
parent49907c897929b38cb4370b6b253ec1392f056868 (diff)
downloadarmnn-62573b6aa595a0ee469d7beb8ef4ac8e82211570.tar.gz
IVGCVSW-6077 Add Custom Allocator tests
* Add test for invalid backend and nullptr * Small refactor * Throw exception on nullptr allocator instead of assert Signed-off-by: Francis Murtagh <francis.murtagh@arm.com> Change-Id: I94ce4f61d7cb3123831f1acd98165ae14c40033a
Diffstat (limited to 'src/armnn/Runtime.cpp')
-rw-r--r--src/armnn/Runtime.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp
index 5a52888639..824a2b077c 100644
--- a/src/armnn/Runtime.cpp
+++ b/src/armnn/Runtime.cpp
@@ -286,6 +286,11 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
ARMNN_ASSERT(backend.get() != nullptr);
auto customAllocatorMapIterator = options.m_CustomAllocatorMap.find(id);
+ if (customAllocatorMapIterator != options.m_CustomAllocatorMap.end() &&
+ customAllocatorMapIterator->second == nullptr)
+ {
+ throw armnn::Exception("Allocator associated with id " + id.Get() + " is null");
+ }
// If the runtime is created in protected mode only add backends that support this mode
if (options.m_ProtectedMode)
@@ -307,8 +312,6 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
if (customAllocatorMapIterator != options.m_CustomAllocatorMap.end())
{
std::string err;
- // Check we have actually been given an allocator.
- ARMNN_ASSERT(customAllocatorMapIterator->second != nullptr);
if (customAllocatorMapIterator->second->GetMemorySourceType()
== armnn::MemorySource::DmaBufProtected)
{