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 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 160 | def get_attrs_list(arch, estate, data_types, data_layouts): |
| 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 |
| 164 | if any(i in data_types for i in ['all']): |
| 165 | attrs += ['fp16', 'fp32', 'integer', 'qasymm8', 'qasymm8_signed', 'qsymm16'] |
| 166 | else: |
| 167 | if any(i in data_types for i in ['fp16']): attrs += ['fp16'] |
| 168 | if any(i in data_types for i in ['fp32']): attrs += ['fp32'] |
| 169 | if any(i in data_types for i in ['integer']): attrs += ['integer'] |
| 170 | if any(i in data_types for i in ['qasymm8']): attrs += ['qasymm8'] |
| 171 | if any(i in data_types for i in ['qasymm8_signed']): attrs += ['qasymm8_signed'] |
| 172 | if any(i in data_types for i in ['qsymm16']): attrs += ['qsymm16'] |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 173 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 174 | # Manage data-layouts |
| 175 | if any(i in data_layouts for i in ['all']): |
| 176 | attrs += ['nhwc', 'nchw'] |
| 177 | else: |
| 178 | if any(i in data_layouts for i in ['nhwc']): attrs += ['nhwc'] |
| 179 | if any(i in data_layouts for i in ['nchw']): attrs += ['nchw'] |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 180 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 181 | # Manage execution state |
| 182 | estate_attr = 'estate32' if (estate == 'auto' and 'v7a' in arch) or '32' in estate else 'estate64' |
| 183 | attrs += [ estate_attr ] |
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 | return attrs |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 186 | |
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 | def get_operator_backend_files(filelist, operators, backend='', techs=[], attrs=[]): |
| 189 | files = { "common" : [] } |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 190 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 191 | # Early return if filelist is empty |
| 192 | if backend not in filelist: |
| 193 | return files |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 194 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 195 | # Iterate over operators and create the file lists to compiler |
| 196 | for operator in operators: |
| 197 | if operator in filelist[backend]['operators']: |
| 198 | files['common'] += filelist[backend]['operators'][operator]["files"]["common"] |
| 199 | for tech in techs: |
| 200 | if tech in filelist[backend]['operators'][operator]["files"]: |
| 201 | # Add tech as a key to dictionary if not there |
| 202 | if tech not in files: |
| 203 | files[tech] = [] |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 204 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 205 | # Add tech files to the tech file list |
| 206 | tech_files = filelist[backend]['operators'][operator]["files"][tech] |
| 207 | files[tech] += tech_files.get('common', []) |
| 208 | for attr in attrs: |
| 209 | files[tech] += tech_files.get(attr, []) |
| 210 | |
| 211 | # Remove duplicates if they exist |
| 212 | return {k: list(set(v)) for k,v in files.items()} |
| 213 | |
| 214 | def collect_operators(filelist, operators, backend=''): |
| 215 | ops = set() |
| 216 | for operator in operators: |
| 217 | if operator in filelist[backend]['operators']: |
| 218 | ops.add(operator) |
| 219 | if 'deps' in filelist[backend]['operators'][operator]: |
| 220 | ops.update(filelist[backend]['operators'][operator]['deps']) |
| 221 | else: |
| 222 | print("Operator {0} is unsupported on {1} backend!".format(operator, backend)) |
| 223 | |
| 224 | return ops |
| 225 | |
| 226 | |
| 227 | def resolve_operator_dependencies(filelist, operators, backend=''): |
| 228 | resolved_operators = collect_operators(filelist, operators, backend) |
| 229 | |
| 230 | are_ops_resolved = False |
| 231 | while not are_ops_resolved: |
| 232 | resolution_pass = collect_operators(filelist, resolved_operators, backend) |
| 233 | if len(resolution_pass) != len(resolved_operators): |
| 234 | resolved_operators.update(resolution_pass) |
| 235 | else: |
| 236 | are_ops_resolved = True |
| 237 | |
| 238 | return resolved_operators |
| 239 | |
Michalis Spyrou | 20fca52 | 2021-06-07 14:23:57 +0100 | [diff] [blame] | 240 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 241 | arm_compute_env = env.Clone() |
Anthony Barbier | 0e72c69 | 2018-08-24 11:22:08 +0100 | [diff] [blame] | 242 | version_file = arm_compute_env.Command("src/core/arm_compute_version.embed", "", action=create_version_file) |
| 243 | arm_compute_env.AlwaysBuild(version_file) |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 244 | |
Georgios Pinitas | 4551403 | 2020-12-30 00:03:09 +0000 | [diff] [blame] | 245 | 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] | 246 | cpp_compiler = os.environ.get('CXX', default_cpp_compiler) |
| 247 | |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 248 | # Generate embed files |
Anthony Barbier | 0e72c69 | 2018-08-24 11:22:08 +0100 | [diff] [blame] | 249 | generate_embed = [ version_file ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 250 | if env['opencl'] and env['embed_kernels']: |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 251 | |
| 252 | # Header files |
| 253 | cl_helper_files = [ 'src/core/CL/cl_kernels/activation_float_helpers.h', |
| 254 | 'src/core/CL/cl_kernels/activation_quant_helpers.h', |
| 255 | 'src/core/CL/cl_kernels/gemm_helpers.h', |
| 256 | 'src/core/CL/cl_kernels/helpers_asymm.h', |
| 257 | 'src/core/CL/cl_kernels/helpers.h', |
| 258 | 'src/core/CL/cl_kernels/load_store_utility.h', |
| 259 | 'src/core/CL/cl_kernels/repeat.h', |
| 260 | 'src/core/CL/cl_kernels/tile_helpers.h', |
| 261 | 'src/core/CL/cl_kernels/types.h', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 262 | 'src/core/CL/cl_kernels/warp_helpers.h' |
| 263 | ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 264 | |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 265 | # Common kernels |
| 266 | cl_files_common = ['src/core/CL/cl_kernels/common/activation_layer.cl', |
| 267 | 'src/core/CL/cl_kernels/common/activation_layer_quant.cl', |
| 268 | 'src/core/CL/cl_kernels/common/arg_min_max.cl', |
| 269 | 'src/core/CL/cl_kernels/common/batchnormalization_layer.cl', |
| 270 | 'src/core/CL/cl_kernels/common/bounding_box_transform.cl', |
| 271 | 'src/core/CL/cl_kernels/common/bounding_box_transform_quantized.cl', |
| 272 | 'src/core/CL/cl_kernels/common/bitwise_op.cl', |
| 273 | 'src/core/CL/cl_kernels/common/cast.cl', |
| 274 | 'src/core/CL/cl_kernels/common/comparisons.cl', |
| 275 | 'src/core/CL/cl_kernels/common/concatenate.cl', |
| 276 | 'src/core/CL/cl_kernels/common/col2im.cl', |
| 277 | 'src/core/CL/cl_kernels/common/convert_fc_weights.cl', |
| 278 | 'src/core/CL/cl_kernels/common/copy_tensor.cl', |
| 279 | 'src/core/CL/cl_kernels/common/crop_tensor.cl', |
| 280 | 'src/core/CL/cl_kernels/common/deconvolution_layer.cl', |
| 281 | 'src/core/CL/cl_kernels/common/dequantization_layer.cl', |
| 282 | 'src/core/CL/cl_kernels/common/elementwise_operation.cl', |
| 283 | 'src/core/CL/cl_kernels/common/elementwise_operation_quantized.cl', |
| 284 | 'src/core/CL/cl_kernels/common/elementwise_unary.cl', |
| 285 | 'src/core/CL/cl_kernels/common/fft_digit_reverse.cl', |
| 286 | 'src/core/CL/cl_kernels/common/fft.cl', |
| 287 | 'src/core/CL/cl_kernels/common/fft_scale.cl', |
| 288 | 'src/core/CL/cl_kernels/common/fill_border.cl', |
| 289 | 'src/core/CL/cl_kernels/common/floor.cl', |
| 290 | 'src/core/CL/cl_kernels/common/gather.cl', |
| 291 | 'src/core/CL/cl_kernels/common/gemm.cl', |
| 292 | 'src/core/CL/cl_kernels/common/gemv.cl', |
| 293 | 'src/core/CL/cl_kernels/common/gemm_v1.cl', |
| 294 | 'src/core/CL/cl_kernels/common/gemmlowp.cl', |
| 295 | 'src/core/CL/cl_kernels/common/generate_proposals.cl', |
| 296 | 'src/core/CL/cl_kernels/common/generate_proposals_quantized.cl', |
| 297 | 'src/core/CL/cl_kernels/common/instance_normalization.cl', |
| 298 | 'src/core/CL/cl_kernels/common/l2_normalize.cl', |
| 299 | 'src/core/CL/cl_kernels/common/mean_stddev_normalization.cl', |
| 300 | 'src/core/CL/cl_kernels/common/unpooling_layer.cl', |
| 301 | 'src/core/CL/cl_kernels/common/memset.cl', |
| 302 | 'src/core/CL/cl_kernels/common/nonmax.cl', |
| 303 | 'src/core/CL/cl_kernels/common/minmax_layer.cl', |
| 304 | 'src/core/CL/cl_kernels/common/pad_layer.cl', |
| 305 | 'src/core/CL/cl_kernels/common/permute.cl', |
| 306 | 'src/core/CL/cl_kernels/common/pixelwise_mul_float.cl', |
| 307 | 'src/core/CL/cl_kernels/common/pixelwise_mul_int.cl', |
| 308 | 'src/core/CL/cl_kernels/common/qlstm_layer_normalization.cl', |
| 309 | 'src/core/CL/cl_kernels/common/quantization_layer.cl', |
| 310 | 'src/core/CL/cl_kernels/common/range.cl', |
| 311 | 'src/core/CL/cl_kernels/common/reduction_operation.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 312 | 'src/core/CL/cl_kernels/common/reshape_layer.cl', |
| 313 | 'src/core/CL/cl_kernels/common/convolution_layer.cl', |
| 314 | 'src/core/CL/cl_kernels/common/reverse.cl', |
| 315 | 'src/core/CL/cl_kernels/common/roi_align_layer.cl', |
| 316 | 'src/core/CL/cl_kernels/common/roi_align_layer_quantized.cl', |
| 317 | 'src/core/CL/cl_kernels/common/roi_pooling_layer.cl', |
| 318 | 'src/core/CL/cl_kernels/common/select.cl', |
| 319 | 'src/core/CL/cl_kernels/common/softmax_layer.cl', |
| 320 | 'src/core/CL/cl_kernels/common/softmax_layer_quantized.cl', |
| 321 | 'src/core/CL/cl_kernels/common/stack_layer.cl', |
| 322 | 'src/core/CL/cl_kernels/common/slice_ops.cl', |
| 323 | 'src/core/CL/cl_kernels/common/tile.cl', |
| 324 | 'src/core/CL/cl_kernels/common/transpose.cl' |
| 325 | ] |
| 326 | |
| 327 | # NCHW kernels |
| 328 | cl_files_nchw = ['src/core/CL/cl_kernels/nchw/batch_to_space.cl', |
| 329 | 'src/core/CL/cl_kernels/nchw/batchnormalization_layer.cl', |
| 330 | 'src/core/CL/cl_kernels/nchw/channel_shuffle.cl', |
| 331 | 'src/core/CL/cl_kernels/nchw/depth_to_space.cl', |
| 332 | 'src/core/CL/cl_kernels/nchw/direct_convolution_quantized.cl', |
| 333 | 'src/core/CL/cl_kernels/nchw/direct_convolution1x1.cl', |
| 334 | 'src/core/CL/cl_kernels/nchw/direct_convolution3x3.cl', |
| 335 | 'src/core/CL/cl_kernels/nchw/direct_convolution5x5.cl', |
| 336 | 'src/core/CL/cl_kernels/nchw/dequantization_layer.cl', |
| 337 | 'src/core/CL/cl_kernels/nchw/im2col.cl', |
| 338 | 'src/core/CL/cl_kernels/nchw/normalization_layer.cl', |
| 339 | 'src/core/CL/cl_kernels/nchw/normalize_planar_yuv_layer.cl', |
| 340 | 'src/core/CL/cl_kernels/nchw/normalize_planar_yuv_layer_quantized.cl', |
| 341 | 'src/core/CL/cl_kernels/nchw/pooling_layer.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 342 | 'src/core/CL/cl_kernels/nchw/prior_box_layer.cl', |
| 343 | 'src/core/CL/cl_kernels/nchw/remap.cl', |
| 344 | 'src/core/CL/cl_kernels/nchw/reorg_layer.cl', |
| 345 | 'src/core/CL/cl_kernels/nchw/scale.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 346 | 'src/core/CL/cl_kernels/nchw/space_to_batch.cl', |
| 347 | 'src/core/CL/cl_kernels/nchw/space_to_depth.cl', |
| 348 | 'src/core/CL/cl_kernels/nchw/upsample_layer.cl', |
| 349 | 'src/core/CL/cl_kernels/nchw/winograd_filter_transform.cl', |
| 350 | 'src/core/CL/cl_kernels/nchw/winograd_input_transform.cl', |
| 351 | 'src/core/CL/cl_kernels/nchw/winograd_output_transform.cl' |
| 352 | ] |
| 353 | |
| 354 | # NHWC kernels |
| 355 | cl_files_nhwc = ['src/core/CL/cl_kernels/nhwc/batch_to_space.cl', |
| 356 | 'src/core/CL/cl_kernels/nhwc/batchnormalization_layer.cl', |
| 357 | 'src/core/CL/cl_kernels/nhwc/channel_shuffle.cl', |
| 358 | 'src/core/CL/cl_kernels/nhwc/direct_convolution.cl', |
| 359 | 'src/core/CL/cl_kernels/nhwc/depth_to_space.cl', |
| 360 | 'src/core/CL/cl_kernels/nhwc/dequantization_layer.cl', |
| 361 | 'src/core/CL/cl_kernels/nhwc/dwc_native_fp_nhwc.cl', |
| 362 | 'src/core/CL/cl_kernels/nhwc/dwc_native_quantized_nhwc.cl', |
| 363 | 'src/core/CL/cl_kernels/nhwc/im2col.cl', |
| 364 | 'src/core/CL/cl_kernels/nhwc/normalization_layer.cl', |
| 365 | 'src/core/CL/cl_kernels/nhwc/normalize_planar_yuv_layer.cl', |
| 366 | 'src/core/CL/cl_kernels/nhwc/normalize_planar_yuv_layer_quantized.cl', |
| 367 | 'src/core/CL/cl_kernels/nhwc/pooling_layer.cl', |
| 368 | 'src/core/CL/cl_kernels/nhwc/pooling_layer_quantized.cl', |
| 369 | 'src/core/CL/cl_kernels/nhwc/remap.cl', |
| 370 | 'src/core/CL/cl_kernels/nhwc/reorg_layer.cl', |
| 371 | 'src/core/CL/cl_kernels/nhwc/scale.cl', |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 372 | 'src/core/CL/cl_kernels/nhwc/space_to_batch.cl', |
| 373 | 'src/core/CL/cl_kernels/nhwc/space_to_depth.cl', |
| 374 | 'src/core/CL/cl_kernels/nhwc/upsample_layer.cl', |
| 375 | 'src/core/CL/cl_kernels/nhwc/winograd_filter_transform.cl', |
| 376 | 'src/core/CL/cl_kernels/nhwc/winograd_input_transform.cl', |
| 377 | 'src/core/CL/cl_kernels/nhwc/winograd_output_transform.cl' |
| 378 | ] |
| 379 | |
| 380 | cl_files = cl_helper_files + cl_files_common + cl_files_nchw + cl_files_nhwc |
| 381 | |
| 382 | embed_files = [ f+"embed" for f in cl_files ] |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 383 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/CL/").path] ) |
| 384 | |
| 385 | generate_embed.append(arm_compute_env.Command(embed_files, cl_files, action=resolve_includes)) |
| 386 | |
Anthony Barbier | 6a3daf1 | 2018-02-19 17:24:27 +0000 | [diff] [blame] | 387 | Default(generate_embed) |
| 388 | if env["build"] == "embed_only": |
| 389 | Return() |
| 390 | |
Georgios Pinitas | 35fcc43 | 2020-03-26 18:47:46 +0000 | [diff] [blame] | 391 | # Append version defines for semantic versioning |
| 392 | arm_compute_env.Append(CPPDEFINES = [('ARM_COMPUTE_VERSION_MAJOR', LIBRARY_VERSION_MAJOR), |
| 393 | ('ARM_COMPUTE_VERSION_MINOR', LIBRARY_VERSION_MINOR), |
| 394 | ('ARM_COMPUTE_VERSION_PATCH', LIBRARY_VERSION_PATCH)]) |
| 395 | |
Isabella Gottardi | b28f29d | 2017-11-09 17:05:07 +0000 | [diff] [blame] | 396 | # Don't allow undefined references in the libraries: |
Georgios Pinitas | 4551403 | 2020-12-30 00:03:09 +0000 | [diff] [blame] | 397 | undefined_flag = '-Wl,-undefined,error' if 'macos' in arm_compute_env["os"] else '-Wl,--no-undefined' |
| 398 | arm_compute_env.Append(LINKFLAGS=[undefined_flag]) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 399 | arm_compute_env.Append(CPPPATH =[Dir("./src/core/").path] ) |
| 400 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 401 | arm_compute_env.Append(LIBS = ['dl']) |
| 402 | |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 403 | with (open(Dir('#').path + '/filelist.json')) as fp: |
| 404 | filelist = json.load(fp) |
| 405 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 406 | # Common backend files |
| 407 | lib_files = filelist['common'] |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 408 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 409 | # Logging files |
| 410 | if env["logging"]: |
| 411 | lib_files += filelist['logging'] |
Georgios Pinitas | 8795ffb | 2017-12-01 16:13:40 +0000 | [diff] [blame] | 412 | |
Georgios Pinitas | c3c352e | 2021-03-18 10:59:40 +0000 | [diff] [blame] | 413 | # C API files |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 414 | lib_files += filelist['c_api']['common'] |
| 415 | lib_files += filelist['c_api']['operators'] |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 416 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 417 | # Scheduler infrastructure |
| 418 | lib_files += filelist['scheduler']['single'] |
| 419 | if env['cppthreads']: |
| 420 | lib_files += filelist['scheduler']['threads'] |
| 421 | if env['openmp']: |
| 422 | lib_files += filelist['scheduler']['omp'] |
Georgios Pinitas | 8a5146f | 2021-01-12 15:51:07 +0000 | [diff] [blame] | 423 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 424 | # Graph files |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 425 | graph_files = Glob('src/graph/*.cpp') |
| 426 | graph_files += Glob('src/graph/*/*.cpp') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 427 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 428 | # Specify user-defined priority operators |
| 429 | use_priority_ops = env['high_priority'] |
| 430 | priority_operators = filelist['high_priority'] |
| 431 | if env['build_config'] != "": |
| 432 | build_config = env['build_config'] |
| 433 | build_config_contents = {} |
| 434 | if os.path.isfile(build_config): |
| 435 | with open(build_config) as f: |
| 436 | try: |
| 437 | build_config_contents = json.load(f) |
| 438 | except: |
| 439 | print("Warning: Build configuration file is of invalid JSON format!") |
| 440 | else: |
| 441 | try: |
| 442 | build_config_contents = json.loads(build_config) |
| 443 | except: |
| 444 | print("Warning: Build configuration string is of invalid JSON format!") |
| 445 | if build_config_contents: |
| 446 | priority_operators = build_config_contents.get("operators", []) |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 447 | |
| 448 | if env['opencl']: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 449 | lib_files += filelist['c_api']['gpu'] |
| 450 | lib_files += filelist['gpu']['common'] |
Michele Di Giorgio | 760c783 | 2021-08-05 10:54:13 +0100 | [diff] [blame] | 451 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 452 | cl_operators = priority_operators if use_priority_ops else filelist['gpu']['operators'].keys() |
| 453 | cl_ops_to_build = resolve_operator_dependencies(filelist, cl_operators, 'gpu') |
| 454 | 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] | 455 | |
Georgios Pinitas | 13ef176 | 2021-07-14 17:14:43 +0100 | [diff] [blame] | 456 | graph_files += Glob('src/graph/backends/CL/*.cpp') |
| 457 | |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 458 | sve_o = [] |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 459 | lib_files_sve = [] |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 460 | if env['neon']: |
Georgios Pinitas | 30271c7 | 2019-06-24 14:56:34 +0100 | [diff] [blame] | 461 | # build winograd/depthwise sources for either v7a / v8a |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 462 | arm_compute_env.Append(CPPPATH = ["src/core/NEON/kernels/convolution/common/", |
Michele Di Giorgio | 6ad60af | 2020-06-09 14:52:15 +0100 | [diff] [blame] | 463 | "src/core/NEON/kernels/convolution/winograd/", |
Sang-Hoon Park | 68dd25f | 2020-10-19 16:00:11 +0100 | [diff] [blame] | 464 | "src/core/NEON/kernels/convolution/depthwise/", |
| 465 | "src/core/NEON/kernels/assembly/", |
Sang-Hoon Park | 4f7693d | 2021-05-12 13:59:10 +0100 | [diff] [blame] | 466 | "arm_compute/core/NEON/kernels/assembly/", |
Georgios Pinitas | 7891a73 | 2021-08-20 21:39:25 +0100 | [diff] [blame] | 467 | "src/cpu/kernels/assembly/",]) |
Pablo Tello | 9ceebbe | 2018-01-10 16:44:13 +0000 | [diff] [blame] | 468 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 469 | lib_files += filelist['cpu']['common'] |
Georgios Pinitas | ff4fca0 | 2020-10-02 21:00:00 +0100 | [diff] [blame] | 470 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 471 | # Setup SIMD file list to include |
| 472 | simd = [] |
| 473 | if 'sve' in env['arch'] or env['fat_binary']: simd += ['sve'] |
| 474 | if 'sve' not in env['arch'] or env['fat_binary']: simd += ['neon'] |
| 475 | |
| 476 | # Get attributes |
| 477 | attrs = get_attrs_list(env['arch'], env['estate'], env['data_type_support'], env['data_layout_support']) |
| 478 | |
| 479 | # Setup data-type and data-layout files to include |
| 480 | cpu_operators = priority_operators if use_priority_ops else filelist['cpu']['operators'].keys() |
| 481 | cpu_ops_to_build = resolve_operator_dependencies(filelist, filelist['cpu']['operators'], 'cpu') |
| 482 | cpu_files = get_operator_backend_files(filelist, cpu_ops_to_build, 'cpu', simd, attrs) |
| 483 | lib_files += cpu_files.get('common', []) |
| 484 | lib_files += cpu_files.get('neon', []) |
| 485 | lib_files_sve += cpu_files.get('sve', []) |
Georgios Pinitas | 13ef176 | 2021-07-14 17:14:43 +0100 | [diff] [blame] | 486 | |
| 487 | graph_files += Glob('src/graph/backends/NEON/*.cpp') |
Georgios Pinitas | 70eb53b | 2021-01-06 19:42:21 +0000 | [diff] [blame] | 488 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 489 | # Restrict from building graph API if a reduced operator list has been provided |
| 490 | if use_priority_ops: |
| 491 | print("Graph library requires all operators to be built") |
| 492 | graph_files = [] |
| 493 | |
| 494 | # Build bootcode in case of bare-metal |
Michalis Spyrou | 748a7c8 | 2019-10-07 13:00:44 +0100 | [diff] [blame] | 495 | bootcode_o = [] |
| 496 | if env['os'] == 'bare_metal': |
| 497 | bootcode_files = Glob('bootcode/*.s') |
| 498 | bootcode_o = build_bootcode_objs(bootcode_files) |
| 499 | Export('bootcode_o') |
| 500 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 501 | # Build static libraries |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 502 | if (env['fat_binary']): |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 503 | sve_o = build_sve_objs(lib_files_sve) |
| 504 | 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] | 505 | else: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 506 | 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] | 507 | Export('arm_compute_a') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 508 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 509 | # Build shared libraries |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 510 | if env['os'] != 'bare_metal' and not env['standalone']: |
Georgios Pinitas | bdcdc39 | 2021-04-22 16:42:03 +0100 | [diff] [blame] | 511 | if (env['fat_binary']): |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 512 | 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] | 513 | else: |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 514 | 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] | 515 | |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 516 | Export('arm_compute_so') |
| 517 | |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 518 | # Generate dummy core lib for backwards compatibility |
| 519 | arm_compute_core_a = build_library('arm_compute_core-static', arm_compute_env, [], static=True) |
| 520 | Export('arm_compute_core_a') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 521 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 522 | if env['os'] != 'bare_metal' and not env['standalone']: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 523 | arm_compute_core_a_so = build_library('arm_compute_core', arm_compute_env, [], static=False) |
| 524 | Export('arm_compute_core_a_so') |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 525 | |
Sang-Hoon Park | 18fbb92 | 2021-01-14 14:50:25 +0000 | [diff] [blame] | 526 | arm_compute_graph_env = arm_compute_env.Clone() |
| 527 | |
Georgios Pinitas | b6af482 | 2021-09-14 12:33:34 +0100 | [diff] [blame] | 528 | # Build graph libraries |
Sang-Hoon Park | 18fbb92 | 2021-01-14 14:50:25 +0000 | [diff] [blame] | 529 | arm_compute_graph_env.Append(CXXFLAGS = ['-Wno-redundant-move', '-Wno-pessimizing-move']) |
| 530 | |
Georgios Pinitas | 4d9687e | 2020-10-21 18:33:36 +0100 | [diff] [blame] | 531 | 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] | 532 | Export('arm_compute_graph_a') |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 533 | |
| 534 | if env['os'] != 'bare_metal' and not env['standalone']: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 535 | 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] | 536 | Depends(arm_compute_graph_so, arm_compute_so) |
Anthony Barbier | 2a07e18 | 2017-08-04 18:20:27 +0100 | [diff] [blame] | 537 | Export('arm_compute_graph_so') |
| 538 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 539 | if env['standalone']: |
| 540 | alias = arm_compute_env.Alias("arm_compute", [arm_compute_a]) |
| 541 | else: |
| 542 | alias = arm_compute_env.Alias("arm_compute", [arm_compute_a, arm_compute_so]) |
| 543 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 544 | Default(alias) |
| 545 | |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 546 | if env['standalone']: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 547 | Depends([alias], generate_embed) |
Pablo Tello | c6cb35a | 2017-06-21 15:39:47 +0100 | [diff] [blame] | 548 | else: |
Michalis Spyrou | 62c2ad6 | 2021-06-21 17:40:09 +0100 | [diff] [blame] | 549 | Depends([alias], generate_embed) |