@@ -23,9 +23,12 @@ import collections
2323import os .path
2424import re
2525import subprocess
26+ import zlib
27+ import base64
28+ import string
2629
27- VERSION = "v20.11 "
28- LIBRARY_VERSION_MAJOR = 21
30+ VERSION = "v21.02 "
31+ LIBRARY_VERSION_MAJOR = 22
2932LIBRARY_VERSION_MINOR = 0
3033LIBRARY_VERSION_PATCH = 0
3134SONAME_VERSION = str (LIBRARY_VERSION_MAJOR ) + "." + str (LIBRARY_VERSION_MINOR ) + "." + str (LIBRARY_VERSION_PATCH )
@@ -42,19 +45,30 @@ def build_bootcode_objs(sources):
4245 Default (obj )
4346 return obj
4447
45- def build_library (name , sources , static = False , libs = []):
48+ def build_library (name , build_env , sources , static = False , libs = []):
4649 if static :
47- obj = arm_compute_env .StaticLibrary (name , source = sources , LIBS = arm_compute_env ["LIBS" ] + libs )
50+ obj = build_env .StaticLibrary (name , source = sources , LIBS = arm_compute_env ["LIBS" ] + libs )
4851 else :
4952 if env ['set_soname' ]:
50- obj = arm_compute_env .SharedLibrary (name , source = sources , SHLIBVERSION = SONAME_VERSION , LIBS = arm_compute_env ["LIBS" ] + libs )
53+ obj = build_env .SharedLibrary (name , source = sources , SHLIBVERSION = SONAME_VERSION , LIBS = arm_compute_env ["LIBS" ] + libs )
5154 else :
52- obj = arm_compute_env .SharedLibrary (name , source = sources , LIBS = arm_compute_env ["LIBS" ] + libs )
55+ obj = build_env .SharedLibrary (name , source = sources , LIBS = arm_compute_env ["LIBS" ] + libs )
5356
5457 obj = install_lib (obj )
5558 Default (obj )
5659 return obj
5760
61+ def remove_incode_comments (code ):
62+ def replace_with_empty (match ):
63+ s = match .group (0 )
64+ if s .startswith ('/' ):
65+ return " "
66+ else :
67+ return s
68+
69+ comment_regex = re .compile (r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"' , re .DOTALL | re .MULTILINE )
70+ return re .sub (comment_regex , replace_with_empty , code )
71+
5872def resolve_includes (target , source , env ):
5973 # File collection
6074 FileEntry = collections .namedtuple ('FileEntry' , 'target_name file_contents' )
@@ -67,7 +81,8 @@ def resolve_includes(target, source, env):
6781 for i in range (len (source )):
6882 src = source [i ]
6983 dst = target [i ]
70- contents = src .get_contents ().decode ('utf-8' ).splitlines ()
84+ contents = src .get_contents ().decode ('utf-8' )
85+ contents = remove_incode_comments (contents ).splitlines ()
7186 entry = FileEntry (target_name = dst , file_contents = contents )
7287 files .append ((os .path .basename (src .get_path ()),entry ))
7388
@@ -100,15 +115,17 @@ def resolve_includes(target, source, env):
100115 tmp_file = updated_file
101116
102117 # Append and prepend string literal identifiers and add expanded file to final list
103- tmp_file .insert (0 , "R\" (\n " )
104- tmp_file .append ("\n )\" " )
105118 entry = FileEntry (target_name = file [1 ].target_name , file_contents = tmp_file )
106119 final_files .append ((file [0 ], entry ))
107120
108121 # Write output files
109122 for file in final_files :
110123 with open (file [1 ].target_name .get_path (), 'w+' ) as out_file :
111- out_file .write ( "\n " .join ( file [1 ].file_contents ))
124+ file_to_write = "\n " .join ( file [1 ].file_contents )
125+ if env ['compress_kernels' ]:
126+ file_to_write = zlib .compress (file_to_write , 9 ).encode ("base64" ).replace ("\n " , "" )
127+ file_to_write = "R\" (" + file_to_write + ")\" "
128+ out_file .write (file_to_write )
112129
113130def create_version_file (target , source , env ):
114131# Generate string with build options library version to embed in the library:
@@ -125,6 +142,9 @@ arm_compute_env = env.Clone()
125142version_file = arm_compute_env .Command ("src/core/arm_compute_version.embed" , "" , action = create_version_file )
126143arm_compute_env .AlwaysBuild (version_file )
127144
145+ default_cpp_compiler = 'g++' if env ['os' ] not in ['android' , 'macos' ] else 'clang++'
146+ cpp_compiler = os .environ .get ('CXX' , default_cpp_compiler )
147+
128148# Generate embed files
129149generate_embed = [ version_file ]
130150if env ['opencl' ] and env ['embed_kernels' ]:
@@ -156,7 +176,8 @@ arm_compute_env.Append(CPPDEFINES = [('ARM_COMPUTE_VERSION_MAJOR', LIBRARY_VERSI
156176
157177
158178# Don't allow undefined references in the libraries:
159- arm_compute_env .Append (LINKFLAGS = ['-Wl,--no-undefined' ])
179+ undefined_flag = '-Wl,-undefined,error' if 'macos' in arm_compute_env ["os" ] else '-Wl,--no-undefined'
180+ arm_compute_env .Append (LINKFLAGS = [undefined_flag ])
160181arm_compute_env .Append (CPPPATH = [Dir ("./src/core/" ).path ] )
161182
162183arm_compute_env .Append (LIBS = ['dl' ])
@@ -196,11 +217,17 @@ if env['opencl']:
196217 core_files += Glob ('src/core/CL/gemm/native/*.cpp' )
197218 core_files += Glob ('src/core/CL/gemm/reshaped/*.cpp' )
198219 core_files += Glob ('src/core/CL/gemm/reshaped_only_rhs/*.cpp' )
220+ core_files += Glob ('src/core/gpu/cl/*.cpp' )
221+ core_files += Glob ('src/core/gpu/cl/kernels/*.cpp' )
199222
200223 runtime_files += Glob ('src/runtime/CL/*.cpp' )
201224 runtime_files += Glob ('src/runtime/CL/functions/*.cpp' )
202225 runtime_files += Glob ('src/runtime/CL/gemm/*.cpp' )
203226 runtime_files += Glob ('src/runtime/CL/tuners/*.cpp' )
227+ runtime_files += Glob ('src/runtime/gpu/cl/*.cpp' )
228+ runtime_files += Glob ('src/runtime/gpu/cl/operators/*.cpp' )
229+ runtime_files += Glob ('src/runtime/CL/mlgo/*.cpp' )
230+ runtime_files += Glob ('src/runtime/CL/gemm_auto_heuristics/*.cpp' )
204231
205232 graph_files += Glob ('src/graph/backends/CL/*.cpp' )
206233
@@ -211,6 +238,9 @@ if env['neon']:
211238 core_files += Glob ('src/core/NEON/kernels/assembly/*.cpp' )
212239
213240 core_files += Glob ('src/core/NEON/kernels/arm_gemm/*.cpp' )
241+ core_files += Glob ('src/core/NEON/kernels/arm_conv/*.cpp' )
242+ core_files += Glob ('src/core/NEON/kernels/arm_conv/pooling/*.cpp' )
243+ core_files += Glob ('src/core/NEON/kernels/arm_conv/pooling/kernels/cpp_*/*.cpp' )
214244
215245 # build winograd/depthwise sources for either v7a / v8a
216246 core_files += Glob ('src/core/NEON/kernels/convolution/*/*.cpp' )
@@ -228,24 +258,50 @@ if env['neon']:
228258
229259 if env ['estate' ] == '64' :
230260 core_files += Glob ('src/core/NEON/kernels/arm_gemm/kernels/a64_*/*.cpp' )
261+ core_files += Glob ('src/core/NEON/kernels/arm_conv/pooling/kernels/a64_*/*.cpp' )
231262 if "sve" in env ['arch' ]:
232263 core_files += Glob ('src/core/NEON/kernels/arm_gemm/kernels/sve_*/*.cpp' )
264+ core_files += Glob ('src/core/NEON/kernels/arm_conv/pooling/kernels/sve_*/*.cpp' )
233265
234266 if any (i in env ['data_type_support' ] for i in ['all' , 'fp16' ]):
235- core_files += Glob ('src/core/NEON/kernels/*/impl/fp16_* .cpp' )
267+ core_files += Glob ('src/core/NEON/kernels/*/impl/*/fp16 .cpp' )
236268 if any (i in env ['data_type_support' ] for i in ['all' , 'fp32' ]):
237- core_files += Glob ('src/core/NEON/kernels/*/impl/fp32_* .cpp' )
269+ core_files += Glob ('src/core/NEON/kernels/*/impl/*/fp32 .cpp' )
238270 if any (i in env ['data_type_support' ] for i in ['all' , 'qasymm8' ]):
239- core_files += Glob ('src/core/NEON/kernels/*/impl/qasymm8_neon* .cpp' )
271+ core_files += Glob ('src/core/NEON/kernels/*/impl/*/qasymm8 .cpp' )
240272 if any (i in env ['data_type_support' ] for i in ['all' , 'qasymm8_signed' ]):
241- core_files += Glob ('src/core/NEON/kernels/*/impl/qasymm8_signed_* .cpp' )
273+ core_files += Glob ('src/core/NEON/kernels/*/impl/*/qasymm8_signed .cpp' )
242274 if any (i in env ['data_type_support' ] for i in ['all' , 'qsymm16' ]):
243- core_files += Glob ('src/core/NEON/kernels/*/impl/qsymm16_*.cpp' )
275+ core_files += Glob ('src/core/NEON/kernels/*/impl/*/qsymm16.cpp' )
276+ if any (i in env ['data_type_support' ] for i in ['all' , 'integer' ]):
277+ core_files += Glob ('src/core/NEON/kernels/*/impl/*/integer.cpp' )
244278
245279 runtime_files += Glob ('src/runtime/NEON/*.cpp' )
246280 runtime_files += Glob ('src/runtime/NEON/functions/*.cpp' )
247281 runtime_files += Glob ('src/runtime/NEON/functions/assembly/*.cpp' )
248282
283+ core_files += Glob ('src/core/cpu/*.cpp' )
284+ core_files += Glob ('src/core/cpu/kernels/*.cpp' )
285+ core_files += Glob ('src/core/cpu/kernels/*/*.cpp' )
286+ if any (i in env ['data_type_support' ] for i in ['all' , 'fp16' ]):
287+ core_files += Glob ('src/core/cpu/kernels/*/*/fp16.cpp' )
288+ if any (i in env ['data_type_support' ] for i in ['all' , 'fp32' ]):
289+ core_files += Glob ('src/core/cpu/kernels/*/*/fp32.cpp' )
290+ if any (i in env ['data_type_support' ] for i in ['all' , 'qasymm8' ]):
291+ core_files += Glob ('src/core/cpu/kernels/*/*/qasymm8.cpp' )
292+ if any (i in env ['data_type_support' ] for i in ['all' , 'qasymm8_signed' ]):
293+ core_files += Glob ('src/core/cpu/kernels/*/*/qasymm8_signed.cpp' )
294+ if any (i in env ['data_type_support' ] for i in ['all' , 'qsymm16' ]):
295+ core_files += Glob ('src/core/cpu/kernels/*/*/qsymm16.cpp' )
296+ if any (i in env ['data_type_support' ] for i in ['all' , 'integer' ]):
297+ core_files += Glob ('src/core/cpu/kernels/*/*/integer.cpp' )
298+
299+ if any (i in env ['data_layout_support' ] for i in ['all' , 'nchw' ]):
300+ core_files += Glob ('src/core/cpu/kernels/*/*/nchw/all.cpp' )
301+
302+ runtime_files += Glob ('src/runtime/cpu/*.cpp' )
303+ runtime_files += Glob ('src/runtime/cpu/operators/*.cpp' )
304+
249305if env ['gles_compute' ]:
250306 if env ['os' ] != 'android' :
251307 arm_compute_env .Append (CPPPATH = ["#opengles-3.1/include" , "#opengles-3.1/mali_include" ])
@@ -270,26 +326,30 @@ if env['os'] == 'bare_metal':
270326 bootcode_o = build_bootcode_objs (bootcode_files )
271327Export ('bootcode_o' )
272328
273- arm_compute_core_a = build_library ('arm_compute_core-static' , core_files , static = True )
329+ arm_compute_core_a = build_library ('arm_compute_core-static' , arm_compute_env , core_files , static = True )
274330Export ('arm_compute_core_a' )
275331
276332if env ['os' ] != 'bare_metal' and not env ['standalone' ]:
277- arm_compute_core_so = build_library ('arm_compute_core' , core_files , static = False )
333+ arm_compute_core_so = build_library ('arm_compute_core' , arm_compute_env , core_files , static = False )
278334 Export ('arm_compute_core_so' )
279335
280- arm_compute_a = build_library ('arm_compute-static' , runtime_files , static = True , libs = [ arm_compute_core_a ])
336+ arm_compute_a = build_library ('arm_compute-static' , arm_compute_env , runtime_files , static = True , libs = [ arm_compute_core_a ])
281337Export ('arm_compute_a' )
282338
283339if env ['os' ] != 'bare_metal' and not env ['standalone' ]:
284- arm_compute_so = build_library ('arm_compute' , runtime_files , static = False , libs = [ "arm_compute_core" ])
340+ arm_compute_so = build_library ('arm_compute' , arm_compute_env , runtime_files , static = False , libs = [ "arm_compute_core" ])
285341 Depends (arm_compute_so , arm_compute_core_so )
286342 Export ('arm_compute_so' )
287343
288- arm_compute_graph_a = build_library ('arm_compute_graph-static' , graph_files , static = True , libs = [ arm_compute_a ])
344+ arm_compute_graph_env = arm_compute_env .Clone ()
345+
346+ arm_compute_graph_env .Append (CXXFLAGS = ['-Wno-redundant-move' , '-Wno-pessimizing-move' ])
347+
348+ arm_compute_graph_a = build_library ('arm_compute_graph-static' , arm_compute_graph_env , graph_files , static = True , libs = [ arm_compute_a ])
289349Export ('arm_compute_graph_a' )
290350
291351if env ['os' ] != 'bare_metal' and not env ['standalone' ]:
292- arm_compute_graph_so = build_library ('arm_compute_graph' , graph_files , static = False , libs = [ "arm_compute" , "arm_compute_core" ])
352+ arm_compute_graph_so = build_library ('arm_compute_graph' , arm_compute_graph_env , graph_files , static = False , libs = [ "arm_compute" , "arm_compute_core" ])
293353 Depends (arm_compute_graph_so , arm_compute_so )
294354 Export ('arm_compute_graph_so' )
295355
0 commit comments