COMPMID-2278: Implement REDUCE_MAX operator for CL.

Change-Id: Ie23e3ddc45d6f5506a63f935758a215ba7412bf5
Signed-off-by: Usama Arif <usama.arif@arm.com>
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/186031
Tested-by: bsgcomp <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Comments-Addressed: bsgcomp <bsgcomp@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1214
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/src/core/CL/cl_kernels/reduction_operation.cl b/src/core/CL/cl_kernels/reduction_operation.cl
index 86cf37e..5a4bb9f 100644
--- a/src/core/CL/cl_kernels/reduction_operation.cl
+++ b/src/core/CL/cl_kernels/reduction_operation.cl
@@ -198,7 +198,9 @@
         indx = select(indx, x, ISLESS(in, res));
         res  = select(res, in, CONVERT(ISLESS(in, res), COND_DATA_TYPE));
 #elif defined(MIN)
-        res  = select(res, in, CONVERT(ISLESS(in, res), COND_DATA_TYPE));
+        res = select(res, in, CONVERT(ISLESS(in, res), COND_DATA_TYPE));
+#elif defined(MAX)
+        res = select(res, in, CONVERT(ISGREATER(in, res), COND_DATA_TYPE));
 #else  // !(defined(ARG_MAX) || defined(ARG_MIN))
         res += in;
 #endif // defined(ARG_MAX) || defined(ARG_MIN)
@@ -211,11 +213,11 @@
 #if defined(MEAN)
     res /= WIDTH;
 #endif // defined(MEAN)
-#if defined(MIN)
+#if defined(MIN) || defined(MAX)
     *((__global DATA_TYPE_PROMOTED *)output.ptr) = res;
-#else // defined(MIN)
+#else  // defined(MIN) || defined(MAX)
     *((__global uchar *)output.ptr) = convert_uchar(res);
-#endif // defined(MIN)
+#endif // defined(MIN) || defined(MAX)
 #endif // defined(ARG_MAX) || defined(ARG_MIN)
 }
 #endif // defined(WIDTH)
@@ -266,11 +268,13 @@
         indx             = select(indx, y, cond_conv);
         res              = select(res, in, ISGREATER(in, res));
 #elif defined(ARG_MIN)
-        uint16  cond_conv           = CONVERT(ISLESS(in, res), uint16);
-        indx                        = select(indx, y, cond_conv);
-        res                         = select(res, in, ISLESS(in, res));
+        uint16 cond_conv                         = CONVERT(ISLESS(in, res), uint16);
+        indx                                     = select(indx, y, cond_conv);
+        res                                      = select(res, in, ISLESS(in, res));
 #elif defined(MIN)
-        res                         = select(res, in, ISLESS(in, res));
+        res = select(res, in, ISLESS(in, res));
+#elif defined(MAX)
+        res = select(res, in, ISGREATER(in, res));
 #else // !(defined(ARG_MAX) || defined(ARG_MIN))
 #if defined(SUM_SQUARE)
         in *= in;
@@ -359,7 +363,9 @@
         indx             = select(indx, z, cond_conv);
         res              = select(res, in, ISLESS(in, res));
 #elif defined(MIN)
-        res              = select(res, in, ISLESS(in, res));
+        res = select(res, in, ISLESS(in, res));
+#elif defined(MAX)
+        res = select(res, in, ISGREATER(in, res));
 #else // !(defined(ARG_MAX) || defined(ARG_MIN))
 #if defined(SUM_SQUARE)
         in *= in;
@@ -450,7 +456,9 @@
         indx             = select(indx, w, cond_conv);
         res              = select(res, in, ISLESS(in, res));
 #elif defined(MIN)
-        res              = select(res, in, ISLESS(in, res));
+        res = select(res, in, ISLESS(in, res));
+#elif defined(MAX)
+        res = select(res, in, ISGREATER(in, res));
 #else // !(defined(ARG_MAX) || defined(ARG_MIN))
 #if defined(SUM_SQUARE)
         in *= in;