2 # Copyright © 2017 Arm Ltd. All rights reserved.
3 # SPDX-License-Identifier: MIT
5 cmake_minimum_required (VERSION 3.0.2) # 3.0.2 required for return() statement used in AddDllCopyCommands.cmake
8 set(additional_cmake_files)
9 list(APPEND additional_cmake_files
10 cmake/ArmnnVersion.cmake
12 cmake/GlobalConfig.cmake
13 cmake/AddDllCopyCommands.cmake)
15 foreach(cmake_file ${additional_cmake_files})
16 include(${cmake_file})
19 if (DYNAMIC_BACKEND_PATHS)
20 # It's expected to have the format: DYNAMIC_BACKEND_PATHS="PATH_1:PATH_2...:PATH_N"
21 add_definitions('-DDYNAMIC_BACKEND_PATHS="${DYNAMIC_BACKEND_PATHS}"')
24 include(GNUInstallDirs)
26 add_subdirectory(samples)
27 add_subdirectory(src/armnnTfLiteParser)
28 add_subdirectory(src/armnnSerializer)
31 add_subdirectory(tests)
34 # Include the additional cmake files in their own target so that they will appear nicely in IDEs
35 add_custom_target(AdditionalCMakeFiles SOURCES ${additional_cmake_files})
37 set(armnnUtils_sources)
38 list(APPEND armnnUtils_sources
39 src/armnnUtils/GraphTopologicalSort.hpp
40 src/armnnUtils/Half.hpp
41 src/armnnUtils/Logging.hpp
42 src/armnnUtils/Logging.cpp
43 src/armnnUtils/Permute.hpp
44 src/armnnUtils/Permute.cpp
45 src/armnnUtils/DataLayoutIndexed.cpp
46 src/armnnUtils/DataLayoutIndexed.hpp
47 src/armnnUtils/DotSerializer.cpp
48 src/armnnUtils/DotSerializer.hpp
49 src/armnnUtils/HeapProfiling.cpp
50 src/armnnUtils/HeapProfiling.hpp
51 src/armnnUtils/LeakChecking.cpp
52 src/armnnUtils/LeakChecking.hpp
53 src/armnnUtils/ModelAccuracyChecker.cpp
54 src/armnnUtils/ModelAccuracyChecker.hpp
55 src/armnnUtils/CsvReader.cpp
56 src/armnnUtils/CsvReader.hpp
57 src/armnnUtils/FloatingPointConverter.cpp
58 src/armnnUtils/FloatingPointConverter.hpp
59 src/armnnUtils/VerificationHelpers.hpp
60 src/armnnUtils/VerificationHelpers.cpp
61 src/armnnUtils/ParserHelper.hpp
62 src/armnnUtils/ParserHelper.cpp
63 src/armnnUtils/ParserPrototxtFixture.hpp
64 src/armnnUtils/PrototxtConversions.hpp
65 src/armnnUtils/PrototxtConversions.cpp
66 src/armnnUtils/TensorIOUtils.hpp
67 src/armnnUtils/TensorUtils.hpp
68 src/armnnUtils/TensorUtils.cpp
71 add_library_ex(armnnUtils STATIC ${armnnUtils_sources})
72 target_include_directories(armnnUtils PRIVATE src/backends)
74 if(BUILD_CAFFE_PARSER)
75 # ArmNN Parser source files required for all build options
76 set(armnn_caffe_parser_sources)
77 list(APPEND armnn_caffe_parser_sources
78 include/armnnCaffeParser/ICaffeParser.hpp
79 src/armnnCaffeParser/RecordByRecordCaffeParser.hpp
80 src/armnnCaffeParser/RecordByRecordCaffeParser.cpp
81 src/armnnCaffeParser/CaffeParser.hpp
82 src/armnnCaffeParser/CaffeParser.cpp
83 ${CAFFE_GENERATED_SOURCES}/caffe/proto/caffe.pb.cc
85 # The generated Caffe protobuf .cc file is not warning clean and we can't fix them.
86 if(COMPILER_IS_GNU_LIKE)
87 set_source_files_properties(${CAFFE_GENERATED_SOURCES}/caffe/proto/caffe.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
90 add_library_ex(armnnCaffeParser SHARED ${armnn_caffe_parser_sources})
91 set_target_properties(armnnCaffeParser PROPERTIES COMPILE_FLAGS "${CAFFE_PARSER_ADDITIONAL_COMPILE_FLAGS}")
93 target_include_directories(armnnCaffeParser PRIVATE src/armnnUtils)
95 target_link_libraries(armnnCaffeParser ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY})
97 target_link_libraries(armnnCaffeParser armnn)
98 target_link_libraries(armnnCaffeParser ${PROTOBUF_LIBRARIES})
99 set_target_properties(armnnCaffeParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
103 if(BUILD_ONNX_PARSER)
104 set(armnn_onnx_parser_sources)
105 list(APPEND armnn_onnx_parser_sources
106 include/armnnOnnxParser/IOnnxParser.hpp
107 src/armnnOnnxParser/OnnxParser.hpp
108 src/armnnOnnxParser/OnnxParser.cpp
109 ${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc
111 # The generated onnx protobuf .cc files are not warning clean and we can't fix them.
112 if(COMPILER_IS_GNU_LIKE)
113 set_source_files_properties(${ONNX_GENERATED_SOURCES}/onnx/onnx.pb.cc PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
116 add_library_ex(armnnOnnxParser SHARED ${armnn_onnx_parser_sources})
118 target_include_directories(armnnOnnxParser PRIVATE src/armnnUtils)
120 target_link_libraries(armnnOnnxParser armnn)
123 target_link_libraries(armnnOnnxParser ${PROTOBUF_LIBRARIES})
124 set_target_properties(armnnOnnxParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
128 set(armnn_tf_parser_sources)
129 list(APPEND armnn_tf_parser_sources
130 include/armnnTfParser/ITfParser.hpp
131 src/armnnTfParser/TfParser.hpp
132 src/armnnTfParser/TfParser.cpp
135 # The generated tensorflow protobuf .cc files are not warning clean and we can't fix them.
136 if(COMPILER_IS_GNU_LIKE)
137 set_source_files_properties(${TF_PROTOBUFS} PROPERTIES COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")
140 add_library_ex(armnnTfParser SHARED ${armnn_tf_parser_sources})
142 target_include_directories(armnnTfParser PRIVATE src/armnnUtils)
144 target_link_libraries(armnnTfParser armnn)
146 # Protobuf (use the specific version tensorflow wants)
147 target_link_libraries(armnnTfParser ${PROTOBUF_LIBRARIES})
148 set_target_properties(armnnTfParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
151 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
152 if(NOT BUILD_ARMNN_SERIALIZER)
153 message(ERROR, "In order to build the ArmNN Quantization Tool you must set BUILD_ARMNN_SERIALIZER = YES")
156 set(armnn_quantizer_sources)
157 list(APPEND armnn_quantizer_sources
158 src/armnnQuantizer/QuantizationDataSet.hpp
159 src/armnnQuantizer/QuantizationDataSet.cpp
160 src/armnnQuantizer/QuantizationInput.hpp
161 src/armnnQuantizer/QuantizationInput.cpp
162 src/armnnQuantizer/CommandLineProcessor.hpp
163 src/armnnQuantizer/CommandLineProcessor.cpp
166 add_library_ex(armnnQuantizer SHARED ${armnn_quantizer_sources})
168 target_include_directories(armnnQuantizer PRIVATE include/armnnDeserializer)
169 target_include_directories(armnnQuantizer PRIVATE src/armnnUtils)
170 target_include_directories(armnnQuantizer PRIVATE src/armnn)
172 include_directories(SYSTEM "${FLATBUFFERS_INCLUDE_PATH}")
173 set_target_properties(armnnQuantizer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
175 target_link_libraries(armnnQuantizer
177 ${Boost_SYSTEM_LIBRARY}
178 ${Boost_PROGRAM_OPTIONS_LIBRARY}
179 ${Boost_FILESYSTEM_LIBRARY}
181 ${Boost_THREAD_LIBRARY} )
183 add_executable_ex(ArmnnQuantizer
184 src/armnnQuantizer/ArmNNQuantizerMain.cpp)
186 target_include_directories(ArmnnQuantizer PRIVATE include/armnnDeserializer)
187 target_include_directories(ArmnnQuantizer PRIVATE src/armnn)
189 target_link_libraries(ArmnnQuantizer
190 ${Boost_SYSTEM_LIBRARY}
191 ${Boost_PROGRAM_OPTIONS_LIBRARY}
192 ${Boost_FILESYSTEM_LIBRARY}
194 ${Boost_THREAD_LIBRARY} )
196 target_link_libraries(ArmnnQuantizer
201 ${FLATBUFFERS_LIBRARY})
203 if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
204 target_link_libraries(ArmnnQuantizer pthread)
207 set_target_properties(armnnQuantizer PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
212 list(APPEND armnn_sources
213 include/armnn/ArmNN.hpp
214 include/armnn/BackendHelper.hpp
215 include/armnn/BackendId.hpp
216 include/armnn/Conversion.hpp
217 include/armnn/Deprecated.hpp
218 include/armnn/Descriptors.hpp
219 include/armnn/DescriptorsFwd.hpp
220 include/armnn/Exceptions.hpp
221 include/armnn/ILayerSupport.hpp
222 include/armnn/ILayerVisitor.hpp
223 include/armnn/INetwork.hpp
224 include/armnn/IProfiler.hpp
225 include/armnn/IRuntime.hpp
226 include/armnn/LayerSupport.hpp
227 include/armnn/LayerVisitorBase.hpp
228 include/armnn/LstmParams.hpp
229 include/armnn/MemorySources.hpp
230 include/armnn/NetworkFwd.hpp
231 include/armnn/Optional.hpp
232 include/armnn/QuantizedLstmParams.hpp
233 include/armnn/Tensor.hpp
234 include/armnn/TensorFwd.hpp
235 include/armnn/Types.hpp
236 include/armnn/TypesUtils.hpp
237 include/armnn/Utils.hpp
238 include/armnn/Version.hpp
239 src/armnn/layers/LayerCloneBase.hpp
240 src/armnn/layers/LayerWithParameters.hpp
241 src/armnn/layers/AbsLayer.hpp
242 src/armnn/layers/AbsLayer.cpp
243 src/armnn/layers/ActivationLayer.hpp
244 src/armnn/layers/ActivationLayer.cpp
245 src/armnn/layers/AdditionLayer.hpp
246 src/armnn/layers/AdditionLayer.cpp
247 src/armnn/layers/ArgMinMaxLayer.hpp
248 src/armnn/layers/ArgMinMaxLayer.cpp
249 src/armnn/layers/BatchNormalizationLayer.hpp
250 src/armnn/layers/BatchNormalizationLayer.cpp
251 src/armnn/layers/BatchToSpaceNdLayer.hpp
252 src/armnn/layers/BatchToSpaceNdLayer.cpp
253 src/armnn/layers/ComparisonLayer.hpp
254 src/armnn/layers/ComparisonLayer.cpp
255 src/armnn/layers/ConcatLayer.hpp
256 src/armnn/layers/ConcatLayer.cpp
257 src/armnn/layers/ConstantLayer.hpp
258 src/armnn/layers/ConstantLayer.cpp
259 src/armnn/layers/Convolution2dLayer.hpp
260 src/armnn/layers/Convolution2dLayer.cpp
261 src/armnn/layers/ConvertFp16ToFp32Layer.hpp
262 src/armnn/layers/ConvertFp16ToFp32Layer.cpp
263 src/armnn/layers/ConvertFp32ToFp16Layer.hpp
264 src/armnn/layers/ConvertFp32ToFp16Layer.cpp
265 src/armnn/layers/DebugLayer.hpp
266 src/armnn/layers/DebugLayer.cpp
267 src/armnn/layers/DepthToSpaceLayer.hpp
268 src/armnn/layers/DepthToSpaceLayer.cpp
269 src/armnn/layers/DepthwiseConvolution2dLayer.hpp
270 src/armnn/layers/DepthwiseConvolution2dLayer.cpp
271 src/armnn/layers/DequantizeLayer.hpp
272 src/armnn/layers/DequantizeLayer.cpp
273 src/armnn/layers/DetectionPostProcessLayer.hpp
274 src/armnn/layers/DetectionPostProcessLayer.cpp
275 src/armnn/layers/ElementwiseBaseLayer.hpp
276 src/armnn/layers/ElementwiseBaseLayer.cpp
277 src/armnn/layers/FakeQuantizationLayer.hpp
278 src/armnn/layers/FakeQuantizationLayer.cpp
279 src/armnn/layers/FloorLayer.hpp
280 src/armnn/layers/FloorLayer.cpp
281 src/armnn/layers/FullyConnectedLayer.hpp
282 src/armnn/layers/FullyConnectedLayer.cpp
283 src/armnn/layers/GatherLayer.cpp
284 src/armnn/layers/GatherLayer.hpp
285 src/armnn/layers/InputLayer.hpp
286 src/armnn/layers/InputLayer.cpp
287 src/armnn/layers/InstanceNormalizationLayer.hpp
288 src/armnn/layers/InstanceNormalizationLayer.cpp
289 src/armnn/layers/L2NormalizationLayer.hpp
290 src/armnn/layers/L2NormalizationLayer.cpp
291 src/armnn/layers/LogSoftmaxLayer.hpp
292 src/armnn/layers/LogSoftmaxLayer.cpp
293 src/armnn/layers/LstmLayer.cpp
294 src/armnn/layers/LstmLayer.hpp
295 src/armnn/layers/MaximumLayer.cpp
296 src/armnn/layers/MaximumLayer.hpp
297 src/armnn/layers/MeanLayer.hpp
298 src/armnn/layers/MeanLayer.cpp
299 src/armnn/layers/MemCopyLayer.hpp
300 src/armnn/layers/MemCopyLayer.cpp
301 src/armnn/layers/MemImportLayer.hpp
302 src/armnn/layers/MemImportLayer.cpp
303 src/armnn/layers/MergeLayer.hpp
304 src/armnn/layers/MergeLayer.cpp
305 src/armnn/layers/MinimumLayer.cpp
306 src/armnn/layers/MinimumLayer.hpp
307 src/armnn/layers/MultiplicationLayer.hpp
308 src/armnn/layers/MultiplicationLayer.cpp
309 src/armnn/layers/NormalizationLayer.hpp
310 src/armnn/layers/NormalizationLayer.cpp
311 src/armnn/layers/OutputLayer.hpp
312 src/armnn/layers/OutputLayer.cpp
313 src/armnn/layers/PadLayer.hpp
314 src/armnn/layers/PadLayer.cpp
315 src/armnn/layers/PermuteLayer.hpp
316 src/armnn/layers/PermuteLayer.cpp
317 src/armnn/layers/Pooling2dLayer.hpp
318 src/armnn/layers/Pooling2dLayer.cpp
319 src/armnn/layers/QuantizeLayer.cpp
320 src/armnn/layers/QuantizeLayer.hpp
321 src/armnn/layers/QuantizedLstmLayer.hpp
322 src/armnn/layers/QuantizedLstmLayer.cpp
323 src/armnn/layers/DivisionLayer.cpp
324 src/armnn/layers/DivisionLayer.hpp
325 src/armnn/layers/PreCompiledLayer.hpp
326 src/armnn/layers/PreCompiledLayer.cpp
327 src/armnn/layers/PreluLayer.hpp
328 src/armnn/layers/PreluLayer.cpp
329 src/armnn/layers/ReshapeLayer.hpp
330 src/armnn/layers/ReshapeLayer.cpp
331 src/armnn/layers/ResizeLayer.hpp
332 src/armnn/layers/ResizeLayer.cpp
333 src/armnn/layers/RsqrtLayer.cpp
334 src/armnn/layers/RsqrtLayer.hpp
335 src/armnn/layers/SliceLayer.cpp
336 src/armnn/layers/SliceLayer.hpp
337 src/armnn/layers/SoftmaxLayer.hpp
338 src/armnn/layers/SoftmaxLayer.cpp
339 src/armnn/layers/SpaceToBatchNdLayer.hpp
340 src/armnn/layers/SpaceToBatchNdLayer.cpp
341 src/armnn/layers/SpaceToDepthLayer.hpp
342 src/armnn/layers/SpaceToDepthLayer.cpp
343 src/armnn/layers/SplitterLayer.hpp
344 src/armnn/layers/SplitterLayer.cpp
345 src/armnn/layers/StackLayer.hpp
346 src/armnn/layers/StackLayer.cpp
347 src/armnn/layers/StandInLayer.cpp
348 src/armnn/layers/StandInLayer.hpp
349 src/armnn/layers/StridedSliceLayer.cpp
350 src/armnn/layers/StridedSliceLayer.hpp
351 src/armnn/layers/SubtractionLayer.cpp
352 src/armnn/layers/SubtractionLayer.hpp
353 src/armnn/layers/SwitchLayer.cpp
354 src/armnn/layers/SwitchLayer.hpp
355 src/armnn/layers/TransposeConvolution2dLayer.cpp
356 src/armnn/layers/TransposeConvolution2dLayer.hpp
357 src/armnn/BackendSettings.hpp
358 src/armnn/BackendHelper.cpp
359 src/armnn/CompatibleTypes.hpp
360 src/armnn/Descriptors.cpp
361 src/armnn/DeviceSpec.hpp
362 src/armnn/DynamicQuantizationVisitor.cpp
363 src/armnn/DynamicQuantizationVisitor.hpp
364 src/armnn/Exceptions.cpp
365 src/armnn/ExecutionFrame.cpp
366 src/armnn/ExecutionFrame.hpp
369 src/armnn/IGraphObservable.hpp
370 src/armnn/Instrument.hpp
371 src/armnn/InternalTypes.cpp
372 src/armnn/InternalTypes.hpp
373 src/armnn/ISubgraphViewConverter.hpp
374 src/armnn/JsonPrinter.cpp
375 src/armnn/JsonPrinter.hpp
377 src/armnn/LayerFwd.hpp
379 src/armnn/LayersFwd.hpp
380 src/armnn/LayerSupportCommon.hpp
381 src/armnn/LayerSupport.cpp
382 src/armnn/LoadedNetwork.cpp
383 src/armnn/LoadedNetwork.hpp
384 src/armnn/Network.cpp
385 src/armnn/Network.hpp
386 src/armnn/NetworkQuantizationScheme.hpp
387 src/armnn/NetworkQuantizer.cpp
388 src/armnn/NetworkQuantizer.hpp
389 src/armnn/NetworkQuantizerUtils.cpp
390 src/armnn/NetworkQuantizerUtils.hpp
391 src/armnn/NetworkUtils.cpp
392 src/armnn/NetworkUtils.hpp
393 src/armnn/Observable.cpp
394 src/armnn/Observable.hpp
395 src/armnn/Optimizer.cpp
396 src/armnn/Optimizer.hpp
397 src/armnn/OverrideInputRangeVisitor.cpp
398 src/armnn/OverrideInputRangeVisitor.hpp
399 src/armnn/Profiling.cpp
400 src/armnn/ProfilingEvent.cpp
401 src/armnn/ProfilingEvent.hpp
402 src/armnn/Profiling.hpp
403 src/armnn/QuantizerVisitor.cpp
404 src/armnn/QuantizerVisitor.hpp
405 src/armnn/Runtime.cpp
406 src/armnn/Runtime.hpp
407 src/armnn/RangeTracker.cpp
408 src/armnn/RangeTracker.hpp
409 src/armnn/ResolveType.hpp
410 src/armnn/SerializeLayerParameters.cpp
411 src/armnn/SerializeLayerParameters.hpp
412 src/armnn/StaticRangeVisitor.cpp
413 src/armnn/StaticRangeVisitor.hpp
414 src/armnn/SubgraphView.cpp
415 src/armnn/SubgraphView.hpp
416 src/armnn/SubgraphViewSelector.cpp
417 src/armnn/SubgraphViewSelector.hpp
419 src/armnn/TypesUtils.cpp
421 src/armnn/WallClockTimer.cpp
422 src/armnn/WallClockTimer.hpp
423 src/armnn/optimizations/AddDebug.hpp
424 src/armnn/optimizations/All.hpp
425 src/armnn/optimizations/ConvertConstants.hpp
426 src/armnn/optimizations/ConvertFp32NetworkToFp16.hpp
427 src/armnn/optimizations/FoldPadIntoConvolution2d.hpp
428 src/armnn/optimizations/MovePermuteUp.hpp
429 src/armnn/optimizations/Optimization.hpp
430 src/armnn/optimizations/OptimizeConsecutiveReshapes.hpp
431 src/armnn/optimizations/OptimizeInverseConversions.hpp
432 src/armnn/optimizations/OptimizeInversePermutes.hpp
433 src/armnn/optimizations/PermuteAndBatchToSpaceAsDepthToSpace.hpp
434 src/armnn/optimizations/PermuteAndBatchToSpaceAsDepthToSpace.cpp
435 src/armnn/optimizations/PermuteAsReshape.hpp
436 src/armnn/optimizations/SquashEqualSiblings.hpp
437 src/profiling/BufferManager.cpp
438 src/profiling/BufferManager.hpp
439 src/profiling/CommandHandler.cpp
440 src/profiling/CommandHandler.hpp
441 src/profiling/CommandHandlerFunctor.cpp
442 src/profiling/CommandHandlerFunctor.hpp
443 src/profiling/CommandHandlerKey.cpp
444 src/profiling/CommandHandlerKey.hpp
445 src/profiling/CommandHandlerRegistry.cpp
446 src/profiling/CommandHandlerRegistry.hpp
447 src/profiling/ConnectionAcknowledgedCommandHandler.cpp
448 src/profiling/ConnectionAcknowledgedCommandHandler.hpp
449 src/profiling/CounterDirectory.cpp
450 src/profiling/CounterDirectory.hpp
451 src/profiling/EncodeVersion.hpp
452 src/profiling/Holder.cpp
453 src/profiling/Holder.hpp
454 src/profiling/IBufferManager.hpp
455 src/profiling/ICounterDirectory.hpp
456 src/profiling/ICounterValues.hpp
457 src/profiling/ISendCounterPacket.hpp
458 src/profiling/ISendTimelinePacket.hpp
459 src/profiling/IPacketBuffer.hpp
460 src/profiling/IPeriodicCounterCapture.hpp
461 src/profiling/IProfilingConnection.hpp
462 src/profiling/IProfilingConnectionFactory.hpp
463 src/profiling/IProfilingGuidGenerator.hpp
464 src/profiling/Packet.hpp
465 src/profiling/PacketBuffer.cpp
466 src/profiling/PacketBuffer.hpp
467 src/profiling/PacketVersionResolver.cpp
468 src/profiling/PacketVersionResolver.hpp
469 src/profiling/PeriodicCounterCapture.hpp
470 src/profiling/PeriodicCounterCapture.cpp
471 src/profiling/PeriodicCounterSelectionCommandHandler.cpp
472 src/profiling/PeriodicCounterSelectionCommandHandler.hpp
473 src/profiling/PerJobCounterSelectionCommandHandler.cpp
474 src/profiling/PerJobCounterSelectionCommandHandler.hpp
475 src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
476 src/profiling/ProfilingConnectionDumpToFileDecorator.hpp
477 src/profiling/ProfilingConnectionFactory.cpp
478 src/profiling/ProfilingConnectionFactory.hpp
479 src/profiling/ProfilingGuid.hpp
480 src/profiling/ProfilingGuidGenerator.hpp
481 src/profiling/ProfilingService.cpp
482 src/profiling/ProfilingService.hpp
483 src/profiling/ProfilingStateMachine.cpp
484 src/profiling/ProfilingStateMachine.hpp
485 src/profiling/ProfilingUtils.cpp
486 src/profiling/ProfilingUtils.hpp
487 src/profiling/RequestCounterDirectoryCommandHandler.cpp
488 src/profiling/RequestCounterDirectoryCommandHandler.hpp
489 src/profiling/SendCounterPacket.cpp
490 src/profiling/SendCounterPacket.hpp
491 src/profiling/SendTimelinePacket.cpp
492 src/profiling/SendTimelinePacket.hpp
493 src/profiling/SocketProfilingConnection.cpp
494 src/profiling/SocketProfilingConnection.hpp
495 src/profiling/TimelinePacketWriterFactory.cpp
496 src/profiling/TimelinePacketWriterFactory.hpp
497 third-party/half/half.hpp
500 # Files used for Streamline-based profiling backend
501 if(PROFILING_BACKEND_STREAMLINE)
502 list(APPEND armnn_sources
503 ${GATOR_ROOT}/annotate/streamline_annotate.h
504 ${GATOR_ROOT}/annotate/streamline_annotate.c)
507 # the backends under src/backends extend the list of
508 # object libs armnn to include in the build
509 include(src/backends/backends.cmake)
510 foreach(lib ${armnnLibraries})
511 message("Adding object library dependency to armnn: ${lib}")
512 list(APPEND armnn_sources $<TARGET_OBJECTS:${lib}>)
515 add_library_ex(armnn SHARED ${armnn_sources})
517 target_include_directories(armnn PRIVATE src/armnn)
518 target_include_directories(armnn PRIVATE src/armnnUtils)
519 target_include_directories(armnn PRIVATE src/backends)
520 target_include_directories(armnn PRIVATE src/profiling)
522 target_link_libraries(armnn armnnUtils)
524 target_link_libraries(armnn ${CMAKE_DL_LIBS})
526 install(TARGETS armnn
527 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
528 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
529 if(BUILD_CAFFE_PARSER)
530 install(TARGETS armnnCaffeParser
531 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
532 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
534 if(BUILD_ONNX_PARSER)
535 install(TARGETS armnnOnnxParser
536 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
537 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
540 install(TARGETS armnnTfParser
541 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
542 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
545 install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
547 target_link_libraries(armnn ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY}
548 ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
550 if(ARMCOMPUTENEON OR ARMCOMPUTECL)
551 target_link_libraries(armnn ${ARMCOMPUTE_LIBRARIES})
554 target_link_libraries(armnn ${OPENCL_LIBRARIES})
557 if(PROFILING_BACKEND_STREAMLINE)
558 target_link_libraries(armnn pthread)
561 set_target_properties(armnn PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
564 set(unittest_sources)
565 list(APPEND unittest_sources
566 src/armnn/test/ConstTensorLayerVisitor.hpp
567 src/armnn/test/ConstTensorLayerVisitor.cpp
568 src/armnn/test/CreateWorkload.hpp
569 src/armnn/test/CsvReaderTest.cpp
570 src/armnn/test/EndToEndTest.cpp
571 src/armnn/test/ExecutionFrameTest.cpp
572 src/armnn/test/FloatingPointConverterTest.cpp
573 src/armnn/test/FlowControl.cpp
574 src/armnn/test/GraphTests.cpp
575 src/armnn/test/GraphUtils.cpp
576 src/armnn/test/GraphUtils.hpp
577 src/armnn/test/InstrumentTests.cpp
578 src/armnn/test/InferOutputTests.cpp
579 src/armnn/test/InferOutputTests.hpp
580 src/armnn/test/ModelAccuracyCheckerTest.cpp
581 src/armnn/test/NetworkTests.cpp
582 src/armnn/test/ObservableTest.cpp
583 src/armnn/test/OptimizerTests.cpp
584 src/armnn/test/optimizations/ConvertConstantsFloatToHalfTests.cpp
585 src/armnn/test/optimizations/ConvertConstantsHalfToFloatTests.cpp
586 src/armnn/test/optimizations/Fp32NetworkToFp16ConverterTests.cpp
587 src/armnn/test/optimizations/InsertDebugLayerTests.cpp
588 src/armnn/test/optimizations/MovePermuteUpTests.cpp
589 src/armnn/test/optimizations/OptimizeConsecutiveReshapesTests.cpp
590 src/armnn/test/optimizations/OptimizeInverseConversionsTests.cpp
591 src/armnn/test/optimizations/OptimizeInversePermutesTests.cpp
592 src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
593 src/armnn/test/optimizations/PermuteAsReshapeTests.cpp
594 src/armnn/test/optimizations/SquashEqualSiblingsTests.cpp
595 src/armnn/test/OptionalTest.cpp
596 src/armnn/test/ProfilerTests.cpp
597 src/armnn/test/ProfilingEventTest.cpp
598 src/armnn/test/SubgraphViewTests.cpp
599 src/armnn/test/TensorHandleStrategyTest.cpp
600 src/armnn/test/TensorHelpers.hpp
601 src/armnn/test/TensorTest.cpp
602 src/armnn/test/TestInputOutputLayerVisitor.cpp
603 src/armnn/test/TestInputOutputLayerVisitor.hpp
604 src/armnn/test/TestLayerVisitor.cpp
605 src/armnn/test/TestLayerVisitor.hpp
606 src/armnn/test/TestNameOnlyLayerVisitor.cpp
607 src/armnn/test/TestNameOnlyLayerVisitor.hpp
608 src/armnn/test/TestNameAndDescriptorLayerVisitor.hpp
609 src/armnn/test/TestNameAndDescriptorLayerVisitor.cpp
610 src/armnn/test/TestUtils.cpp
611 src/armnn/test/TestUtils.hpp
612 src/armnn/test/UnitTests.cpp
613 src/armnn/test/UnitTests.hpp
614 src/armnn/test/UtilsTests.cpp
615 src/armnnUtils/test/PrototxtConversionsTest.cpp
616 src/armnnUtils/test/ParserHelperTest.cpp
617 src/armnnUtils/test/TensorUtilsTest.cpp
618 src/profiling/test/BufferTests.cpp
619 src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
620 src/profiling/test/ProfilingGuidTest.cpp
621 src/profiling/test/ProfilingTests.cpp
622 src/profiling/test/ProfilingTests.hpp
623 src/profiling/test/SendCounterPacketTests.cpp
624 src/profiling/test/SendCounterPacketTests.hpp
625 src/profiling/test/SendTimelinePacketTests.cpp
626 src/profiling/test/TimelinePacketTests.cpp
630 list(APPEND unittest_sources
631 src/armnn/test/DebugCallbackTest.cpp
632 src/armnn/test/QuantizerTest.cpp
633 src/armnn/test/RuntimeTests.cpp
634 src/armnn/test/RuntimeTests.hpp
638 if(BUILD_TF_PARSER AND ARMNNREF)
639 list(APPEND unittest_sources
640 src/armnnTfParser/test/Activations.cpp
641 src/armnnTfParser/test/Addition.cpp
642 src/armnnTfParser/test/AddN.cpp
643 src/armnnTfParser/test/Assert.cpp
644 src/armnnTfParser/test/BiasAdd.cpp
645 src/armnnTfParser/test/BroadcastForAdd.cpp
646 src/armnnTfParser/test/Convolution2d.cpp
647 src/armnnTfParser/test/Concat.cpp
648 src/armnnTfParser/test/ConcatOfConcats.cpp
649 src/armnnTfParser/test/DepthwiseConvolution2d.cpp
650 src/armnnTfParser/test/Equal.cpp
651 src/armnnTfParser/test/ExpandDims.cpp
652 src/armnnTfParser/test/FusedBatchNorm.cpp
653 src/armnnTfParser/test/Gather.cpp
654 src/armnnTfParser/test/Greater.cpp
655 src/armnnTfParser/test/Identity.cpp
656 src/armnnTfParser/test/LocalResponseNormalization.cpp
657 src/armnnTfParser/test/Maximum.cpp
658 src/armnnTfParser/test/MaximumForLeakyRelu.cpp
659 src/armnnTfParser/test/Mean.cpp
660 src/armnnTfParser/test/Minimum.cpp
661 src/armnnTfParser/test/Multiplication.cpp
662 src/armnnTfParser/test/Pad.cpp
663 src/armnnTfParser/test/MultiOutput.cpp
664 src/armnnTfParser/test/PassThru.cpp
665 src/armnnTfParser/test/Pooling.cpp
666 src/armnnTfParser/test/RealDiv.cpp
667 src/armnnTfParser/test/Reshape.cpp
668 src/armnnTfParser/test/ResizeBilinear.cpp
669 src/armnnTfParser/test/Rsqrt.cpp
670 src/armnnTfParser/test/Shape.cpp
671 src/armnnTfParser/test/Softmax.cpp
672 src/armnnTfParser/test/TestDependencies.cpp
673 src/armnnTfParser/test/FullyConnected.cpp
674 src/armnnTfParser/test/Constant.cpp
675 src/armnnTfParser/test/TestMultiInputsOutputs.cpp
676 src/armnnTfParser/test/Split.cpp
677 src/armnnTfParser/test/Squeeze.cpp
678 src/armnnTfParser/test/Sub.cpp
683 if(BUILD_TF_LITE_PARSER AND ARMNNREF)
685 list(APPEND unittest_sources
686 src/armnnTfLiteParser/test/Activations.cpp
687 src/armnnTfLiteParser/test/Addition.cpp
688 src/armnnTfLiteParser/test/AvgPool2D.cpp
689 src/armnnTfLiteParser/test/BatchToSpaceND.cpp
690 src/armnnTfLiteParser/test/Concatenation.cpp
691 src/armnnTfLiteParser/test/Constant.cpp
692 src/armnnTfLiteParser/test/Conv2D.cpp
693 src/armnnTfLiteParser/test/DepthwiseConvolution2D.cpp
694 src/armnnTfLiteParser/test/DetectionPostProcess.cpp
695 src/armnnTfLiteParser/test/FullyConnected.cpp
696 src/armnnTfLiteParser/test/L2Normalization.cpp
697 src/armnnTfLiteParser/test/Maximum.cpp
698 src/armnnTfLiteParser/test/MaxPool2D.cpp
699 src/armnnTfLiteParser/test/Mean.cpp
700 src/armnnTfLiteParser/test/Minimum.cpp
701 src/armnnTfLiteParser/test/Multiplication.cpp
702 src/armnnTfLiteParser/test/Pack.cpp
703 src/armnnTfLiteParser/test/Pad.cpp
704 src/armnnTfLiteParser/test/Reshape.cpp
705 src/armnnTfLiteParser/test/ResizeBilinear.cpp
706 src/armnnTfLiteParser/test/Softmax.cpp
707 src/armnnTfLiteParser/test/SpaceToBatchND.cpp
708 src/armnnTfLiteParser/test/Split.cpp
709 src/armnnTfLiteParser/test/Squeeze.cpp
710 src/armnnTfLiteParser/test/StridedSlice.cpp
711 src/armnnTfLiteParser/test/Sub.cpp
712 src/armnnTfLiteParser/test/TransposeConv.cpp
713 src/armnnTfLiteParser/test/Transpose.cpp
714 src/armnnTfLiteParser/test/Unpack.cpp
715 src/armnnTfLiteParser/test/Unsupported.cpp
716 src/armnnTfLiteParser/test/LoadModel.cpp
717 src/armnnTfLiteParser/test/GetBuffer.cpp
718 src/armnnTfLiteParser/test/OutputShapeOfSqueeze.cpp
719 src/armnnTfLiteParser/test/InputOutputTensorNames.cpp
720 src/armnnTfLiteParser/test/GetTensorIds.cpp
721 src/armnnTfLiteParser/test/GetSubgraphInputsOutputs.cpp
722 src/armnnTfLiteParser/test/GetInputsOutputs.cpp
723 src/armnnTfLiteParser/test/Schema.s
725 set_source_files_properties(src/armnnTfLiteParser/test/Schema.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
729 if(BUILD_CAFFE_PARSER AND ARMNNREF)
730 list(APPEND unittest_sources
731 src/armnnCaffeParser/test/TestAdd.cpp
732 src/armnnCaffeParser/test/TestConcat.cpp
733 src/armnnCaffeParser/test/TestConvolution.cpp
734 src/armnnCaffeParser/test/TestDropout.cpp
735 src/armnnCaffeParser/test/TestInputs.cpp
736 src/armnnCaffeParser/test/TestMul.cpp
737 src/armnnCaffeParser/test/TestPooling2d.cpp
738 src/armnnCaffeParser/test/TestInPlace.cpp
739 src/armnnCaffeParser/test/TestMultiInputsOutputs.cpp
740 src/armnnCaffeParser/test/TestSplit.cpp
744 if(BUILD_ONNX_PARSER AND ARMNNREF)
745 list(APPEND unittest_sources
746 src/armnnOnnxParser/test/Constructor.cpp
747 src/armnnOnnxParser/test/CreateNetwork.cpp
748 src/armnnOnnxParser/test/ProtoxtFixture.cpp
749 src/armnnOnnxParser/test/Const.cpp
750 src/armnnOnnxParser/test/Pooling.cpp
751 src/armnnOnnxParser/test/Reshape.cpp
752 src/armnnOnnxParser/test/Relu.cpp
753 src/armnnOnnxParser/test/Conv2D.cpp
754 src/armnnOnnxParser/test/Addition.cpp
755 src/armnnOnnxParser/test/FullyConnected.cpp
756 src/armnnOnnxParser/test/GetInputsOutputs.cpp
757 src/armnnOnnxParser/test/BatchNorm.cpp
758 src/armnnOnnxParser/test/DepthConv.cpp
762 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
763 list(APPEND unittest_sources
764 src/armnnQuantizer/test/QuantizationDataSetTests.cpp
768 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
770 list(APPEND unittest_sources
771 src/armnnSerializer/test/ActivationSerializationTests.cpp
772 src/armnnSerializer/test/SerializerTests.cpp
773 src/armnnDeserializer/test/DeserializeAbs.cpp
774 src/armnnDeserializer/test/DeserializeActivation.cpp
775 src/armnnDeserializer/test/DeserializeAdd.cpp
776 src/armnnDeserializer/test/DeserializeBatchToSpaceNd.cpp
777 src/armnnDeserializer/test/DeserializeBatchNormalization.cpp
778 src/armnnDeserializer/test/DeserializeComparison.cpp
779 src/armnnDeserializer/test/DeserializeConstant.cpp
780 src/armnnDeserializer/test/DeserializeConvolution2d.cpp
781 src/armnnDeserializer/test/DeserializeDepthToSpace.cpp
782 src/armnnDeserializer/test/DeserializeDivision.cpp
783 src/armnnDeserializer/test/DeserializeFloor.cpp
784 src/armnnDeserializer/test/DeserializeFullyConnected.cpp
785 src/armnnDeserializer/test/DeserializeGather.cpp
786 src/armnnDeserializer/test/DeserializeInstanceNormalization.cpp
787 src/armnnDeserializer/test/DeserializeL2Normalization.cpp
788 src/armnnDeserializer/test/DeserializeLogSoftmax.cpp
789 src/armnnDeserializer/test/DeserializeMean.cpp
790 src/armnnDeserializer/test/DeserializeMultiplication.cpp
791 src/armnnDeserializer/test/DeserializeNormalization.cpp
792 src/armnnDeserializer/test/DeserializePad.cpp
793 src/armnnDeserializer/test/DeserializePermute.cpp
794 src/armnnDeserializer/test/DeserializePooling2d.cpp
795 src/armnnDeserializer/test/DeserializeReshape.cpp
796 src/armnnDeserializer/test/DeserializeResizeBilinear.cpp
797 src/armnnDeserializer/test/DeserializeRsqrt.cpp
798 src/armnnDeserializer/test/DeserializeSlice.cpp
799 src/armnnDeserializer/test/DeserializeSpaceToBatchNd.cpp
800 src/armnnDeserializer/test/DeserializeStridedSlice.cpp
801 src/armnnDeserializer/test/DeserializeSubtraction.cpp
802 src/armnnDeserializer/test/ParserFlatbuffersSerializeFixture.hpp
803 src/armnnDeserializer/test/SchemaSerialize.s
805 set_source_files_properties(src/armnnDeserializer/test/SchemaSerialize.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
808 if(BUILD_GATORD_MOCK)
809 list(APPEND unittest_sources
810 tests/profiling/gatordmock/tests/GatordMockTests.cpp
814 foreach(lib ${armnnUnitTestLibraries})
815 message("Adding object library dependency to UnitTests: ${lib}")
816 list(APPEND unittest_sources $<TARGET_OBJECTS:${lib}>)
819 add_executable(UnitTests ${unittest_sources})
820 target_include_directories(UnitTests PRIVATE src/armnn)
821 target_include_directories(UnitTests PRIVATE src/armnnUtils)
822 target_include_directories(UnitTests PRIVATE src/backends)
823 target_include_directories(UnitTests PRIVATE src/profiling)
826 if(HEAP_PROFILING OR LEAK_CHECKING)
827 message("Valgrind is disabled for heap profiling and leak checking builds.")
829 # Valgrind works with gperftools version number <= 2.4
830 target_compile_definitions(UnitTests PRIVATE "WITH_VALGRIND=1")
834 target_link_libraries(UnitTests ${CMAKE_THREAD_LIBS_INIT})
835 target_link_libraries(UnitTests ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
837 target_link_libraries(UnitTests armnn)
838 target_link_libraries(UnitTests armnnUtils)
841 target_link_libraries(UnitTests armnnTfParser)
844 if(BUILD_GATORD_MOCK)
845 target_link_libraries(UnitTests gatordMockService)
848 if(BUILD_TF_LITE_PARSER)
849 target_include_directories(UnitTests SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}")
850 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
851 target_link_libraries(UnitTests armnnTfLiteParser)
854 if(BUILD_CAFFE_PARSER)
855 target_link_libraries(UnitTests armnnCaffeParser)
858 if(BUILD_ARMNN_SERIALIZER AND ARMNNREF)
859 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer)
860 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
861 target_link_libraries(UnitTests armnnSerializer)
864 if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
865 target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnQuantizer)
866 target_include_directories(UnitTests SYSTEM PRIVATE "${FLATBUFFERS_INCLUDE_PATH}")
867 target_link_libraries(UnitTests armnnQuantizer armnnSerializer)
870 if(BUILD_ONNX_PARSER)
871 target_link_libraries(UnitTests armnnOnnxParser)
874 addDllCopyCommands(UnitTests)
877 if (BUILD_ARMNN_SERIALIZER AND (BUILD_TF_PARSER OR BUILD_TF_LITE_PARSER OR BUILD_ONNX_PARSER OR BUILD_CAFFE_PARSER) AND ARMNNREF)
878 set(ArmnnConverter_sources
879 src/armnnConverter/ArmnnConverter.cpp)
881 add_executable_ex(ArmnnConverter ${ArmnnConverter_sources})
882 target_include_directories(ArmnnConverter PRIVATE src/armnn)
883 target_include_directories(ArmnnConverter PRIVATE src/armnnUtils)
885 if(BUILD_CAFFE_PARSER)
886 target_link_libraries(ArmnnConverter armnnCaffeParser)
889 if(BUILD_ONNX_PARSER)
890 target_link_libraries(ArmnnConverter armnnOnnxParser)
894 target_link_libraries(ArmnnConverter armnnTfParser)
897 if(BUILD_TF_LITE_PARSER)
898 target_link_libraries(ArmnnConverter armnnTfLiteParser)
901 target_link_libraries(ArmnnConverter armnnSerializer)
903 target_link_libraries(ArmnnConverter armnn)
904 target_link_libraries(ArmnnConverter ${CMAKE_THREAD_LIBS_INIT})
905 target_link_libraries(ArmnnConverter
906 ${Boost_SYSTEM_LIBRARY}
907 ${Boost_FILESYSTEM_LIBRARY}
908 ${Boost_PROGRAM_OPTIONS_LIBRARY})
909 addDllCopyCommands(ArmnnConverter)
912 if(BUILD_GATORD_MOCK)
913 set(gatord_mock_sources)
914 list(APPEND gatord_mock_sources
915 tests/profiling/gatordmock/CommandFileParser.hpp
916 tests/profiling/gatordmock/CommandFileParser.cpp
917 tests/profiling/gatordmock/CommandLineProcessor.hpp
918 tests/profiling/gatordmock/CommandLineProcessor.cpp
919 tests/profiling/gatordmock/CounterDirectory.hpp
920 tests/profiling/gatordmock/DirectoryCaptureCommandHandler.cpp
921 tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp
922 tests/profiling/gatordmock/GatordMockService.hpp
923 tests/profiling/gatordmock/GatordMockService.cpp
924 tests/profiling/gatordmock/MockUtils.cpp
925 tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp
926 tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
927 tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp
928 tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
931 include_directories(${Boost_INCLUDE_DIRS} src/profiling)
933 add_library_ex(gatordMockService STATIC ${gatord_mock_sources})
935 add_executable_ex(GartordMock tests/profiling/gatordmock/GatordMockMain.cpp)
937 if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)))
938 target_link_libraries(GartordMock pthread)
941 target_link_libraries(GartordMock
944 ${Boost_PROGRAM_OPTIONS_LIBRARY}
945 ${Boost_SYSTEM_LIBRARY})