Michele Di Giorgio | d02d5ed | 2021-01-22 09:47:04 +0000 | [diff] [blame] | 1 | # Copyright (c) 2016-2021 Arm Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 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 | import collections |
| 23 | import os.path |
| 24 | import re |
| 25 | import subprocess |
Georgios Pinitas | ea85727 | 2021-01-22 05:47:37 +0000 | [diff] [blame] | 26 | import zlib |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 27 | import json |
Adnan AlSinan | 39aebd1 | 2021-08-06 12:44:51 +0100 | [diff] [blame] | 28 | import codecs |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 29 | |
| 30 | VERSION = "v0.0-unreleased" |
Freddie Liardet | 1562af3 | 2021-08-04 12:22:51 +0100 | [diff] [blame] | 31 | LIBRARY_VERSION_MAJOR = 24 |
Sang-Hoon Park | 6d0b384 | 2020-08-14 14:48:08 +0100 | [diff] [blame] | 32 | LIBRARY_VERSION_MINOR = 0 |
Georgios Pinitas | 35fcc43 | 2020-03-26 18:47:46 +0000 | [diff] [blame] | 33 | LIBRARY_VERSION_PATCH = 0 |
| 34 | SONAME_VERSION = str(LIBRARY_VERSION_MAJOR) + "." + str(LIBRARY_VERSION_MINOR) + "." + str(LIBRARY_VERSION_PATCH) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 35 | |
| 36 | Import('env') |
| 37 | Import('vars') |
Anthony Barbier | 01bbd5f | 2018-11-01 15:10:51 +0000 | [diff] [blame] | 38 | Import('install_lib') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 39 | |
Michalis Spyrou | 748a7c8 | 2019-10-07 13:00:44 +0100 | [diff] [blame] | 40 | def build_bootcode_objs(sources): |
Michalis Spyrou | 748a7c8 | 2019-10-07 13:00:44 +0100 | [diff] [blame] | 41 | arm_compute_env.Append(ASFLAGS = "-I bootcode/") |
| 42 | obj = arm_compute_env.Object(sources) |
| 43 | obj = install_lib(obj) |
| 44 | Default(obj) |
| 45 | return obj |
| 46 | |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 47 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 48 | def build_sve_objs(sources): |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 49 | tmp_env = arm_compute_env.Clone() |
| 50 | tmp_env.Append(CXXFLAGS = "-march=armv8.2-a+sve+fp16") |
| 51 | obj = tmp_env.SharedObject(sources) |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 52 | Default(obj) |
| 53 | return obj |
| 54 | |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 55 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 56 | def build_objs(sources): |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 57 | obj = arm_compute_env.SharedObject(sources) |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 58 | Default(obj) |
| 59 | return obj |
| 60 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 61 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 62 | def build_library(name, build_env, sources, static=False, libs=[]): |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 63 | if static: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 64 | obj = build_env.StaticLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 65 | else: |
| 66 | if env['set_soname']: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 67 | obj = build_env.SharedLibrary(name, source=sources, SHLIBVERSION = SONAME_VERSION, LIBS = arm_compute_env["LIBS"] + libs) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 68 | else: |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 69 | obj = build_env.SharedLibrary(name, source=sources, LIBS = arm_compute_env["LIBS"] + libs) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 70 | |
Anthony Barbier | 01bbd5f | 2018-11-01 15:10:51 +0000 | [diff] [blame] | 71 | obj = install_lib(obj) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 72 | Default(obj) |
| 73 | return obj |
| 74 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 75 | |
Georgios Pinitas | f605bd2 | 2020-11-26 11:55:09 +0000 | [diff] [blame] | 76 | def remove_incode_comments(code): |
| 77 | def replace_with_empty(match): |
| 78 | s = match.group(0) |
| 79 | if s.startswith('/'): |
| 80 | return " " |
| 81 | else: |
| 82 | return s |
| 83 | |
| 84 | comment_regex = re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE) |
| 85 | return re.sub(comment_regex, replace_with_empty, code) |
| 86 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 87 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 88 | def resolve_includes(target, source, env): |
| 89 | # File collection |
| 90 | FileEntry = collections.namedtuple('FileEntry', 'target_name file_contents') |
| 91 | |
| 92 | # Include pattern |
| 93 | pattern = re.compile("#include \"(.*)\"") |
| 94 | |
| 95 | # Get file contents |
| 96 | files = [] |
| 97 | for i in range(len(source)): |
| 98 | src = source[i] |
| 99 | dst = target[i] |
Georgios Pinitas | f605bd2 | 2020-11-26 11:55:09 +0000 | [diff] [blame] | 100 | contents = src.get_contents().decode('utf-8') |
| 101 | contents = remove_incode_comments(contents).splitlines() |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 102 | entry = FileEntry(target_name=dst, file_contents=contents) |
| 103 | files.append((os.path.basename(src.get_path()),entry)) |
| 104 | |
| 105 | # Create dictionary of tupled list |
| 106 | files_dict = dict(files) |
| 107 | |
| 108 | # Check for includes (can only be files in the same folder) |
| 109 | final_files = [] |
| 110 | for file in files: |
| 111 | done = False |
| 112 | tmp_file = file[1].file_contents |
| 113 | while not done: |
| 114 | file_count = 0 |
| 115 | updated_file = [] |
| 116 | for line in tmp_file: |
| 117 | found = pattern.search(line) |
| 118 | if found: |
| 119 | include_file = found.group(1) |
| 120 | data = files_dict[include_file].file_contents |
| 121 | updated_file.extend(data) |
| 122 | else: |
| 123 | updated_file.append(line) |
| 124 | file_count += 1 |
| 125 | |
| 126 | # Check if all include are replaced. |
| 127 | if file_count == len(tmp_file): |
| 128 | done = True |
| 129 | |
| 130 | # Update temp file |
| 131 | tmp_file = updated_file |
| 132 | |
| 133 | # Append and prepend string literal identifiers and add expanded file to final list |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 134 | entry = FileEntry(target_name=file[1].target_name, file_contents=tmp_file) |
| 135 | final_files.append((file[0], entry)) |
| 136 | |
| 137 | # Write output files |
| 138 | for file in final_files: |
| 139 | with open(file[1].target_name.get_path(), 'w+') as out_file: |
Georgios Pinitas | ea85727 | 2021-01-22 05:47:37 +0000 | [diff] [blame] | 140 | file_to_write = "\n".join( file[1].file_contents ) |
| 141 | if env['compress_kernels']: |
Adnan AlSinan | 39aebd1 | 2021-08-06 12:44:51 +0100 | [diff] [blame] | 142 | file_to_write = zlib.compress(file_to_write.encode('utf-8'), 9) |
| 143 | file_to_write = codecs.encode(file_to_write, "base64").decode('utf-8').replace("\n", "") |
Georgios Pinitas | ea85727 | 2021-01-22 05:47:37 +0000 | [diff] [blame] | 144 | file_to_write = "R\"(" + file_to_write + ")\"" |
| 145 | out_file.write(file_to_write) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 146 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 147 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 148 | def create_version_file(target, source, env): |
| 149 | # Generate string with build options library version to embed in the library: |
| 150 | try: |
| 151 | git_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]) |
| 152 | except (OSError, subprocess.CalledProcessError): |
| 153 | git_hash="unknown" |
| 154 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 155 | build_info = "\"arm_compute_version=%s Build options: %s Git hash=%s\"" % (VERSION, vars.args, git_hash.strip()) |
| 156 | with open(target[0].get_path(), "w") as fd: |
| 157 | fd.write(build_info) |
| 158 | |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 159 | |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 160 | def get_attrs_list(env, data_types, data_layouts): |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 161 | attrs = [] |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 162 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 163 | # Manage data-types |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 164 | if 'all' in data_types: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 165 | attrs += ['fp16', 'fp32', 'integer', 'qasymm8', 'qasymm8_signed', 'qsymm16'] |
| 166 | else: |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 167 | if 'fp16' in data_types: attrs += ['fp16'] |
| 168 | if 'fp32' in data_types: attrs += ['fp32'] |
| 169 | if 'integer' in data_types: attrs += ['integer'] |
| 170 | if 'qasymm8' in data_types: attrs += ['qasymm8'] |
| 171 | if 'qasymm8_signed' in data_types: attrs += ['qasymm8_signed'] |
| 172 | if 'qsymm16' in data_types: attrs += ['qsymm16'] |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 173 | # Manage data-layouts |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 174 | if 'all' in data_layouts: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 175 | attrs += ['nhwc', 'nchw'] |
| 176 | else: |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 177 | if 'nhwc' in data_layouts: attrs += ['nhwc'] |
| 178 | if 'nchw' in data_layouts: attrs += ['nchw'] |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 179 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 180 | # Manage execution state |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 181 | attrs += ['estate32' if (env['estate'] == 'auto' and 'v7a' in env['arch']) or '32' in env['estate'] else 'estate64'] |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 182 | return attrs |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 183 | |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 184 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 185 | def get_operator_backend_files(filelist, operators, backend='', techs=[], attrs=[]): |
| 186 | files = { "common" : [] } |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 187 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 188 | # Early return if filelist is empty |
| 189 | if backend not in filelist: |
| 190 | return files |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 191 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 192 | # Iterate over operators and create the file lists to compiler |
| 193 | for operator in operators: |
| 194 | if operator in filelist[backend]['operators']: |
| 195 | files['common'] += filelist[backend]['operators'][operator]["files"]["common"] |
| 196 | for tech in techs: |
| 197 | if tech in filelist[backend]['operators'][operator]["files"]: |
| 198 | # Add tech as a key to dictionary if not there |
| 199 | if tech not in files: |
| 200 | files[tech] = [] |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 201 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 202 | # Add tech files to the tech file list |
| 203 | tech_files = filelist[backend]['operators'][operator]["files"][tech] |
| 204 | files[tech] += tech_files.get('common', []) |
| 205 | for attr in attrs: |
| 206 | files[tech] += tech_files.get(attr, []) |
| 207 | |
| 208 | # Remove duplicates if they exist |
| 209 | return {k: list(set(v)) for k,v in files.items()} |
| 210 | |
| 211 | def collect_operators(filelist, operators, backend=''): |
| 212 | ops = set() |
| 213 | for operator in operators: |
| 214 | if operator in filelist[backend]['operators']: |
| 215 | ops.add(operator) |
| 216 | if 'deps' in filelist[backend]['operators'][operator]: |
| 217 | ops.update(filelist[backend]['operators'][operator]['deps']) |
| 218 | else: |
| 219 | print("Operator {0} is unsupported on {1} backend!".format(operator, backend)) |
| 220 | |
| 221 | return ops |
| 222 | |
| 223 | |
| 224 | def resolve_operator_dependencies(filelist, operators, backend=''): |
| 225 | resolved_operators = collect_operators(filelist, operators, backend) |
| 226 | |
| 227 | are_ops_resolved = False |
| 228 | while not are_ops_resolved: |
| 229 | resolution_pass = collect_operators(filelist, resolved_operators, backend) |
| 230 | if len(resolution_pass) != len(resolved_operators): |
| 231 | resolved_operators.update(resolution_pass) |
| 232 | else: |
| 233 | are_ops_resolved = True |
| 234 | |
| 235 | return resolved_operators |
| 236 | |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 237 | def read_build_config_json(build_config): |
| 238 | build_config_contents = {} |
| 239 | custom_operators = [] |
| 240 | custom_types = [] |
| 241 | custom_layouts = [] |
| 242 | if os.path.isfile(build_config): |
| 243 | with open(build_config) as f: |
| 244 | try: |
| 245 | build_config_contents = json.load(f) |
| 246 | except: |
| 247 | print("Warning: Build configuration file is of invalid JSON format!") |
| 248 | else: |
| 249 | try: |
| 250 | build_config_contents = json.loads(build_config) |
| 251 | except: |
| 252 | print("Warning: Build configuration string is of invalid JSON format!") |
| 253 | if build_config_contents: |
| 254 | custom_operators = build_config_contents.get("operators", []) |
| 255 | custom_types = build_config_contents.get("data_types", []) |
| 256 | custom_layouts = build_config_contents.get("data_layouts", []) |
| 257 | return custom_operators, custom_types, custom_layouts |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 258 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 259 | arm_compute_env = env.Clone() |
Anthony Barbier | 0e72c69 | 2018-08-24 11:22:08 +0100 | [diff] [blame] | 260 | version_file = arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file) |
| 261 | arm_compute_env.AlwaysBuild(version_file) |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 262 | |
Georgios Pinitas | 4551403 | 2020-12-30 00:03:09 +0000 | [diff] [blame] | 263 | default_cpp_compiler = 'g++' if env['os'] not in ['android', 'macos'] else 'clang++' |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 264 | cpp_compiler = os.environ.get('CXX', default_cpp_compiler) |
| 265 | |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 266 | # Generate embed files |
Anthony Barbier | 0e72c69 | 2018-08-24 11:22:08 +0100 | [diff] [blame] | 267 | generate_embed = [ version_file ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 268 | if env['opencl'] and env['embed_kernels']: |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 269 | |
| 270 | # Header files |
| 271 | cl_helper_files = [ 'src/core/CL/cl_kernels/activation_float_helpers.h', |
| 272 | 'src/core/CL/cl_kernels/activation_quant_helpers.h', |
| 273 | 'src/core/CL/cl_kernels/gemm_helpers.h', |
| 274 | 'src/core/CL/cl_kernels/helpers_asymm.h', |
| 275 | 'src/core/CL/cl_kernels/helpers.h', |
| 276 | 'src/core/CL/cl_kernels/load_store_utility.h', |
| 277 | 'src/core/CL/cl_kernels/repeat.h', |
| 278 | 'src/core/CL/cl_kernels/tile_helpers.h', |
| 279 | 'src/core/CL/cl_kernels/types.h', |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 280 | 'src/core/CL/cl_kernels/warp_helpers.h', |
| 281 | 'src/core/CL/cl_kernels/common/experimental/gemm_fused_post_ops/act_eltwise_op_act/fp_post_ops_act_eltwise_op_act.h', |
| 282 | 'src/core/CL/cl_kernels/common/experimental/gemm_fused_post_ops/fp_mixed_precision_helpers.h', |
| 283 | 'src/core/CL/cl_kernels/common/experimental/gemm_fused_post_ops/fp_elementwise_op_helpers.h', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 284 | ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 285 | |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 286 | # Common kernels |
| 287 | cl_files_common = ['src/core/CL/cl_kernels/common/activation_layer.cl', |
| 288 | 'src/core/CL/cl_kernels/common/activation_layer_quant.cl', |
| 289 | 'src/core/CL/cl_kernels/common/arg_min_max.cl', |
| 290 | 'src/core/CL/cl_kernels/common/batchnormalization_layer.cl', |
| 291 | 'src/core/CL/cl_kernels/common/bounding_box_transform.cl', |
| 292 | 'src/core/CL/cl_kernels/common/bounding_box_transform_quantized.cl', |
| 293 | 'src/core/CL/cl_kernels/common/bitwise_op.cl', |
| 294 | 'src/core/CL/cl_kernels/common/cast.cl', |
| 295 | 'src/core/CL/cl_kernels/common/comparisons.cl', |
| 296 | 'src/core/CL/cl_kernels/common/concatenate.cl', |
| 297 | 'src/core/CL/cl_kernels/common/col2im.cl', |
| 298 | 'src/core/CL/cl_kernels/common/convert_fc_weights.cl', |
| 299 | 'src/core/CL/cl_kernels/common/copy_tensor.cl', |
| 300 | 'src/core/CL/cl_kernels/common/crop_tensor.cl', |
| 301 | 'src/core/CL/cl_kernels/common/deconvolution_layer.cl', |
| 302 | 'src/core/CL/cl_kernels/common/dequantization_layer.cl', |
| 303 | 'src/core/CL/cl_kernels/common/elementwise_operation.cl', |
| 304 | 'src/core/CL/cl_kernels/common/elementwise_operation_quantized.cl', |
| 305 | 'src/core/CL/cl_kernels/common/elementwise_unary.cl', |
| 306 | 'src/core/CL/cl_kernels/common/fft_digit_reverse.cl', |
| 307 | 'src/core/CL/cl_kernels/common/fft.cl', |
| 308 | 'src/core/CL/cl_kernels/common/fft_scale.cl', |
| 309 | 'src/core/CL/cl_kernels/common/fill_border.cl', |
| 310 | 'src/core/CL/cl_kernels/common/floor.cl', |
| 311 | 'src/core/CL/cl_kernels/common/gather.cl', |
| 312 | 'src/core/CL/cl_kernels/common/gemm.cl', |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 313 | 'src/core/CL/cl_kernels/common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 314 | 'src/core/CL/cl_kernels/common/gemv.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 315 | 'src/core/CL/cl_kernels/common/gemmlowp.cl', |
| 316 | 'src/core/CL/cl_kernels/common/generate_proposals.cl', |
| 317 | 'src/core/CL/cl_kernels/common/generate_proposals_quantized.cl', |
| 318 | 'src/core/CL/cl_kernels/common/instance_normalization.cl', |
| 319 | 'src/core/CL/cl_kernels/common/l2_normalize.cl', |
| 320 | 'src/core/CL/cl_kernels/common/mean_stddev_normalization.cl', |
| 321 | 'src/core/CL/cl_kernels/common/unpooling_layer.cl', |
| 322 | 'src/core/CL/cl_kernels/common/memset.cl', |
| 323 | 'src/core/CL/cl_kernels/common/nonmax.cl', |
| 324 | 'src/core/CL/cl_kernels/common/minmax_layer.cl', |
| 325 | 'src/core/CL/cl_kernels/common/pad_layer.cl', |
| 326 | 'src/core/CL/cl_kernels/common/permute.cl', |
| 327 | 'src/core/CL/cl_kernels/common/pixelwise_mul_float.cl', |
| 328 | 'src/core/CL/cl_kernels/common/pixelwise_mul_int.cl', |
| 329 | 'src/core/CL/cl_kernels/common/qlstm_layer_normalization.cl', |
| 330 | 'src/core/CL/cl_kernels/common/quantization_layer.cl', |
| 331 | 'src/core/CL/cl_kernels/common/range.cl', |
| 332 | 'src/core/CL/cl_kernels/common/reduction_operation.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 333 | 'src/core/CL/cl_kernels/common/reshape_layer.cl', |
| 334 | 'src/core/CL/cl_kernels/common/convolution_layer.cl', |
| 335 | 'src/core/CL/cl_kernels/common/reverse.cl', |
| 336 | 'src/core/CL/cl_kernels/common/roi_align_layer.cl', |
| 337 | 'src/core/CL/cl_kernels/common/roi_align_layer_quantized.cl', |
| 338 | 'src/core/CL/cl_kernels/common/roi_pooling_layer.cl', |
| 339 | 'src/core/CL/cl_kernels/common/select.cl', |
| 340 | 'src/core/CL/cl_kernels/common/softmax_layer.cl', |
| 341 | 'src/core/CL/cl_kernels/common/softmax_layer_quantized.cl', |
| 342 | 'src/core/CL/cl_kernels/common/stack_layer.cl', |
| 343 | 'src/core/CL/cl_kernels/common/slice_ops.cl', |
| 344 | 'src/core/CL/cl_kernels/common/tile.cl', |
| 345 | 'src/core/CL/cl_kernels/common/transpose.cl' |
| 346 | ] |
| 347 | |
| 348 | # NCHW kernels |
| 349 | cl_files_nchw = ['src/core/CL/cl_kernels/nchw/batch_to_space.cl', |
| 350 | 'src/core/CL/cl_kernels/nchw/batchnormalization_layer.cl', |
| 351 | 'src/core/CL/cl_kernels/nchw/channel_shuffle.cl', |
| 352 | 'src/core/CL/cl_kernels/nchw/depth_to_space.cl', |
| 353 | 'src/core/CL/cl_kernels/nchw/direct_convolution_quantized.cl', |
| 354 | 'src/core/CL/cl_kernels/nchw/direct_convolution1x1.cl', |
| 355 | 'src/core/CL/cl_kernels/nchw/direct_convolution3x3.cl', |
| 356 | 'src/core/CL/cl_kernels/nchw/direct_convolution5x5.cl', |
| 357 | 'src/core/CL/cl_kernels/nchw/dequantization_layer.cl', |
| 358 | 'src/core/CL/cl_kernels/nchw/im2col.cl', |
| 359 | 'src/core/CL/cl_kernels/nchw/normalization_layer.cl', |
| 360 | 'src/core/CL/cl_kernels/nchw/normalize_planar_yuv_layer.cl', |
| 361 | 'src/core/CL/cl_kernels/nchw/normalize_planar_yuv_layer_quantized.cl', |
| 362 | 'src/core/CL/cl_kernels/nchw/pooling_layer.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 363 | 'src/core/CL/cl_kernels/nchw/prior_box_layer.cl', |
| 364 | 'src/core/CL/cl_kernels/nchw/remap.cl', |
| 365 | 'src/core/CL/cl_kernels/nchw/reorg_layer.cl', |
| 366 | 'src/core/CL/cl_kernels/nchw/scale.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 367 | 'src/core/CL/cl_kernels/nchw/space_to_batch.cl', |
| 368 | 'src/core/CL/cl_kernels/nchw/space_to_depth.cl', |
| 369 | 'src/core/CL/cl_kernels/nchw/upsample_layer.cl', |
| 370 | 'src/core/CL/cl_kernels/nchw/winograd_filter_transform.cl', |
| 371 | 'src/core/CL/cl_kernels/nchw/winograd_input_transform.cl', |
| 372 | 'src/core/CL/cl_kernels/nchw/winograd_output_transform.cl' |
| 373 | ] |
| 374 | |
| 375 | # NHWC kernels |
| 376 | cl_files_nhwc = ['src/core/CL/cl_kernels/nhwc/batch_to_space.cl', |
| 377 | 'src/core/CL/cl_kernels/nhwc/batchnormalization_layer.cl', |
| 378 | 'src/core/CL/cl_kernels/nhwc/channel_shuffle.cl', |
| 379 | 'src/core/CL/cl_kernels/nhwc/direct_convolution.cl', |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 380 | 'src/core/CL/cl_kernels/nhwc/direct_convolution3d.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 381 | 'src/core/CL/cl_kernels/nhwc/depth_to_space.cl', |
| 382 | 'src/core/CL/cl_kernels/nhwc/dequantization_layer.cl', |
| 383 | 'src/core/CL/cl_kernels/nhwc/dwc_native_fp_nhwc.cl', |
| 384 | 'src/core/CL/cl_kernels/nhwc/dwc_native_quantized_nhwc.cl', |
| 385 | 'src/core/CL/cl_kernels/nhwc/im2col.cl', |
| 386 | 'src/core/CL/cl_kernels/nhwc/normalization_layer.cl', |
| 387 | 'src/core/CL/cl_kernels/nhwc/normalize_planar_yuv_layer.cl', |
| 388 | 'src/core/CL/cl_kernels/nhwc/normalize_planar_yuv_layer_quantized.cl', |
| 389 | 'src/core/CL/cl_kernels/nhwc/pooling_layer.cl', |
| 390 | 'src/core/CL/cl_kernels/nhwc/pooling_layer_quantized.cl', |
| 391 | 'src/core/CL/cl_kernels/nhwc/remap.cl', |
| 392 | 'src/core/CL/cl_kernels/nhwc/reorg_layer.cl', |
| 393 | 'src/core/CL/cl_kernels/nhwc/scale.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 394 | 'src/core/CL/cl_kernels/nhwc/space_to_batch.cl', |
| 395 | 'src/core/CL/cl_kernels/nhwc/space_to_depth.cl', |
| 396 | 'src/core/CL/cl_kernels/nhwc/upsample_layer.cl', |
| 397 | 'src/core/CL/cl_kernels/nhwc/winograd_filter_transform.cl', |
| 398 | 'src/core/CL/cl_kernels/nhwc/winograd_input_transform.cl', |
| 399 | 'src/core/CL/cl_kernels/nhwc/winograd_output_transform.cl' |
| 400 | ] |
| 401 | |
| 402 | cl_files = cl_helper_files + cl_files_common + cl_files_nchw + cl_files_nhwc |
| 403 | |
| 404 | embed_files = [ f+"embed" for f in cl_files ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 405 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] ) |
| 406 | |
| 407 | generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes)) |
| 408 | |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 409 | Default(generate_embed) |
| 410 | if env["build"] == "embed_only": |
| 411 | Return() |
| 412 | |
Georgios Pinitas | 35fcc43 | 2020-03-26 18:47:46 +0000 | [diff] [blame] | 413 | # Append version defines for semantic versioning |
| 414 | arm_compute_env.Append(CPPDEFINES = [('ARM_COMPUTE_VERSION_MAJOR', LIBRARY_VERSION_MAJOR), |
| 415 | ('ARM_COMPUTE_VERSION_MINOR', LIBRARY_VERSION_MINOR), |
| 416 | ('ARM_COMPUTE_VERSION_PATCH', LIBRARY_VERSION_PATCH)]) |
| 417 | |
Isabella Gottardi | b28f29d | 2017-11-09 17:05:07 +0000 | [diff] [blame] | 418 | # Don't allow undefined references in the libraries: |
Georgios Pinitas | 4551403 | 2020-12-30 00:03:09 +0000 | [diff] [blame] | 419 | undefined_flag = '-Wl,-undefined,error' if 'macos' in arm_compute_env["os"] else '-Wl,--no-undefined' |
| 420 | arm_compute_env.Append(LINKFLAGS=[undefined_flag]) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 421 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/").path] ) |
| 422 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 423 | arm_compute_env.Append(LIBS = ['dl']) |
| 424 | |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 425 | with (open(Dir('#').path + '/filelist.json')) as fp: |
| 426 | filelist = json.load(fp) |
| 427 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 428 | # Common backend files |
| 429 | lib_files = filelist['common'] |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 430 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 431 | # Logging files |
| 432 | if env["logging"]: |
| 433 | lib_files += filelist['logging'] |
Georgios Pinitas | 8795ffb | 2017-12-01 16:13:40 +0000 | [diff] [blame] | 434 | |
Georgios Pinitas | c3c352e | 2021-03-18 10:59:40 +0000 | [diff] [blame] | 435 | # C API files |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 436 | lib_files += filelist['c_api']['common'] |
| 437 | lib_files += filelist['c_api']['operators'] |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 438 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 439 | # Scheduler infrastructure |
| 440 | lib_files += filelist['scheduler']['single'] |
| 441 | if env['cppthreads']: |
| 442 | lib_files += filelist['scheduler']['threads'] |
| 443 | if env['openmp']: |
| 444 | lib_files += filelist['scheduler']['omp'] |
Georgios Pinitas | 8a5146f | 2021-01-12 15:51:07 +0000 | [diff] [blame] | 445 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 446 | # Graph files |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 447 | graph_files = Glob('src/graph/*.cpp') |
| 448 | graph_files += Glob('src/graph/*/*.cpp') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 449 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 450 | # Specify user-defined priority operators |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 451 | custom_operators = [] |
| 452 | custom_types = [] |
| 453 | custom_layouts = [] |
| 454 | |
| 455 | use_custom_ops = env['high_priority'] or env['build_config']; |
| 456 | |
| 457 | if env['high_priority']: |
| 458 | custom_operators = filelist['high_priority'] |
| 459 | custom_types = ['all'] |
| 460 | custom_layouts = ['all'] |
| 461 | |
| 462 | if env['build_config']: |
| 463 | custom_operators, custom_types, custom_layouts = read_build_config_json(env['build_config']) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 464 | |
| 465 | if env['opencl']: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 466 | lib_files += filelist['c_api']['gpu'] |
| 467 | lib_files += filelist['gpu']['common'] |
Michele Di Giorgio | 760c783 | 2021-08-05 10:54:13 +0100 | [diff] [blame] | 468 | |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 469 | cl_operators = custom_operators if use_custom_ops else filelist['gpu']['operators'].keys() |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 470 | cl_ops_to_build = resolve_operator_dependencies(filelist, cl_operators, 'gpu') |
| 471 | lib_files += get_operator_backend_files(filelist, cl_ops_to_build, 'gpu')['common'] |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 472 | |
Georgios Pinitas | 13ef176 | 2021-07-14 17:14:43 +0100 | [diff] [blame] | 473 | graph_files += Glob('src/graph/backends/CL/*.cpp') |
| 474 | |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 475 | sve_o = [] |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 476 | lib_files_sve = [] |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 477 | if env['neon']: |
Georgios Pinitas | 30271c7 | 2019-06-24 14:56:34 +0100 | [diff] [blame] | 478 | # build winograd/depthwise sources for either v7a / v8a |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 479 | arm_compute_env.Append(CPPPATH = ["src/core/NEON/kernels/convolution/common/", |
Michele Di Giorgio | 6ad60af | 2020-06-09 14:52:15 +0100 | [diff] [blame] | 480 | "src/core/NEON/kernels/convolution/winograd/", |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 481 | "src/core/NEON/kernels/convolution/depthwise/", |
| 482 | "src/core/NEON/kernels/assembly/", |
Sang-Hoon Park | 4f7693d | 2021-05-12 13:59:10 +0100 | [diff] [blame] | 483 | "arm_compute/core/NEON/kernels/assembly/", |
Georgios Pinitas | 7891a73 | 2021-08-20 21:39:25 +0100 | [diff] [blame] | 484 | "src/cpu/kernels/assembly/",]) |
Pablo Tello | 9ceebbe | 2018-01-10 16:44:13 +0000 | [diff] [blame] | 485 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 486 | lib_files += filelist['cpu']['common'] |
Georgios Pinitas | ff4fca0 | 2020-10-02 21:00:00 +0100 | [diff] [blame] | 487 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 488 | # Setup SIMD file list to include |
| 489 | simd = [] |
| 490 | if 'sve' in env['arch'] or env['fat_binary']: simd += ['sve'] |
| 491 | if 'sve' not in env['arch'] or env['fat_binary']: simd += ['neon'] |
| 492 | |
| 493 | # Get attributes |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 494 | if(use_custom_ops): |
| 495 | attrs = get_attrs_list(env, custom_types, custom_layouts) |
| 496 | else: |
| 497 | attrs = get_attrs_list(env, env['data_type_support'], env['data_layout_support']) |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 498 | |
| 499 | # Setup data-type and data-layout files to include |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 500 | cpu_operators = custom_operators if use_custom_ops else filelist['cpu']['operators'].keys() |
| 501 | cpu_ops_to_build = resolve_operator_dependencies(filelist, cpu_operators, 'cpu') |
| 502 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 503 | cpu_files = get_operator_backend_files(filelist, cpu_ops_to_build, 'cpu', simd, attrs) |
| 504 | lib_files += cpu_files.get('common', []) |
| 505 | lib_files += cpu_files.get('neon', []) |
| 506 | lib_files_sve += cpu_files.get('sve', []) |
Georgios Pinitas | 13ef176 | 2021-07-14 17:14:43 +0100 | [diff] [blame] | 507 | |
| 508 | graph_files += Glob('src/graph/backends/NEON/*.cpp') |
Georgios Pinitas | 70eb53b | 2021-01-06 19:42:21 +0000 | [diff] [blame] | 509 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 510 | # Restrict from building graph API if a reduced operator list has been provided |
Freddie Liardet | 487d390 | 2021-09-21 12:36:43 +0100 | [diff] [blame] | 511 | if use_custom_ops: |
| 512 | print("WARNING: Graph library requires all operators to be built") |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 513 | graph_files = [] |
| 514 | |
| 515 | # Build bootcode in case of bare-metal |
Michalis Spyrou | 748a7c8 | 2019-10-07 13:00:44 +0100 | [diff] [blame] | 516 | bootcode_o = [] |
| 517 | if env['os'] == 'bare_metal': |
| 518 | bootcode_files = Glob('bootcode/*.s') |
| 519 | bootcode_o = build_bootcode_objs(bootcode_files) |
| 520 | Export('bootcode_o') |
| 521 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 522 | # Build static libraries |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 523 | if (env['fat_binary']): |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 524 | sve_o = build_sve_objs(lib_files_sve) |
| 525 | arm_compute_a = build_library('arm_compute-static', arm_compute_env, lib_files + sve_o, static=True) |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 526 | else: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 527 | arm_compute_a = build_library('arm_compute-static', arm_compute_env, lib_files + lib_files_sve, static=True) |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 528 | Export('arm_compute_a') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 529 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 530 | # Build shared libraries |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 531 | if env['os'] != 'bare_metal' and not env['standalone']: |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 532 | if (env['fat_binary']): |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 533 | arm_compute_so = build_library('arm_compute', arm_compute_env, lib_files + sve_o, static=False) |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 534 | else: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 535 | arm_compute_so = build_library('arm_compute', arm_compute_env, lib_files + lib_files_sve, static=False) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 536 | |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 537 | Export('arm_compute_so') |
| 538 | |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 539 | # Generate dummy core lib for backwards compatibility |
| 540 | arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [], static=True) |
| 541 | Export('arm_compute_core_a') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 542 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 543 | if env['os'] != 'bare_metal' and not env['standalone']: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 544 | arm_compute_core_a_so = build_library('arm_compute_core', arm_compute_env, [], static=False) |
| 545 | Export('arm_compute_core_a_so') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 546 | |
Sang-Hoon Park | 18fbb92 | 2021-01-14 14:50:25 +0000 | [diff] [blame] | 547 | arm_compute_graph_env = arm_compute_env.Clone() |
| 548 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 549 | # Build graph libraries |
Sang-Hoon Park | 18fbb92 | 2021-01-14 14:50:25 +0000 | [diff] [blame] | 550 | arm_compute_graph_env.Append(CXXFLAGS = ['-Wno-redundant-move', '-Wno-pessimizing-move']) |
| 551 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 552 | arm_compute_graph_a = build_library('arm_compute_graph-static', arm_compute_graph_env, graph_files, static=True, libs = [ arm_compute_a]) |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 553 | Export('arm_compute_graph_a') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 554 | |
| 555 | if env['os'] != 'bare_metal' and not env['standalone']: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 556 | arm_compute_graph_so = build_library('arm_compute_graph', arm_compute_graph_env, graph_files, static=False, libs = [ "arm_compute" ]) |
Georgios Pinitas | 9873ea3 | 2017-12-05 15:28:55 +0000 | [diff] [blame] | 557 | Depends(arm_compute_graph_so, arm_compute_so) |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 558 | Export('arm_compute_graph_so') |
| 559 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 560 | if env['standalone']: |
| 561 | alias = arm_compute_env.Alias("arm_compute", [arm_compute_a]) |
| 562 | else: |
| 563 | alias = arm_compute_env.Alias("arm_compute", [arm_compute_a, arm_compute_so]) |
| 564 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 565 | Default(alias) |
| 566 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 567 | if env['standalone']: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 568 | Depends([alias], generate_embed) |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 569 | else: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 570 | Depends([alias], generate_embed) |