aboutsummaryrefslogtreecommitdiff
path: root/src/backends/cl
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/cl')
-rw-r--r--src/backends/cl/CMakeLists.txt1
-rw-r--r--src/backends/cl/ClBackend.cpp15
-rw-r--r--src/backends/cl/ClRegistryInitializer.cpp25
-rw-r--r--src/backends/cl/backend.mk12
-rw-r--r--src/backends/cl/test/CMakeLists.txt7
-rw-r--r--src/backends/cl/test/ClCreateWorkloadTests.cpp6
-rw-r--r--src/backends/cl/test/ClLayerTests.cpp16
7 files changed, 58 insertions, 24 deletions
diff --git a/src/backends/cl/CMakeLists.txt b/src/backends/cl/CMakeLists.txt
index 36db107a8a..ad4a15f2e8 100644
--- a/src/backends/cl/CMakeLists.txt
+++ b/src/backends/cl/CMakeLists.txt
@@ -14,6 +14,7 @@ if(ARMCOMPUTECL)
ClContextControl.hpp
ClLayerSupport.cpp
ClLayerSupport.hpp
+ ClRegistryInitializer.cpp
ClTensorHandle.hpp
ClTensorHandleFactory.cpp
ClTensorHandleFactory.hpp
diff --git a/src/backends/cl/ClBackend.cpp b/src/backends/cl/ClBackend.cpp
index 123d0639de..95ffbc48fd 100644
--- a/src/backends/cl/ClBackend.cpp
+++ b/src/backends/cl/ClBackend.cpp
@@ -25,21 +25,6 @@
namespace armnn
{
-namespace
-{
-
-static BackendRegistry::StaticRegistryInitializer g_RegisterHelper
-{
- BackendRegistryInstance(),
- ClBackend::GetIdStatic(),
- []()
- {
- return IBackendInternalUniquePtr(new ClBackend);
- }
-};
-
-}
-
const BackendId& ClBackend::GetIdStatic()
{
static const BackendId s_Id{ClBackendId()};
diff --git a/src/backends/cl/ClRegistryInitializer.cpp b/src/backends/cl/ClRegistryInitializer.cpp
new file mode 100644
index 0000000000..4d6f5f4a05
--- /dev/null
+++ b/src/backends/cl/ClRegistryInitializer.cpp
@@ -0,0 +1,25 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "ClBackend.hpp"
+
+#include <backendsCommon/BackendRegistry.hpp>
+
+namespace
+{
+
+using namespace armnn;
+
+static BackendRegistry::StaticRegistryInitializer g_RegisterHelper
+{
+ BackendRegistryInstance(),
+ ClBackend::GetIdStatic(),
+ []()
+ {
+ return IBackendInternalUniquePtr(new ClBackend);
+ }
+};
+
+} // Anonymous namespace
diff --git a/src/backends/cl/backend.mk b/src/backends/cl/backend.mk
index 98da871e70..104200470b 100644
--- a/src/backends/cl/backend.mk
+++ b/src/backends/cl/backend.mk
@@ -7,7 +7,7 @@
# in the Android build and it is picked up by the Android.mk
# file in the root of ArmNN
-# The variable to enable/disable the CL backend (ARMNN_COMPUTE_CL_ENABLED) is declared in android-nn-driver/Android.mk
+# The variable to enable/disable the CL backend (ARMNN_COMPUTE_CL_ENABLED is declared in android-nn-driver/Android.mk)
ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1)
# ARMNN_COMPUTE_CL_ENABLED == 1
@@ -18,6 +18,7 @@ BACKEND_SOURCES := \
ClBackendContext.cpp \
ClContextControl.cpp \
ClLayerSupport.cpp \
+ ClRegistryInitializer.cpp \
ClTensorHandleFactory.cpp \
ClWorkloadFactory.cpp \
OpenClTimer.cpp \
@@ -74,7 +75,7 @@ endif
# in the Android unit test build (armnn-tests) and it is picked
# up by the Android.mk file in the root of ArmNN
-# The variable to enable/disable the CL backend (ARMNN_COMPUTE_CL_ENABLED) is declared in android-nn-driver/Android.mk
+# The variable to enable/disable the CL backend (ARMNN_COMPUTE_CL_ENABLED is declared in android-nn-driver/Android.mk)
ifeq ($(ARMNN_COMPUTE_CL_ENABLED),1)
# ARMNN_COMPUTE_CL_ENABLED == 1
@@ -86,11 +87,16 @@ BACKEND_TEST_SOURCES := \
test/ClJsonPrinterTests.cpp \
test/ClLayerSupportTests.cpp \
test/ClLayerTests.cpp \
- test/ClMemCopyTests.cpp \
test/ClOptimizedNetworkTests.cpp \
test/ClRuntimeTests.cpp \
test/Fp16SupportTest.cpp \
test/OpenClTimerTest.cpp
+
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+BACKEND_TEST_SOURCES += \
+ test/ClMemCopyTests.cpp
+endif # ARMNN_COMPUTE_REF_ENABLED == 1
+
else
# ARMNN_COMPUTE_CL_ENABLED == 0
diff --git a/src/backends/cl/test/CMakeLists.txt b/src/backends/cl/test/CMakeLists.txt
index 206cf5a9dd..4ec5051fa2 100644
--- a/src/backends/cl/test/CMakeLists.txt
+++ b/src/backends/cl/test/CMakeLists.txt
@@ -10,7 +10,6 @@ list(APPEND armnnClBackendUnitTests_sources
ClJsonPrinterTests.cpp
ClLayerSupportTests.cpp
ClLayerTests.cpp
- ClMemCopyTests.cpp
ClOptimizedNetworkTests.cpp
ClRuntimeTests.cpp
ClWorkloadFactoryHelper.hpp
@@ -18,6 +17,12 @@ list(APPEND armnnClBackendUnitTests_sources
OpenClTimerTest.cpp
)
+if (ARMCOMPUTEREF)
+ list(APPEND armnnClBackendUnitTests_sources
+ ClMemCopyTests.cpp
+ )
+endif()
+
add_library(armnnClBackendUnitTests OBJECT ${armnnClBackendUnitTests_sources})
target_include_directories(armnnClBackendUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
target_include_directories(armnnClBackendUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
diff --git a/src/backends/cl/test/ClCreateWorkloadTests.cpp b/src/backends/cl/test/ClCreateWorkloadTests.cpp
index bb36504214..ff9d23a699 100644
--- a/src/backends/cl/test/ClCreateWorkloadTests.cpp
+++ b/src/backends/cl/test/ClCreateWorkloadTests.cpp
@@ -686,6 +686,10 @@ BOOST_AUTO_TEST_CASE(CreateSingleOutputMultipleInputs)
BOOST_TEST(validDataPointers);
}
+#if defined(ARMCOMPUTEREF_ENABLED)
+
+// This test unit needs the reference backend, it's not available if the reference backend is not built
+
BOOST_AUTO_TEST_CASE(CreateMemCopyWorkloadsCl)
{
ClWorkloadFactory factory =
@@ -694,6 +698,8 @@ BOOST_AUTO_TEST_CASE(CreateMemCopyWorkloadsCl)
CreateMemCopyWorkloads<IClTensorHandle>(factory);
}
+#endif
+
template <typename L2NormalizationWorkloadType, typename armnn::DataType DataType>
static void ClL2NormalizationWorkloadTest(DataLayout dataLayout)
{
diff --git a/src/backends/cl/test/ClLayerTests.cpp b/src/backends/cl/test/ClLayerTests.cpp
index 8a5435b83c..092aa61a1f 100644
--- a/src/backends/cl/test/ClLayerTests.cpp
+++ b/src/backends/cl/test/ClLayerTests.cpp
@@ -13,7 +13,6 @@
#include <cl/ClLayerSupport.hpp>
#include <cl/ClWorkloadFactory.hpp>
#include <cl/workloads/ClWorkloadUtils.hpp>
-#include <reference/RefWorkloadFactory.hpp>
#include <backendsCommon/test/ActivationFixture.hpp>
#include <backendsCommon/test/LayerTests.hpp>
#include <backendsCommon/test/PermuteTestImpl.hpp>
@@ -463,10 +462,6 @@ ARMNN_AUTO_TEST_CASE(Simple3dSoftmaxUint8, Simple3dSoftmaxUint8Test, 1.0f)
ARMNN_AUTO_TEST_CASE(Simple4dSoftmax, Simple4dSoftmaxTest, 1.0f)
ARMNN_AUTO_TEST_CASE(Simple4dSoftmaxUint8, Simple4dSoftmaxUint8Test, 1.0f)
-ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f)
-ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f)
-ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8, CompareSoftmaxUint8Test, 1.0f)
-
// Space To Batch Nd
ARMNN_AUTO_TEST_CASE(SpaceToBatchNdSimpleFloat32, SpaceToBatchNdSimpleFloat32Test)
ARMNN_AUTO_TEST_CASE(SpaceToBatchNdMultiChannelsFloat32, SpaceToBatchNdMultiChannelsFloat32Test)
@@ -773,9 +768,18 @@ ARMNN_AUTO_TEST_CASE(MultiChannelTransposeConvolution2dUint8Nhwc,
MultiChannelTransposeConvolution2dTest<DataType::QuantisedAsymm8, DataType::Signed32>,
DataLayout::NHWC)
+#if defined(ARMCOMPUTEREF_ENABLED)
+
+// The ARMNN_COMPARE_REF_AUTO_TEST_CASE and the ARMNN_COMPARE_REF_FIXTURE_TEST_CASE test units are not available
+// if the reference backend is not built
+
// ============================================================================
// COMPARE tests
+ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f)
+ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f)
+ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8, CompareSoftmaxUint8Test, 1.0f)
+
ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareConv2dWithReference, CompareConvolution2dTest)
ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceFloat32,
@@ -851,4 +855,6 @@ ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSqrtActivationWithReference, Positive
ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSquareActivationWithReference, ActivationFixture,
CompareActivationTest, ActivationFunction::Square, 5u)
+#endif
+
BOOST_AUTO_TEST_SUITE_END()