aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Validate.h
diff options
context:
space:
mode:
authorVidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com>2018-05-25 13:21:26 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:52:54 +0000
commitf1f490634f3273e4669f16e663071554df291bea (patch)
tree3e4e39f3aa5a7ef26cd0d01079a971ad949738e4 /arm_compute/core/Validate.h
parent2345f4349761d6c78200f43e1a78289d215825c4 (diff)
downloadComputeLibrary-f1f490634f3273e4669f16e663071554df291bea.tar.gz
COMPMID-655 : Check FP16 is supported by the GPU
Change-Id: I507b04680a4e88426b682bd0be03bccb560ec78d Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/132589 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/core/Validate.h')
-rw-r--r--arm_compute/core/Validate.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/arm_compute/core/Validate.h b/arm_compute/core/Validate.h
index d7a90480fc..4ef94f2c6d 100644
--- a/arm_compute/core/Validate.h
+++ b/arm_compute/core/Validate.h
@@ -804,6 +804,43 @@ inline arm_compute::Status error_on_data_type_channel_not_in(const char *functio
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c, ...) \
ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_data_type_channel_not_in(__func__, __FILE__, __LINE__, t, c, __VA_ARGS__))
+/** Return an error if the data type of the passed tensor info is FP16 and FP16 extension is not supported by the device.
+ *
+ * @param[in] function Function in which the error occurred.
+ * @param[in] file Name of the file where the error occurred.
+ * @param[in] line Line on which the error occurred.
+ * @param[in] tensor_info Tensor info to validate.
+ * @param[in] is_fp16_supported Is fp16 supported by the device.
+ *
+ * @return Status
+ */
+inline arm_compute::Status error_on_unsupported_fp16(const char *function, const char *file, const int line,
+ const ITensorInfo *tensor_info, bool is_fp16_supported)
+{
+ 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 && !is_fp16_supported),
+ function, file, line, "FP16 not supported by the device");
+ return arm_compute::Status{};
+}
+
+/** Return an error if the data type of the passed tensor is FP16 and FP16 extension is not supported by the device.
+ *
+ * @param[in] function Function in which the error occurred.
+ * @param[in] file Name of the file where the error occurred.
+ * @param[in] line Line on which the error occurred.
+ * @param[in] tensor Tensor to validate.
+ * @param[in] is_fp16_supported Is fp16 supported by the device.
+ *
+ * @return Status
+ */
+inline arm_compute::Status error_on_unsupported_fp16(const char *function, const char *file, const int line,
+ const ITensor *tensor, bool is_fp16_supported)
+{
+ ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
+ ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_unsupported_fp16(function, file, line, tensor->info(), is_fp16_supported));
+ return arm_compute::Status{};
+}
+
/** Return an error if the tensor is not 2D.
*
* @param[in] function Function in which the error occurred.