COMPMID-3314: Enable OpenMP in the reference tests

Change-Id: I05b5fedb998317144e0dd13a6377a97207b27f46
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3024
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/tests/validation/reference/FullyConnectedLayer.cpp b/tests/validation/reference/FullyConnectedLayer.cpp
index 9aecd6c..908c583 100644
--- a/tests/validation/reference/FullyConnectedLayer.cpp
+++ b/tests/validation/reference/FullyConnectedLayer.cpp
@@ -49,11 +49,12 @@
     const T *weights_ptr = weights.data();
     const TB *bias_ptr    = bias.data();
     T        *dst_ptr     = dst.data() + offset_dst;
-
+#if defined(_OPENMP)
+    #pragma omp parallel for
+#endif /* _OPENMP */
     for(int y = 0; y < rows_weights; ++y)
     {
-        dst_ptr[y] = std::inner_product(src_ptr, src_ptr + cols_weights, weights_ptr, static_cast<T>(0)) + bias_ptr[y];
-        weights_ptr += cols_weights;
+        dst_ptr[y] = std::inner_product(src_ptr, src_ptr + cols_weights, &weights_ptr[cols_weights * y], static_cast<T>(0)) + bias_ptr[y];
     }
 }
 
@@ -85,7 +86,9 @@
 
     const int min = std::numeric_limits<T>::lowest();
     const int max = std::numeric_limits<T>::max();
-
+#if defined(_OPENMP)
+    #pragma omp parallel for
+#endif /* _OPENMP */
     for(int y = 0; y < rows_weights; ++y)
     {
         // Reset accumulator
@@ -93,7 +96,7 @@
 
         for(int x = 0; x < cols_weights; ++x)
         {
-            acc += (src_ptr[x] + input_offset) * (weights_ptr[x] + weights_offset);
+            acc += (src_ptr[x] + input_offset) * (weights_ptr[x + y * cols_weights] + weights_offset);
         }
 
         // Accumulate the bias
@@ -104,8 +107,6 @@
 
         // Store the result
         dst_ptr[y] = static_cast<T>(acc);
-
-        weights_ptr += cols_weights;
     }
 }
 } // namespace