diff options
Diffstat (limited to 'src/core')
-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{}; } |