From e0c42ef651709fd284da3bedd2c98d420bd6fd1a Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Thu, 15 Dec 2022 16:25:57 +0000 Subject: Bazel and CMake builds Resolves: ONCPUML-1110, ONCPUML-1109 Co-authored-by: Georgios Pinitas Co-authored-by: Joe Ramsay Signed-off-by: David Svantesson Change-Id: Iea693dbe53bf0af87867d6a9e0d1fd9fbe59ef3a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8981 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Jakub Sujak Reviewed-by: Gunes Bayir Comments-Addressed: Arm Jenkins --- examples/BUILD.bazel | 420 ++++++++++++++++++++++++++++++++++++++++++++++++ examples/CMakeLists.txt | 53 ++++++ 2 files changed, 473 insertions(+) create mode 100644 examples/BUILD.bazel create mode 100644 examples/CMakeLists.txt (limited to 'examples') diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel new file mode 100644 index 0000000000..5b82a3200a --- /dev/null +++ b/examples/BUILD.bazel @@ -0,0 +1,420 @@ +# Copyright (c) 2023 Arm Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +#--------------------------------------------------------------------- +# Neon examples + +cc_binary( + name = "neon_cnn", + srcs = ["neon_cnn.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "neon_copy_objects", + srcs = ["neon_copy_objects.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "neon_gemm_qasymm8", + srcs = ["neon_gemm_qasymm8.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "neon_permute", + srcs = ["neon_permute.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "neon_scale", + srcs = ["neon_scale.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "neon_sgemm", + srcs = ["neon_sgemm.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +#--------------------------------------------------------------------- +# Graph examples + +cc_binary( + name = "graph_alexnet", + srcs = ["graph_alexnet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_deepspeech_v0_4_1", + srcs = ["graph_deepspeech_v0_4_1.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_edsr", + srcs = [ + "graph_edsr.cpp", + "graph_edsr.h", + ], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_googlenet", + srcs = ["graph_googlenet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_inception_resnet_v1", + srcs = ["graph_inception_resnet_v1.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_inception_resnet_v2", + srcs = ["graph_inception_resnet_v2.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_inception_v3", + srcs = ["graph_inception_v3.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_inception_v4", + srcs = ["graph_inception_v4.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_lenet", + srcs = ["graph_lenet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_mobilenet", + srcs = ["graph_mobilenet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_mobilenet_v2", + srcs = ["graph_mobilenet_v2.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_resnet12", + srcs = ["graph_resnet12.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_resnet50", + srcs = ["graph_resnet50.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_resnet_v2_50", + srcs = ["graph_resnet_v2_50.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_resnext50", + srcs = ["graph_resnext50.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_shufflenet", + srcs = ["graph_shufflenet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_squeezenet", + srcs = ["graph_squeezenet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_squeezenet_v1_1", + srcs = ["graph_squeezenet_v1_1.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_srcnn955", + srcs = ["graph_srcnn955.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_ssd_mobilenet", + srcs = ["graph_ssd_mobilenet.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_vgg16", + srcs = ["graph_vgg16.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_vgg19", + srcs = ["graph_vgg19.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_vgg_vdsr", + srcs = ["graph_vgg_vdsr.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) + +cc_binary( + name = "graph_yolov3", + srcs = ["graph_yolov3.cpp"], + copts = ["-march=armv8.2-a+fp16"], + linkstatic = False, + deps = [ + "//:arm_compute", + "//:arm_compute_graph", + "//include", + "//utils", + ], +) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000..139b968e4e --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright (c) 2023 Arm Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +set(EXAMPLE_GRAPH_NAMES + graph_alexnet + graph_deepspeech_v0_4_1 + graph_edsr + graph_googlenet + graph_inception_resnet_v1 + graph_inception_resnet_v2 + graph_inception_v3 + graph_inception_v4 + graph_lenet + graph_mobilenet_v2 + graph_mobilenet + graph_resnet_v2_50 + graph_resnet12 + graph_resnet50 + graph_resnext50 + graph_shufflenet + graph_squeezenet_v1_1 + graph_squeezenet + graph_srcnn955 + graph_ssd_mobilenet + graph_vgg_vdsr + graph_vgg16 + graph_vgg19 + graph_yolov3 + PARENT_SCOPE) + +set(EXAMPLE_NEON_NAMES + neon_cnn neon_copy_objects neon_gemm_qasymm8 neon_permute neon_scale + neon_sgemm + PARENT_SCOPE) -- cgit v1.2.1