Disable Winograd on fp16 if fast-math = false

 - That would force CpuConv2d::get_convolution_method()
   choose GEMM_CONV2D or GEMM methods instead.

Resolves: COMPMID-5531
Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com>
Change-Id: I4dec8772e8c150da003d9a89c1d036057c4d28b0
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8233
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
diff --git a/src/cpu/operators/CpuWinogradConv2d.cpp b/src/cpu/operators/CpuWinogradConv2d.cpp
index 81cf651..c4edd89 100644
--- a/src/cpu/operators/CpuWinogradConv2d.cpp
+++ b/src/cpu/operators/CpuWinogradConv2d.cpp
@@ -163,7 +163,7 @@
                                   const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info, bool enable_fast_math)
 {
     ARM_COMPUTE_ERROR_ON_NULLPTR(src, weights, dst);
-    ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, weights, biases, dst, conv_info));
+    ARM_COMPUTE_ERROR_THROW_ON(validate(src, weights, biases, dst, conv_info, act_info, enable_fast_math));
     ARM_COMPUTE_LOG_PARAMS(src, weights, biases, dst, conv_info, act_info, enable_fast_math);
     ARM_COMPUTE_UNUSED(biases);
     const DataType data_type = src->data_type();
@@ -294,6 +294,12 @@
     ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, weights, dst);
     ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(src, weights, biases, dst, conv_info));
 
+    // Disable winograd for fp16 if fast math is false.
+    if(!enable_fast_math)
+    {
+        ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, DataType::F32);
+    }
+
     const Tensor4DShape              kernel_shape{ internal_get_shape(weights) };
     arm_conv::winograd::WinogradImpl winograd_impl{};