From c42a987aa53d0fd842c34dee90abef5a9ff15fa4 Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Wed, 2 Feb 2022 16:35:09 +0000 Subject: IVGCVSW-6635 Move MemCopyTestImpl from acl to armnnTestUtils. * Move MemCopyTestImpl.hpp from src/backends/aclCommon/test/ to include/armnnTestutils. * Refactor MemCopyTests in aclCommon, cl and Neon. * Introduce RefMemCopyTests to exercise this utility in x86 builds. Signed-off-by: Colm Donelan Change-Id: I8824f013d3656658ed0a2904bb79384e3af68641 --- src/backends/aclCommon/test/MemCopyTests.cpp | 48 ++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'src/backends/aclCommon/test/MemCopyTests.cpp') diff --git a/src/backends/aclCommon/test/MemCopyTests.cpp b/src/backends/aclCommon/test/MemCopyTests.cpp index 132550342c..7b7d4ffb9e 100644 --- a/src/backends/aclCommon/test/MemCopyTests.cpp +++ b/src/backends/aclCommon/test/MemCopyTests.cpp @@ -4,13 +4,13 @@ // #include -#include #if defined(ARMCOMPUTECL_ENABLED) && defined(ARMCOMPUTENEON_ENABLED) +#include +#include #include #include #include - #include #include #endif @@ -42,6 +42,50 @@ TEST_CASE("AclTypeConversions") #if defined(ARMCOMPUTECL_ENABLED) && defined(ARMCOMPUTENEON_ENABLED) +namespace +{ + +template <> +struct MemCopyTestHelper +{ + static armnn::IBackendInternal::IMemoryManagerSharedPtr GetMemoryManager() + { + armnn::NeonBackend backend; + return backend.CreateMemoryManager(); + } + + static armnn::NeonWorkloadFactory GetFactory( + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ModelOptions& modelOptions = {}) + { + armnn::NeonBackend backend; + return armnn::NeonWorkloadFactory(armnn::PolymorphicPointerDowncast(memoryManager), + backend.CreateBackendSpecificModelContext(modelOptions)); + } +}; + +template <> +struct MemCopyTestHelper +{ + static armnn::IBackendInternal::IMemoryManagerSharedPtr GetMemoryManager() + { + armnn::ClBackend backend; + return backend.CreateMemoryManager(); + } + + static armnn::ClWorkloadFactory GetFactory( + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ModelOptions& modelOptions = {}) + { + armnn::ClBackend backend; + return armnn::ClWorkloadFactory(armnn::PolymorphicPointerDowncast(memoryManager), + backend.CreateBackendSpecificModelContext(modelOptions)); + } +}; +} // namespace + + + TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu") { LayerTestResult result = -- cgit v1.2.1