From 9f7aca97f41a1aa683141f14f19f605f122f7561 Mon Sep 17 00:00:00 2001 From: Pablo Marquez Tello Date: Wed, 16 Aug 2023 15:21:44 +0100 Subject: Changes to enable FP16 in armv8a multi_isa * This is the initial patch to start working on enabling fp16 in all multi_isa builds. More changes are required in the way we register the kernels using the macro REGISTER_FP16_NEON. * In this patch we add the capability to build the fp16 files in listed in filelist.json with the correct arch option to enable FP16 * This patch is required towards building an universal multi_isa binary where fp16 is enable. * Enable REGISTER_FP16_NEON macro for all builds by removing __ARM_FEATURE_FP16_VECTOR_ARITHMETIC guard from the macro definition. The macro has to be used across all types of builds. Change-Id: I99f4c273f6ee04cad3c097e5e374200f48568fa9 Signed-off-by: Pablo Marquez Tello Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10682 Tested-by: Arm Jenkins Reviewed-by: Jakub Sujak Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- SConstruct | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index 68c518a4a0..3eee4c0561 100644 --- a/SConstruct +++ b/SConstruct @@ -62,8 +62,14 @@ def read_build_config_json(build_config): def update_data_type_layout_flags(env, data_types, data_layouts): # Manage data-types - if any(i in data_types for i in ['all', 'fp16']): - env.Append(CXXFLAGS = ['-DENABLE_FP16_KERNELS']) + if env['multi_isa']: + if any(i in data_types for i in ['all', 'fp16']): + env.Append(CXXFLAGS = ['-DENABLE_FP16_KERNELS']) + else: + if not 'v8a' in env['arch'] and not 'v7a' in env['arch']: + if any(i in data_types for i in ['all', 'fp16']): + env.Append(CXXFLAGS = ['-DENABLE_FP16_KERNELS']) + if any(i in data_types for i in ['all', 'fp32']): env.Append(CXXFLAGS = ['-DENABLE_FP32_KERNELS']) if any(i in data_types for i in ['all', 'qasymm8']): @@ -112,7 +118,7 @@ vars.AddVariables( BoolVariable("exceptions", "Enable/disable C++ exception support", True), BoolVariable("high_priority", "Generate a library containing only the high priority operators", False), PathVariable("linker_script", "Use an external linker script", "", PathVariable.PathAccept), - PathVariable("external_tests_dir", """Add examples, benchmarks and tests to the tests suite from an external path. In order to use this option, the external tests directory must have the following structure: + PathVariable("external_tests_dir", """Add examples, benchmarks and tests to the tests suite from an external path. In order to use this option, the external tests directory must have the following structure: EXTERNAL_TESTS_DIR: └── tests ├── benchmark @@ -240,7 +246,6 @@ env.Append(CXXFLAGS = ['-DARCH_ARM', if not 'windows' in env['os']: env.Append(CXXFLAGS = ['-Wall','-std=c++14', '-pedantic' ]) -env.Append(CPPDEFINES = ['_GLIBCXX_USE_NANOSLEEP']) cpp_tool = {'linux': 'g++', 'android' : 'clang++', 'tizen': 'g++', 'macos':'clang++', @@ -312,8 +317,7 @@ if env['multi_isa']: Exit(1) 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 + env.Append(CXXFLAGS = ['-march=armv8-a']) else: if 'v8.6-a' in env['arch']: if "disable_mmla_fp" not in env['custom_options']: @@ -536,7 +540,7 @@ if env['standalone']: if not 'windows' in env['os']: env.Append(CXXFLAGS = ['-fPIC']) env.Append(LINKFLAGS = ['-static-libgcc','-static-libstdc++']) - + if env['Werror']: env.Append(CXXFLAGS = ['-Werror']) @@ -597,7 +601,7 @@ if env['debug']: else: env.Append(CXXFLAGS = ['-Z7','-MTd','-fms-compatibility','-fdelayed-template-parsing']) env.Append(LINKFLAGS = ['-DEBUG']) - + env.Append(CPPDEFINES = ['ARM_COMPUTE_DEBUG_ENABLED']) else: if not 'windows' in env['os']: -- cgit v1.2.1