[Beignet] [PATCH 4/9] [OCL20] cl_mem_fence_flags definiton change from MACRO to enum
xionghu.luo at intel.com
xionghu.luo at intel.com
Wed Feb 24 15:09:40 UTC 2016
From: Luo Xionghu <xionghu.luo at intel.com>
also add definition for memory_order and memory_scope.
Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
backend/src/libocl/include/ocl_sync.h | 4 ----
backend/src/libocl/include/ocl_types.h | 30 ++++++++++++++++++++++++++++++
backend/src/libocl/src/ocl_barrier.ll | 2 +-
backend/src/ocl_common_defines.h | 6 +-----
4 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/backend/src/libocl/include/ocl_sync.h b/backend/src/libocl/include/ocl_sync.h
index 3e62026..2ea1183 100644
--- a/backend/src/libocl/include/ocl_sync.h
+++ b/backend/src/libocl/include/ocl_sync.h
@@ -23,10 +23,6 @@
/////////////////////////////////////////////////////////////////////////////
// Synchronization functions
/////////////////////////////////////////////////////////////////////////////
-#define CLK_LOCAL_MEM_FENCE (1 << 0)
-#define CLK_GLOBAL_MEM_FENCE (1 << 1)
-
-typedef uint cl_mem_fence_flags;
OVERLOADABLE void barrier(cl_mem_fence_flags flags);
void mem_fence(cl_mem_fence_flags flags);
void read_mem_fence(cl_mem_fence_flags flags);
diff --git a/backend/src/libocl/include/ocl_types.h b/backend/src/libocl/include/ocl_types.h
index eb4c3b4..a5f8e77 100644
--- a/backend/src/libocl/include/ocl_types.h
+++ b/backend/src/libocl/include/ocl_types.h
@@ -20,6 +20,8 @@
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable
#include "ocl_defines.h"
#define NULL 0
@@ -84,6 +86,34 @@ DEF(half);
#undef DEF
/////////////////////////////////////////////////////////////////////////////
+// OpenCL atomic related types
+/////////////////////////////////////////////////////////////////////////////
+//atomic flags
+typedef enum {
+ CLK_LOCAL_MEM_FENCE = 1,
+ CLK_GLOBAL_MEM_FENCE = 1 << 1,
+ CLK_IMAGE_MEM_FENCE = 1 << 2
+}cl_mem_fence_flags;
+
+//memory order
+typedef enum {
+ memory_order_relaxed,
+ memory_order_acquire,
+ memory_order_release,
+ memory_order_acq_rel,
+ memory_order_seq_cst
+} memory_order;
+
+//memory scope
+typedef enum {
+ memory_scope_work_item,
+ memory_scope_work_group,
+ memory_scope_device,
+ memory_scope_all_svm_devices,
+ memory_scope_sub_group,
+} memory_scope;
+
+/////////////////////////////////////////////////////////////////////////////
// OpenCL built-in event types
/////////////////////////////////////////////////////////////////////////////
// FIXME:
diff --git a/backend/src/libocl/src/ocl_barrier.ll b/backend/src/libocl/src/ocl_barrier.ll
index 31087ba..ae76488 100644
--- a/backend/src/libocl/src/ocl_barrier.ll
+++ b/backend/src/libocl/src/ocl_barrier.ll
@@ -13,7 +13,7 @@ declare void @__gen_ocl_barrier_local() nounwind alwaysinline noduplicate
declare void @__gen_ocl_barrier_global() nounwind alwaysinline noduplicate
declare void @__gen_ocl_barrier_local_and_global() nounwind alwaysinline noduplicate
-define void @_Z7barrierj(i32 %flags) nounwind noduplicate alwaysinline {
+define void @_Z7barrier18cl_mem_fence_flags(i32 %flags) nounwind noduplicate alwaysinline {
%1 = icmp eq i32 %flags, 3
br i1 %1, label %barrier_local_global, label %barrier_local_check
diff --git a/backend/src/ocl_common_defines.h b/backend/src/ocl_common_defines.h
index 52f5365..cb9190a 100644
--- a/backend/src/ocl_common_defines.h
+++ b/backend/src/ocl_common_defines.h
@@ -119,8 +119,4 @@ typedef enum clk_sampler_type {
} clk_sampler_type;
-// Memory synchronization
-#define CLK_LOCAL_MEM_FENCE (1 << 0)
-#define CLK_GLOBAL_MEM_FENCE (1 << 1)
-
-#endif /* __OCL_COMMON_DEFINES__ */
\ No newline at end of file
+#endif /* __OCL_COMMON_DEFINES__ */
--
2.1.4
More information about the Beignet
mailing list