[06/15] libocl: Refine the workgroup functions, add signed info.

Submitted by Pan Xiuli on Jan. 21, 2016, 6:51 a.m.

Details

Message ID 1453359115-28123-7-git-send-email-xiuli.pan@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 ) in Beignet

Not browsing as part of any series.

Commit Message

Pan Xiuli Jan. 21, 2016, 6:51 a.m.
From: Junyan He <junyan.he@linux.intel.com>

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
---
 backend/src/libocl/src/ocl_work_group.cl | 114 +++++++++++++++----------------
 1 file changed, 57 insertions(+), 57 deletions(-)

Patch hide | download patch | download mbox

diff --git a/backend/src/libocl/src/ocl_work_group.cl b/backend/src/libocl/src/ocl_work_group.cl
index 065b223..5ad5a8f 100644
--- a/backend/src/libocl/src/ocl_work_group.cl
+++ b/backend/src/libocl/src/ocl_work_group.cl
@@ -51,76 +51,76 @@  BROADCAST_IMPL(double)
 #undef BROADCAST_IMPL
 
 
-#define RANGE_OP(RANGE, OP, GEN_TYPE) \
-    OVERLOADABLE GEN_TYPE __gen_ocl_work_group_##RANGE##_##OP(GEN_TYPE x); \
+#define RANGE_OP(RANGE, OP, GEN_TYPE, SIGN) \
+    OVERLOADABLE GEN_TYPE __gen_ocl_work_group_##RANGE##_##OP(bool sign, GEN_TYPE x); \
     OVERLOADABLE GEN_TYPE work_group_##RANGE##_##OP(GEN_TYPE x) { \
-      return __gen_ocl_work_group_##RANGE##_##OP(x);  \
+      return __gen_ocl_work_group_##RANGE##_##OP(SIGN, x);  \
     }
 
 /* reduce add */
-RANGE_OP(reduce, add, int)
-RANGE_OP(reduce, add, uint)
-RANGE_OP(reduce, add, long)
-RANGE_OP(reduce, add, ulong)
-RANGE_OP(reduce, add, float)
-RANGE_OP(reduce, add, double)
+RANGE_OP(reduce, add, int, true)
+RANGE_OP(reduce, add, uint, false)
+RANGE_OP(reduce, add, long, true)
+RANGE_OP(reduce, add, ulong, false)
+RANGE_OP(reduce, add, float, true)
+RANGE_OP(reduce, add, double, true)
 /* reduce min */
-RANGE_OP(reduce, min, int)
-RANGE_OP(reduce, min, uint)
-RANGE_OP(reduce, min, long)
-RANGE_OP(reduce, min, ulong)
-RANGE_OP(reduce, min, float)
-RANGE_OP(reduce, min, double)
+RANGE_OP(reduce, min, int, true)
+RANGE_OP(reduce, min, uint, false)
+RANGE_OP(reduce, min, long, true)
+RANGE_OP(reduce, min, ulong, false)
+RANGE_OP(reduce, min, float, true)
+RANGE_OP(reduce, min, double, true)
 /* reduce max */
-RANGE_OP(reduce, max, int)
-RANGE_OP(reduce, max, uint)
-RANGE_OP(reduce, max, long)
-RANGE_OP(reduce, max, ulong)
-RANGE_OP(reduce, max, float)
-RANGE_OP(reduce, max, double)
+RANGE_OP(reduce, max, int, true)
+RANGE_OP(reduce, max, uint, false)
+RANGE_OP(reduce, max, long, true)
+RANGE_OP(reduce, max, ulong, false)
+RANGE_OP(reduce, max, float, true)
+RANGE_OP(reduce, max, double, true)
 
 /* scan_inclusive add */
-RANGE_OP(scan_inclusive, add, int)
-RANGE_OP(scan_inclusive, add, uint)
-RANGE_OP(scan_inclusive, add, long)
-RANGE_OP(scan_inclusive, add, ulong)
-RANGE_OP(scan_inclusive, add, float)
-RANGE_OP(scan_inclusive, add, double)
+RANGE_OP(scan_inclusive, add, int, true)
+RANGE_OP(scan_inclusive, add, uint, false)
+RANGE_OP(scan_inclusive, add, long, true)
+RANGE_OP(scan_inclusive, add, ulong, false)
+RANGE_OP(scan_inclusive, add, float, true)
+RANGE_OP(scan_inclusive, add, double, true)
 /* scan_inclusive min */
-RANGE_OP(scan_inclusive, min, int)
-RANGE_OP(scan_inclusive, min, uint)
-RANGE_OP(scan_inclusive, min, long)
-RANGE_OP(scan_inclusive, min, ulong)
-RANGE_OP(scan_inclusive, min, float)
-RANGE_OP(scan_inclusive, min, double)
+RANGE_OP(scan_inclusive, min, int, true)
+RANGE_OP(scan_inclusive, min, uint, false)
+RANGE_OP(scan_inclusive, min, long, true)
+RANGE_OP(scan_inclusive, min, ulong, false)
+RANGE_OP(scan_inclusive, min, float, true)
+RANGE_OP(scan_inclusive, min, double, true)
 /* scan_inclusive max */
-RANGE_OP(scan_inclusive, max, int)
-RANGE_OP(scan_inclusive, max, uint)
-RANGE_OP(scan_inclusive, max, long)
-RANGE_OP(scan_inclusive, max, ulong)
-RANGE_OP(scan_inclusive, max, float)
-RANGE_OP(scan_inclusive, max, double)
+RANGE_OP(scan_inclusive, max, int, true)
+RANGE_OP(scan_inclusive, max, uint, false)
+RANGE_OP(scan_inclusive, max, long, true)
+RANGE_OP(scan_inclusive, max, ulong, false)
+RANGE_OP(scan_inclusive, max, float, true)
+RANGE_OP(scan_inclusive, max, double, true)
 
 /* scan_exclusive add */
-RANGE_OP(scan_exclusive, add, int)
-RANGE_OP(scan_exclusive, add, uint)
-RANGE_OP(scan_exclusive, add, long)
-RANGE_OP(scan_exclusive, add, ulong)
-RANGE_OP(scan_exclusive, add, float)
-RANGE_OP(scan_exclusive, add, double)
+RANGE_OP(scan_exclusive, add, int, true)
+RANGE_OP(scan_exclusive, add, uint, false)
+RANGE_OP(scan_exclusive, add, long, true)
+RANGE_OP(scan_exclusive, add, ulong, false)
+RANGE_OP(scan_exclusive, add, float, true)
+RANGE_OP(scan_exclusive, add, double, true)
 /* scan_exclusive min */
-RANGE_OP(scan_exclusive, min, int)
-RANGE_OP(scan_exclusive, min, uint)
-RANGE_OP(scan_exclusive, min, long)
-RANGE_OP(scan_exclusive, min, ulong)
-RANGE_OP(scan_exclusive, min, float)
-RANGE_OP(scan_exclusive, min, double)
+RANGE_OP(scan_exclusive, min, int, true)
+RANGE_OP(scan_exclusive, min, uint, false)
+RANGE_OP(scan_exclusive, min, long, true)
+RANGE_OP(scan_exclusive, min, ulong, false)
+RANGE_OP(scan_exclusive, min, float, true)
+RANGE_OP(scan_exclusive, min, double, true)
 /* scan_exclusive max */
-RANGE_OP(scan_exclusive, max, int)
-RANGE_OP(scan_exclusive, max, uint)
-RANGE_OP(scan_exclusive, max, long)
-RANGE_OP(scan_exclusive, max, ulong)
-RANGE_OP(scan_exclusive, max, float)
-RANGE_OP(scan_exclusive, max, double)
+RANGE_OP(scan_exclusive, max, int, true)
+RANGE_OP(scan_exclusive, max, uint, false)
+RANGE_OP(scan_exclusive, max, long, true)
+RANGE_OP(scan_exclusive, max, ulong, false)
+RANGE_OP(scan_exclusive, max, float, true)
+RANGE_OP(scan_exclusive, max, double, true)
 
 #undef RANGE_OP