xref: /aosp_15_r20/external/ComputeLibrary/tests/BUILD.bazel (revision c217d954acce2dbc11938adb493fc0abd69584f3)
1# Copyright (c) 2023 Arm Limited.
2#
3# SPDX-License-Identifier: MIT
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to
7# deal in the Software without restriction, including without limitation the
8# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9# sell copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in all
13# copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21# SOFTWARE.
22
23#---------------------------------------------------------------------
24# Validation Framework Library
25
26cc_library(
27    name = "validation_framework",
28    srcs = glob([
29        "validation/reference/*.cpp",
30        "validation/*.cpp",
31        "*.h",
32    ]),
33    hdrs = glob([
34        "validation/reference/*.h",
35        "validation/**/*.h",
36    ]),
37    copts = [
38                "-march=armv8.2-a+fp16",
39            ] + select({
40                "//:debug_flag": [
41                    "-O0",
42                    "-g",
43                    "-gdwarf-2",
44                ],
45                "//conditions:default": ["-O3"],
46            }) +
47            select({
48                "//:openmp_flag": ["-fopenmp"],
49                "//conditions:default": [],
50            }) +
51            select({
52                "//:Werror_flag": ["-Werror"],
53                "//conditions:default": [],
54            }),
55    linkstatic = True,
56    deps = [
57        "//:arm_compute",
58        "//:common_defines",
59        "//tests/framework",
60    ],
61)
62
63#---------------------------------------------------------------------
64# Validation Binary
65cc_binary(
66    name = "arm_compute_validation",
67    srcs = glob([
68        "validation/UNIT/**/*.cpp",
69        "validation/CPP/**/*.cpp",
70        "NEON/*.h",
71        "validation/NEON/**/*.cpp",
72        "validation/NEON/**/*.h",
73        "*.cpp",
74        "datasets/*.h",
75        "instruments/*.h",
76    ]),
77    copts = [
78                "-march=armv8.2-a+fp16",
79            ] + select({
80                "//:debug_flag": [
81                    "-O0",
82                    "-g",
83                    "-gdwarf-2",
84                ],
85                "//conditions:default": ["-O3"],
86            }) +
87            select({
88                "//:openmp_flag": ["-fopenmp"],
89                "//conditions:default": [],
90            }) +
91            select({
92                "//:Werror_flag": ["-Werror"],
93                "//conditions:default": [],
94            }),
95    linkstatic = True,
96    deps = [
97        ":validation_framework",
98        "//:arm_compute",
99        "//:arm_compute_graph",
100        "//:common_defines",
101        "//tests/framework",
102    ],
103    local_defines = [] +
104        select({
105                "//:bf16_validation_flag": [
106                "ARM_COMPUTE_ENABLE_BF16",
107                ],
108                "//conditions:default": [],
109              })
110)
111
112#---------------------------------------------------------------------
113# Benchmark Binary
114cc_binary(
115    name = "arm_benchmark",
116    srcs = glob([
117        "benchmark/fixtures/*.h",
118        "benchmark/NEON/*.cpp",
119        "*.cpp",
120    ]),
121    copts = [
122                "-march=armv8.2-a+fp16",
123            ] + select({
124                "//:debug_flag": [
125                    "-O0",
126                    "-g",
127                    "-gdwarf-2",
128                ],
129                "//conditions:default": ["-O3"],
130            }) +
131            select({
132                "//:openmp_flag": ["-fopenmp"],
133                "//conditions:default": [],
134            }) +
135            select({
136                "//:Werror_flag": ["-Werror"],
137                "//conditions:default": [],
138            }),
139    linkstatic = True,
140    deps = [
141        ":arm_compute_validation",
142        ":validation_framework",
143        "//:arm_compute",
144    ],
145)
146