diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-07-28 13:18:46 +0100 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-07-28 17:25:14 +0000 |
commit | 8e2f64f214fa3ce5834db966222fa3b804e236a2 (patch) | |
tree | a5259b9930a6791ce2d7c01403c4376b12f2080a /src/core/CPP | |
parent | a86433a64ab25c2ea8e274bd2f357a9709636f5b (diff) | |
download | ComputeLibrary-8e2f64f214fa3ce5834db966222fa3b804e236a2.tar.gz |
Create custom flags for enabling fp16 support
Resolves: COMPMID-4655
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I1c1398b39da6da089b288d032074b270d87510c4
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6010
Reviewed-by: Pablo Marquez Tello <pablo.tello@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CPP')
-rw-r--r-- | src/core/CPP/Validate.h | 14 |
1 files changed, 12 insertions, 2 deletions
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{}; } |