#
$(foreach mkPath,$(ARMNN_BACKEND_COMMON_MAKEFILE_DIRS),\
$(eval include $(LOCAL_PATH)/$(mkPath)/common.mk)\
- $(eval ARMNN_BACKEND_SOURCES := $(ARMNN_BACKEND_SOURCES) $(patsubst %,$(mkPath)/%,$(COMMON_SOURCES))))
+ $(eval ARMNN_BACKEND_SOURCES := $(ARMNN_BACKEND_SOURCES)\
+ $(patsubst %,$(mkPath)/%,$(COMMON_SOURCES))))
$(foreach mkPath,$(ARMNN_BACKEND_MAKEFILE_DIRS),\
$(eval include $(LOCAL_PATH)/$(mkPath)/backend.mk)\
- $(eval ARMNN_BACKEND_SOURCES := $(ARMNN_BACKEND_SOURCES) $(patsubst %,$(mkPath)/%,$(BACKEND_SOURCES))))
+ $(eval ARMNN_BACKEND_SOURCES := $(ARMNN_BACKEND_SOURCES)\
+ $(patsubst %,$(mkPath)/%,$(BACKEND_SOURCES))))
# Mark source files as dependent on Android.mk and backend makefiles
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk \
LOCAL_SRC_FILES := \
$(ARMNN_BACKEND_SOURCES) \
+ src/armnn/BackendHelper.cpp \
+ src/armnn/Descriptors.cpp \
+ src/armnn/Exceptions.cpp \
+ src/armnn/Graph.cpp \
+ src/armnn/InternalTypes.cpp \
+ src/armnn/JsonPrinter.cpp \
+ src/armnn/Layer.cpp \
+ src/armnn/LayerSupport.cpp \
+ src/armnn/LoadedNetwork.cpp \
+ src/armnn/Network.cpp \
+ src/armnn/NetworkUtils.cpp \
+ src/armnn/Observable.cpp \
+ src/armnn/Optimizer.cpp \
+ src/armnn/ProfilingEvent.cpp \
+ src/armnn/Profiling.cpp \
+ src/armnn/Runtime.cpp \
+ src/armnn/SerializeLayerParameters.cpp \
+ src/armnn/SubgraphView.cpp \
+ src/armnn/SubgraphViewSelector.cpp \
+ src/armnn/Tensor.cpp \
+ src/armnn/TypesUtils.cpp \
+ src/armnn/Utils.cpp \
+ src/armnn/WallClockTimer.cpp \
src/armnnUtils/CsvReader.cpp \
src/armnnUtils/DataLayoutIndexed.cpp \
src/armnnUtils/DotSerializer.cpp \
src/armnn/layers/StridedSliceLayer.cpp \
src/armnn/layers/SubtractionLayer.cpp \
src/armnn/layers/SwitchLayer.cpp \
- src/armnn/layers/TransposeConvolution2dLayer.cpp \
- src/armnn/BackendHelper.cpp \
- src/armnn/Descriptors.cpp \
- src/armnn/Exceptions.cpp \
- src/armnn/Graph.cpp \
- src/armnn/Optimizer.cpp \
- src/armnn/Runtime.cpp \
- src/armnn/SerializeLayerParameters.cpp \
- src/armnn/SubgraphView.cpp \
- src/armnn/SubgraphViewSelector.cpp \
- src/armnn/InternalTypes.cpp \
- src/armnn/Layer.cpp \
- src/armnn/LoadedNetwork.cpp \
- src/armnn/Network.cpp \
- src/armnn/NetworkUtils.cpp \
- src/armnn/WallClockTimer.cpp \
- src/armnn/ProfilingEvent.cpp \
- src/armnn/Profiling.cpp \
- src/armnn/JsonPrinter.cpp \
- src/armnn/Tensor.cpp \
- src/armnn/TypesUtils.cpp \
- src/armnn/Utils.cpp \
- src/armnn/LayerSupport.cpp \
- src/armnn/Observable.cpp
+ src/armnn/layers/TransposeConvolution2dLayer.cpp
LOCAL_STATIC_LIBRARIES := \
armnn-arm_compute \
LOCAL_CFLAGS += \
-DARMCOMPUTENEON_ENABLED
endif # ARMNN_COMPUTE_NEON_ENABLED == 1
+# The variable to enable/disable the REFERENCE backend (ARMNN_COMPUTE_REF_ENABLED) is declared in android-nn-driver/Android.mk
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+LOCAL_CFLAGS += \
+ -DARMCOMPUTEREF_ENABLED
+endif # ARMNN_COMPUTE_REF_ENABLED == 1
ifeq ($(Q_OR_LATER),1)
LOCAL_CFLAGS += \
LOCAL_CFLAGS += \
-DARMCOMPUTENEON_ENABLED
endif # ARMNN_COMPUTE_NEON_ENABLED == 1
+# The variable to enable/disable the REFERENCE backend (ARMNN_COMPUTE_REF_ENABLED) is declared in android-nn-driver/Android.mk
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+LOCAL_CFLAGS += \
+ -DARMCOMPUTEREF_ENABLED
+endif # ARMNN_COMPUTE_REF_ENABLED == 1
ifeq ($(Q_OR_LATER),1)
LOCAL_CFLAGS += \
LOCAL_SRC_FILES := \
$(ARMNN_BACKEND_TEST_SOURCES) \
- src/armnn/test/UnitTests.cpp \
src/armnn/test/EndToEndTest.cpp \
- src/armnn/test/UtilsTests.cpp \
src/armnn/test/GraphTests.cpp \
src/armnn/test/GraphUtils.cpp \
src/armnn/test/InferOutputTests.cpp \
- src/armnn/test/RuntimeTests.cpp \
- src/armnn/test/SubgraphViewTests.cpp \
- src/armnn/test/TensorTest.cpp \
- src/armnn/test/NetworkTests.cpp \
src/armnn/test/InstrumentTests.cpp \
- src/armnn/test/ProfilingEventTest.cpp \
+ src/armnn/test/NetworkTests.cpp \
src/armnn/test/ObservableTest.cpp \
src/armnn/test/OptionalTest.cpp \
+ src/armnn/test/ProfilingEventTest.cpp \
+ src/armnn/test/SubgraphViewTests.cpp \
+ src/armnn/test/TensorHandleStrategyTest.cpp \
+ src/armnn/test/TensorTest.cpp \
src/armnn/test/TestUtils.cpp \
- src/armnn/test/TensorHandleStrategyTest.cpp
+ src/armnn/test/UnitTests.cpp \
+ src/armnn/test/UtilsTests.cpp
+
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+LOCAL_SRC_FILES += \
+ src/armnn/test/DebugCallbackTest.cpp \
+ src/armnn/test/RuntimeTests.cpp
+endif
LOCAL_STATIC_LIBRARIES := \
libneuralnetworks_common \
target_link_libraries(armnnTfParser ${PROTOBUF_LIBRARIES})
endif()
-if(BUILD_ARMNN_QUANTIZER)
+if(BUILD_ARMNN_QUANTIZER AND ARMCOMPUTEREF)
if(NOT BUILD_ARMNN_SERIALIZER)
message(ERROR, "In order to build the ArmNN Quantization Tool you must set BUILD_ARMNN_SERIALIZER = YES")
endif()
src/armnn/test/ConstTensorLayerVisitor.cpp
src/armnn/test/CreateWorkload.hpp
src/armnn/test/CsvReaderTest.cpp
- src/armnn/test/DebugCallbackTest.cpp
src/armnn/test/EndToEndTest.cpp
src/armnn/test/ExecutionFrameTest.cpp
src/armnn/test/FloatingPointConverterTest.cpp
src/armnn/test/OptionalTest.cpp
src/armnn/test/ProfilerTests.cpp
src/armnn/test/ProfilingEventTest.cpp
- src/armnn/test/QuantizerTest.cpp
- src/armnn/test/RuntimeTests.cpp
- src/armnn/test/RuntimeTests.hpp
src/armnn/test/SubgraphViewTests.cpp
src/armnn/test/TensorHandleStrategyTest.cpp
src/armnn/test/TensorHelpers.hpp
src/profiling/test/ProfilingTests.cpp
)
- if(BUILD_TF_PARSER)
+ if(ARMCOMPUTEREF)
+ list(APPEND unittest_sources
+ src/armnn/test/DebugCallbackTest.cpp
+ src/armnn/test/QuantizerTest.cpp
+ src/armnn/test/RuntimeTests.cpp
+ src/armnn/test/RuntimeTests.hpp
+ )
+ endif()
+
+ if(BUILD_TF_PARSER AND ARMCOMPUTEREF)
list(APPEND unittest_sources
src/armnnTfParser/test/Activations.cpp
src/armnnTfParser/test/Addition.cpp
src/armnnTfParser/test/Squeeze.cpp
src/armnnTfParser/test/Sub.cpp
)
+
endif()
- if(BUILD_TF_LITE_PARSER)
+ if(BUILD_TF_LITE_PARSER AND ARMCOMPUTEREF)
enable_language(ASM)
list(APPEND unittest_sources
- src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp
src/armnnTfLiteParser/test/Activations.cpp
src/armnnTfLiteParser/test/Addition.cpp
src/armnnTfLiteParser/test/AvgPool2D.cpp
src/armnnTfLiteParser/test/Schema.s
)
set_source_files_properties(src/armnnTfLiteParser/test/Schema.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
+
endif()
- if(BUILD_CAFFE_PARSER)
+ if(BUILD_CAFFE_PARSER AND ARMCOMPUTEREF)
list(APPEND unittest_sources
src/armnnCaffeParser/test/TestAdd.cpp
src/armnnCaffeParser/test/TestConcat.cpp
)
endif()
- if(BUILD_ARMNN_QUANTIZER)
+ if(BUILD_ONNX_PARSER AND ARMCOMPUTEREF)
+ list(APPEND unittest_sources
+ src/armnnOnnxParser/test/Constructor.cpp
+ src/armnnOnnxParser/test/CreateNetwork.cpp
+ src/armnnOnnxParser/test/ProtoxtFixture.cpp
+ src/armnnOnnxParser/test/Const.cpp
+ src/armnnOnnxParser/test/Pooling.cpp
+ src/armnnOnnxParser/test/Reshape.cpp
+ src/armnnOnnxParser/test/Relu.cpp
+ src/armnnOnnxParser/test/Conv2D.cpp
+ src/armnnOnnxParser/test/Addition.cpp
+ src/armnnOnnxParser/test/FullyConnected.cpp
+ src/armnnOnnxParser/test/GetInputsOutputs.cpp
+ src/armnnOnnxParser/test/BatchNorm.cpp
+ src/armnnOnnxParser/test/DepthConv.cpp
+ )
+ endif()
+
+ if(BUILD_ARMNN_QUANTIZER AND ARMCOMPUTEREF)
list(APPEND unittest_sources
src/armnnQuantizer/test/QuantizationDataSetTests.cpp
)
endif()
- if(BUILD_ARMNN_SERIALIZER)
+ if(BUILD_ARMNN_SERIALIZER AND ARMCOMPUTEREF)
enable_language(ASM)
list(APPEND unittest_sources
src/armnnSerializer/test/ActivationSerializationTests.cpp
set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
endif()
- if(BUILD_ONNX_PARSER)
- list(APPEND unittest_sources
- src/armnnOnnxParser/test/Constructor.cpp
- src/armnnOnnxParser/test/CreateNetwork.cpp
- src/armnnOnnxParser/test/ProtoxtFixture.cpp
- src/armnnOnnxParser/test/Const.cpp
- src/armnnOnnxParser/test/Pooling.cpp
- src/armnnOnnxParser/test/Reshape.cpp
- src/armnnOnnxParser/test/Relu.cpp
- src/armnnOnnxParser/test/Conv2D.cpp
- src/armnnOnnxParser/test/Addition.cpp
- src/armnnOnnxParser/test/FullyConnected.cpp
- src/armnnOnnxParser/test/GetInputsOutputs.cpp
- src/armnnOnnxParser/test/BatchNorm.cpp
- src/armnnOnnxParser/test/DepthConv.cpp
- )
- endif()
-
foreach(lib ${armnnUnitTestLibraries})
message("Adding object library dependency to UnitTests: ${lib}")
list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
target_link_libraries(UnitTests armnnCaffeParser)
endif()
- if(BUILD_ARMNN_SERIALIZER)
+ if(BUILD_ARMNN_SERIALIZER AND ARMCOMPUTEREF)
target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
target_link_libraries(UnitTests armnnSerializer)
endif()
- if(BUILD_ARMNN_QUANTIZER)
+ if(BUILD_ARMNN_QUANTIZER AND ARMCOMPUTEREF)
target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnQuantizer)
target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
target_link_libraries(UnitTests armnnQuantizer armnnSerializer)
addDllCopyCommands(UnitTests)
endif()
-if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER))
+if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER) AND ARMCOMPUTEREF)
set(ArmnnConverter_sources
src/armnnConverter/ArmnnConverter.cpp)
option(BUILD_FOR_COVERAGE "Use no optimization and output .gcno and .gcda files" OFF)
option(ARMCOMPUTENEON "Build with ARM Compute NEON support" OFF)
option(ARMCOMPUTECL "Build with ARM Compute OpenCL support" OFF)
+option(ARMCOMPUTEREF "Build with ARM Compute reference support" OFF)
option(PROFILING_BACKEND_STREAMLINE "Forward the armNN profiling events to DS-5/Streamline as annotations" OFF)
# options used for heap profiling and leak checking
option(HEAP_PROFILING "Build with heap profiling enabled" OFF)
include_directories(SYSTEM ${HALF_INCLUDE})
endif()
+# ARM Compute reference backend
+if(ARMCOMPUTEREF)
+ add_definitions(-DARMCOMPUTEREF_ENABLED)
+endif()
+
# Streamline annotate
if(PROFILING_BACKEND_STREAMLINE)
include_directories("${GATOR_ROOT}/annotate")
-if(BUILD_SAMPLE_APP)
+if(BUILD_SAMPLE_APP AND ARMCOMPUTEREF)
add_executable(SimpleSample SimpleSample.cpp)
target_link_libraries(SimpleSample armnn ${CMAKE_THREAD_LIBS_INIT})
endif()
profiler->EnableProfiling(false);
}
+#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(RuntimeLoadNetwork)
{
// Get a reference to the profiler manager.
BOOST_TEST(!profilerManager.GetProfiler());
}
+#endif
+
BOOST_AUTO_TEST_CASE(WriteEventResults)
{
// Get a reference to the profiler manager.
test/CommonTestUtils.cpp \
test/JsonPrinterTestImpl.cpp \
test/LayerTests.cpp \
- test/TensorCopyUtils.cpp \
+ test/TensorCopyUtils.cpp
+
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+COMMON_TEST_SOURCES += \
test/WorkloadDataValidation.cpp
+endif # ARMNN_COMPUTE_REF_ENABLED == 1
MockBackend.cpp
MockBackend.hpp
MockBackendId.hpp
- OptimizedNetworkTests.cpp
OptimizeSubgraphViewTests.cpp
OptimizationViewsTests.cpp
PermuteTestImpl.hpp
StridedSliceTestImpl.hpp
TensorCopyUtils.cpp
TensorCopyUtils.hpp
- WorkloadDataValidation.cpp
WorkloadFactoryHelper.hpp
WorkloadTestUtils.hpp
)
+if (ARMCOMPUTEREF)
+ list(APPEND armnnBackendsCommonUnitTests_sources
+ OptimizedNetworkTests.cpp
+ WorkloadDataValidation.cpp
+ )
+endif()
+
add_library(armnnBackendsCommonUnitTests OBJECT ${armnnBackendsCommonUnitTests_sources})
target_include_directories(armnnBackendsCommonUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
target_include_directories(armnnBackendsCommonUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
ARMNN_SIMPLE_TEST_CASE(RuntimeInvalidDynamicBackends, RuntimeInvalidDynamicBackendsTestImpl);
ARMNN_SIMPLE_TEST_CASE(RuntimeInvalidOverridePath, RuntimeInvalidOverridePathTestImpl);
+#if defined(ARMCOMPUTEREF_ENABLED)
+
+// This test unit needs the reference backend, it's not available if the reference backend is not built
+
ARMNN_SIMPLE_TEST_CASE(CreateReferenceDynamicBackend, CreateReferenceDynamicBackendTestImpl);
+#endif
+
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(supportedBackendIds.empty());
}
+#if defined(ARMCOMPUTEREF_ENABLED)
+
+// This test unit needs the reference backend, it's not available if the reference backend is not built
+
void CreateReferenceDynamicBackendTestImpl()
{
using namespace armnn;
BOOST_TEST((workload != nullptr));
BOOST_TEST(workload.get() == boost::polymorphic_downcast<RefConvolution2dWorkload*>(workload.get()));
}
+
+#endif
#include <backendsCommon/IBackendInternal.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
-#include <reference/workloads/RefWorkloads.hpp>
-
#include <algorithm>
#include <boost/cast.hpp>
return CopyViaSplitterTestImpl<armnn::DataType::QuantisedSymm16>(workloadFactory, memoryManager, 1.0f, 0);
}
+#if defined(ARMCOMPUTEREF_ENABLED)
+
+// The LSTM test units are run only for the reference backend at the moment
+
void LstmUtilsZeroVectorTest()
{
armnn::TensorInfo inputDesc({4}, armnn::DataType::Float32);
vecSize, batchSize, expectedOutput);
}
+#endif
LayerTestResult<float, 2> LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest(
armnn::IWorkloadFactory& workloadFactory,
ClContextControl.hpp
ClLayerSupport.cpp
ClLayerSupport.hpp
+ ClRegistryInitializer.cpp
ClTensorHandle.hpp
ClTensorHandleFactory.cpp
ClTensorHandleFactory.hpp
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()};
--- /dev/null
+//
+// 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
# 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
ClBackendContext.cpp \
ClContextControl.cpp \
ClLayerSupport.cpp \
+ ClRegistryInitializer.cpp \
ClTensorHandleFactory.cpp \
ClWorkloadFactory.cpp \
OpenClTimer.cpp \
# 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
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
ClJsonPrinterTests.cpp
ClLayerSupportTests.cpp
ClLayerTests.cpp
- ClMemCopyTests.cpp
ClOptimizedNetworkTests.cpp
ClRuntimeTests.cpp
ClWorkloadFactoryHelper.hpp
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)
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 =
CreateMemCopyWorkloads<IClTensorHandle>(factory);
}
+#endif
+
template <typename L2NormalizationWorkloadType, typename armnn::DataType DataType>
static void ClL2NormalizationWorkloadTest(DataLayout dataLayout)
{
#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>
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)
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,
ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSquareActivationWithReference, ActivationFixture,
CompareActivationTest, ActivationFunction::Square, 5u)
+#endif
+
BOOST_AUTO_TEST_SUITE_END()
# Source files of the backend, taken directly from the source tree
file(GLOB RefBackendBaseFiles ${RefBackendPath}/*.cpp)
-set(RefBackendFiles ${RefBackendBaseFiles})
+file(GLOB RefBackendWorloadFiles ${RefBackendPath}/workloads/*.cpp)
+set(RefBackendFiles ${RefBackendBaseFiles} ${RefBackendWorloadFiles})
# Remove the file that contains the static backend registration
list(REMOVE_ITEM RefBackendFiles ${RefBackendPath}/RefRegistryInitializer.cpp)
NeonInterceptorScheduler.cpp
NeonLayerSupport.cpp
NeonLayerSupport.hpp
- NeonWorkloadFactory.cpp
- NeonWorkloadFactory.hpp
+ NeonRegistryInitializer.cpp
NeonTensorHandle.hpp
NeonTensorHandleFactory.cpp
NeonTensorHandleFactory.hpp
NeonTimer.hpp
NeonTimer.cpp
+ NeonWorkloadFactory.cpp
+ NeonWorkloadFactory.hpp
)
add_subdirectory(workloads)
namespace armnn
{
-namespace
-{
-
-static BackendRegistry::StaticRegistryInitializer g_RegisterHelper
-{
- BackendRegistryInstance(),
- NeonBackend::GetIdStatic(),
- []()
- {
- return IBackendInternalUniquePtr(new NeonBackend);
- }
-};
-
-}
-
const BackendId& NeonBackend::GetIdStatic()
{
static const BackendId s_Id{NeonBackendId()};
--- /dev/null
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "NeonBackend.hpp"
+
+#include <backendsCommon/BackendRegistry.hpp>
+
+namespace
+{
+
+using namespace armnn;
+
+static BackendRegistry::StaticRegistryInitializer g_RegisterHelper
+{
+ BackendRegistryInstance(),
+ NeonBackend::GetIdStatic(),
+ []()
+ {
+ return IBackendInternalUniquePtr(new NeonBackend);
+ }
+};
+
+} // Anonymous namespace
# 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 NEON backend (ARMNN_COMPUTE_NEON_ENABLED) is declared in android-nn-driver/Android.mk
+# The variable to enable/disable the NEON backend (ARMNN_COMPUTE_NEON_ENABLED is declared in android-nn-driver/Android.mk)
ifeq ($(ARMNN_COMPUTE_NEON_ENABLED),1)
# ARMNN_COMPUTE_NEON_ENABLED == 1
NeonBackend.cpp \
NeonInterceptorScheduler.cpp \
NeonLayerSupport.cpp \
+ NeonRegistryInitializer.cpp \
NeonTensorHandleFactory.cpp \
NeonTimer.cpp \
NeonWorkloadFactory.cpp \
# 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 NEON backend (ARMNN_COMPUTE_NEON_ENABLED) is declared in android-nn-driver/Android.mk
+# The variable to enable/disable the NEON backend (ARMNN_COMPUTE_NEON_ENABLED is declared in android-nn-driver/Android.mk)
ifeq ($(ARMNN_COMPUTE_NEON_ENABLED),1)
# ARMNN_COMPUTE_NEON_ENABLED == 1
test/NeonJsonPrinterTests.cpp \
test/NeonLayerSupportTests.cpp \
test/NeonLayerTests.cpp \
- test/NeonMemCopyTests.cpp \
test/NeonOptimizedNetworkTests.cpp \
test/NeonRuntimeTests.cpp \
test/NeonTimerTest.cpp
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+BACKEND_TEST_SOURCES += \
+ test/NeonMemCopyTests.cpp
+endif # ARMNN_COMPUTE_REF_ENABLED == 1
+
else
# ARMNN_COMPUTE_NEON_ENABLED == 0
NeonJsonPrinterTests.cpp
NeonLayerSupportTests.cpp
NeonLayerTests.cpp
- NeonMemCopyTests.cpp
NeonOptimizedNetworkTests.cpp
NeonRuntimeTests.cpp
NeonTimerTest.cpp
NeonWorkloadFactoryHelper.hpp
)
+if (ARMCOMPUTEREF)
+ list(APPEND armnnNeonBackendUnitTests_sources
+ NeonMemCopyTests.cpp
+ )
+endif()
+
add_library(armnnNeonBackendUnitTests OBJECT ${armnnNeonBackendUnitTests_sources})
target_include_directories(armnnNeonBackendUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
target_include_directories(armnnNeonBackendUnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
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(CreateMemCopyWorkloadsNeon)
{
NeonWorkloadFactory factory =
CreateMemCopyWorkloads<IAclTensorHandle>(factory);
}
+#endif
+
template <typename L2NormalizationWorkloadType, typename armnn::DataType DataType>
static void NeonCreateL2NormalizationWorkloadTest(DataLayout dataLayout)
{
BOOST_TEST(ConstantUsageFloat32Test(defaultBackends));
}
+#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(FallbackToCpuRef)
{
using namespace armnn;
BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
}
+#endif
+
BOOST_AUTO_TEST_CASE(NeonGreaterSimpleEndToEndTest)
{
const std::vector<uint8_t> expectedOutput({ 0, 0, 0, 0, 1, 1, 1, 1,
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_FIXTURE_TEST_CASE(CompareSquareActivationWithReference, ActivationFixture,
CompareActivationTest, ActivationFunction::Square, 5u)
+
+#endif
+
BOOST_AUTO_TEST_SUITE_END()
# SPDX-License-Identifier: MIT
#
-list(APPEND armnnRefBackend_sources
- RefBackend.cpp
- RefBackend.hpp
- RefBackendId.hpp
- RefTensorHandle.hpp
- RefTensorHandle.cpp
- RefLayerSupport.cpp
- RefLayerSupport.hpp
- RefMemoryManager.hpp
- RefMemoryManager.cpp
- RefRegistryInitializer.cpp
- RefWorkloadFactory.cpp
- RefWorkloadFactory.hpp
- RefTensorHandleFactory.hpp
- RefTensorHandleFactory.cpp
-)
+if(ARMCOMPUTEREF)
+ list(APPEND armnnRefBackend_sources
+ RefBackend.cpp
+ RefBackend.hpp
+ RefBackendId.hpp
+ RefTensorHandle.hpp
+ RefTensorHandle.cpp
+ RefLayerSupport.cpp
+ RefLayerSupport.hpp
+ RefMemoryManager.hpp
+ RefMemoryManager.cpp
+ RefRegistryInitializer.cpp
+ RefWorkloadFactory.cpp
+ RefWorkloadFactory.hpp
+ RefTensorHandleFactory.cpp
+ RefTensorHandleFactory.hpp
+ )
+
+ add_subdirectory(workloads)
+
+ if(BUILD_UNIT_TESTS)
+ add_subdirectory(test)
+ endif()
+
+else()
+ list(APPEND armnnRefBackend_sources
+ RefBackendId.hpp
+ RefLayerSupport.cpp
+ RefLayerSupport.hpp
+ )
+endif()
add_library(armnnRefBackend OBJECT ${armnnRefBackend_sources})
target_include_directories(armnnRefBackend PRIVATE ${PROJECT_SOURCE_DIR}/src/armnn)
target_include_directories(armnnRefBackend PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
target_include_directories(armnnRefBackend PRIVATE ${PROJECT_SOURCE_DIR}/src/backends)
-
-add_subdirectory(workloads)
-
-if(BUILD_UNIT_TESTS)
- add_subdirectory(test)
-endif()
#
add_subdirectory(${PROJECT_SOURCE_DIR}/src/backends/reference)
-list(APPEND armnnLibraries armnnRefBackend armnnRefBackendWorkloads)
-list(APPEND armnnUnitTestLibraries armnnRefBackendUnitTests)
+list(APPEND armnnLibraries armnnRefBackend)
+
+if(ARMCOMPUTEREF)
+ list(APPEND armnnLibraries armnnRefBackendWorkloads)
+ list(APPEND armnnUnitTestLibraries armnnRefBackendUnitTests)
+else()
+ message("Reference backend is disabled")
+endif()
# 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 reference backend (ARMNN_COMPUTE_REF_ENABLED is declared in android-nn-driver/Android.mk)
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+
+# ARMNN_COMPUTE_REF_ENABLED == 1
+# Include the source files for the reference backend
+
BACKEND_SOURCES := \
RefBackend.cpp \
RefLayerSupport.cpp \
workloads/Softmax.cpp \
workloads/Splitter.cpp \
workloads/TransposeConvolution2d.cpp
+else
+
+# ARMNN_COMPUTE_REF_ENABLED == 0
+# No source file will be compiled for the reference backend
+
+BACKEND_SOURCES :=
+
+endif
# BACKEND_TEST_SOURCES contains the list of files to be included
# 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_REF_ENABLED is declared in android-nn-driver/Android.mk)
+ifeq ($(ARMNN_COMPUTE_REF_ENABLED),1)
+
+# ARMNN_COMPUTE_REF_ENABLED == 1
+# Include the source files for the CL backend tests
+
BACKEND_TEST_SOURCES := \
test/RefCreateWorkloadTests.cpp \
test/RefDetectionPostProcessTests.cpp \
test/RefMemoryManagerTests.cpp \
test/RefOptimizedNetworkTests.cpp \
test/RefRuntimeTests.cpp
+else
+
+# ARMNN_COMPUTE_REF_ENABLED == 0
+# No source file will be compiled for the reference backend tests
+
+BACKEND_TEST_SOURCES :=
+
+endif