diff options
author | Matthew Bentham <matthew.bentham@arm.com> | 2022-02-11 08:29:42 +0000 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2022-02-11 12:29:03 +0000 |
commit | 79bb6531358d5a780e8e86bce99fd39ae847c2f4 (patch) | |
tree | c818b67a263194947ba2181aa3b42de7ff86fc6e /include/armnnTestUtils | |
parent | bfa767ca56f9776e7dd3eecb4025cfeed87f9936 (diff) | |
download | armnn-79bb6531358d5a780e8e86bce99fd39ae847c2f4.tar.gz |
Fix unit test where NeonMemoryManager was used instead of RefMemoryManager
Although the Neon and Ref backends can use each other's TensorHandles,
their TensorHandleFactories can't use each other's MemoryManagers.
Incorrectly passing the NeonMemoryManager to the RefTensorHandleFactory
in unit test utility code resulted in an incorrect static_pointer_cast
and a warning from the Undefined Behaviour Sanitizer.
This change fixes the test code, and replaces use of static_pointer_cast
with armnn::PolymorphicPointerDowncast which will check that the cast is
legal in debug builds.
Also, remove MockWorkloadFactoryHelper.hpp as it is unused.
Signed-off-by: Matthew Bentham <matthew.bentham@arm.com>
Change-Id: I2b425e86fccacd7cc5ff186521fc6e53e7e50c77
Diffstat (limited to 'include/armnnTestUtils')
-rw-r--r-- | include/armnnTestUtils/MockWorkloadFactoryHelper.hpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/include/armnnTestUtils/MockWorkloadFactoryHelper.hpp b/include/armnnTestUtils/MockWorkloadFactoryHelper.hpp deleted file mode 100644 index e9f2b2f6cf..0000000000 --- a/include/armnnTestUtils/MockWorkloadFactoryHelper.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#pragma once - -#include "MockBackend.hpp" -#include "MockTensorHandleFactory.hpp" -#include <backendsCommon/test/WorkloadFactoryHelper.hpp> - -namespace -{ - -template <> -struct WorkloadFactoryHelper<armnn::MockWorkloadFactory> -{ - static armnn::IBackendInternal::IMemoryManagerSharedPtr GetMemoryManager() - { - armnn::MockBackend backend; - return backend.CreateMemoryManager(); - } - - static armnn::MockWorkloadFactory - GetFactory(const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) - { - IgnoreUnused(memoryManager); - return armnn::MockWorkloadFactory(); - } - - static armnn::MockTensorHandleFactory - GetTensorHandleFactory(const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) - { - - return armnn::MockTensorHandleFactory(std::static_pointer_cast<armnn::MockMemoryManager>(memoryManager)); - } -}; - -using MockWorkloadFactoryHelper = WorkloadFactoryHelper<armnn::MockWorkloadFactory>; - -} // anonymous namespace |