From 8e2f64f214fa3ce5834db966222fa3b804e236a2 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Wed, 28 Jul 2021 13:18:46 +0100 Subject: Create custom flags for enabling fp16 support Resolves: COMPMID-4655 Signed-off-by: Georgios Pinitas Change-Id: I1c1398b39da6da089b288d032074b270d87510c4 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6010 Reviewed-by: Pablo Marquez Tello Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/core/CPP/Validate.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/core/CPP') diff --git a/src/core/CPP/Validate.h b/src/core/CPP/Validate.h index 4a97e4789e..df192b5131 100644 --- a/src/core/CPP/Validate.h +++ b/src/core/CPP/Validate.h @@ -41,8 +41,13 @@ namespace arm_compute inline Status error_on_unsupported_cpu_fp16(const char *function, const char *file, const int line, const ITensorInfo *tensor_info) { + bool fp16_kernels_enabled = false; +#if defined(ARM_COMPUTE_ENABLE_FP16) && defined(ENABLE_FP16_KERNELS) + fp16_kernels_enabled = true; +#endif /* defined(ARM_COMPUTE_ENABLE_FP16) && defined(ENABLE_FP16_KERNELS) */ + ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line); - ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((tensor_info->data_type() == DataType::F16) && !CPUInfo::get().has_fp16(), + ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((tensor_info->data_type() == DataType::F16) && (!CPUInfo::get().has_fp16() || !fp16_kernels_enabled), function, file, line, "This CPU architecture does not support F16 data type, you need v8.2 or above"); return Status{}; } @@ -59,8 +64,13 @@ inline Status error_on_unsupported_cpu_fp16(const char *function, const char *fi inline Status error_on_unsupported_cpu_bf16(const char *function, const char *file, const int line, const ITensorInfo *tensor_info) { + bool bf16_kernels_enabled = false; +#if defined(ARM_COMPUTE_ENABLE_BF16) + bf16_kernels_enabled = true; +#endif /* defined(ARM_COMPUTE_ENABLE_BF16) */ + ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line); - ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(tensor_info->data_type() == DataType::BFLOAT16 && !CPUInfo::get().has_bf16(), + ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((tensor_info->data_type() == DataType::BFLOAT16) && (!CPUInfo::get().has_bf16() || !bf16_kernels_enabled), function, file, line, "This CPU architecture does not support BFloat16 data type, you need v8.6 or above"); return Status{}; } -- cgit v1.2.1