From 911d5728fccdabbdf41549c58f0266e49c2aeaf0 Mon Sep 17 00:00:00 2001 From: Sunita Nadampalli Date: Tue, 2 May 2023 14:05:39 +0000 Subject: [scons multi_isa] extend multi_isa build to support armv8-a march This change adds support for multi isa build with armv8-a as the base micro architecture. To enable this, use 'arch=armv8a' and 'multi_isa=1' build flags during scons build. This build option doesn't include fp16 vector arithmetic. To include fp16 vector arithmetic, use 'arch=armv8.2-a' and 'multi_isa=1' build option. Signed-off-by: Sunita Nadampalli Change-Id: Ib5ca61dc65603382baee53b3ec30b2b817beda3c Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9474 Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: SiCong Li Reviewed-by: Viet-Hoa Do Benchmark: Arm Jenkins --- SConscript | 8 ++++++-- SConstruct | 14 +++++++++----- docs/user_guide/library.dox | 4 +++- filedefs.json | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/SConscript b/SConscript index 7ea59d2ef3..c774a55d22 100644 --- a/SConscript +++ b/SConscript @@ -94,8 +94,12 @@ def build_lib_objects(): 'ARM_COMPUTE_ENABLE_I8MM', 'ARM_COMPUTE_ENABLE_SVEF32MM']) # Build all the common files for the base architecture - lib_static_objs += build_obj_list(filedefs["armv8.2-a"], lib_files, static=True) - lib_shared_objs += build_obj_list(filedefs["armv8.2-a"], lib_files, static=False) + if env['arch'] == 'armv8a': + lib_static_objs += build_obj_list(filedefs["armv8-a"], lib_files, static=True) + lib_shared_objs += build_obj_list(filedefs["armv8-a"], lib_files, static=False) + else: + lib_static_objs += build_obj_list(filedefs["armv8.2-a"], lib_files, static=True) + lib_shared_objs += build_obj_list(filedefs["armv8.2-a"], lib_files, static=False) # Build the SVE specific files lib_static_objs += build_obj_list(filedefs["armv8.2-a-sve"], lib_files_sve, static=True) diff --git a/SConstruct b/SConstruct index d6f15c0caf..f6c90c3098 100644 --- a/SConstruct +++ b/SConstruct @@ -98,7 +98,7 @@ vars.AddVariables( BoolVariable("examples", "Build example programs", True), BoolVariable("gemm_tuner", "Build gemm_tuner programs", True), BoolVariable("Werror", "Enable/disable the -Werror compilation flag", True), - BoolVariable("multi_isa", "Build Multi ISA binary version of library. Note works only for armv8.2-a", False), + BoolVariable("multi_isa", "Build Multi ISA binary version of library. Works for armv8a without the support for FP16 vector arithmetic. Use armv8.2-a or beyond to enable FP16 vector arithmetic support", False), BoolVariable("standalone", "Builds the tests as standalone executables, links statically with libgcc, libstdc++ and libarm_compute", False), BoolVariable("opencl", "Enable OpenCL support", True), BoolVariable("neon", "Enable Arm® Neon™ support", False), @@ -306,11 +306,15 @@ if env['multi_isa']: print("Currently Multi ISA binary is only supported for arm v8 family") Exit(1) - if 'v8.6-a' in env['arch']: - if "disable_mmla_fp" not in env['custom_options']: - env.Append(CPPDEFINES = ['ARM_COMPUTE_ENABLE_SVEF32MM']) + if 'v8a' in env['arch']: + print("INFO: multi_isa armv8-a architecture build doesn't enable __ARM_FEATURE_FP16_VECTOR_ARITHMETIC. Use armv8.2-a or beyond to enable FP16 vector arithmetic support") + env.Append(CXXFLAGS = ['-march=armv8-a']) # note: this will disable fp16 extension __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + else: + if 'v8.6-a' in env['arch']: + if "disable_mmla_fp" not in env['custom_options']: + env.Append(CPPDEFINES = ['ARM_COMPUTE_ENABLE_SVEF32MM']) - env.Append(CXXFLAGS = ['-march=armv8.2-a+fp16']) # explicitly enable fp16 extension otherwise __ARM_FEATURE_FP16_VECTOR_ARITHMETIC is undefined + env.Append(CXXFLAGS = ['-march=armv8.2-a+fp16']) # explicitly enable fp16 extension otherwise __ARM_FEATURE_FP16_VECTOR_ARITHMETIC is undefined else: # NONE "multi_isa" builds diff --git a/docs/user_guide/library.dox b/docs/user_guide/library.dox index 0501322254..11948d7136 100644 --- a/docs/user_guide/library.dox +++ b/docs/user_guide/library.dox @@ -570,7 +570,9 @@ The responsibilities of the operators can be summarized as follows: Selecting multi_isa when building Compute Library, will create a library that contains all the supported ISA features. Based on the CPU support, the appropriate kernel will be selected at runtime for execution. Currently this option is -only supported with armv8.2-a as the base architecture. +supported in two configurations: (i) with armv8.2-a as the base architecture where all the supported ISA features are enabled and +(ii) with armv8-a as the base architecture where only a subset of ISA features (everything except FP16 vector arithmetic) +are enabled in the build. @subsection architecture_experimental_per_operator_build Per-operator build diff --git a/filedefs.json b/filedefs.json index 3422eeb252..8ffa3d9cd9 100644 --- a/filedefs.json +++ b/filedefs.json @@ -2,7 +2,7 @@ "cpu": { "arch" : { "armv8-a": { - "cxxflags": ["-march=armv8.2-a"] + "cxxflags": ["-march=armv8-a"] }, "armv8.2-a": { "cxxflags": ["-march=armv8.2-a+fp16"], -- cgit v1.2.1