[Beignet] [PATCH v2 2/9] [OCL20] cl_mem_fence_flags definiton change from MACRO to enum
Song, Ruiling
ruiling.song at intel.com
Mon Feb 29 06:49:34 UTC 2016
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> xionghu.luo at intel.com
> Sent: Thursday, February 25, 2016 12:17 AM
> To: beignet at lists.freedesktop.org
> Cc: Luo, Xionghu <xionghu.luo at intel.com>
> Subject: [Beignet] [PATCH v2 2/9] [OCL20] cl_mem_fence_flags definiton
> change from MACRO to enum
>
> From: Luo Xionghu <xionghu.luo at intel.com>
>
> also add definition for memory_order and memory_scope.
> v2: still use MACRO to define cl_mem_fence_flags as the value could be
> combined like (CLK_GLOBAL_MEM_FENCE|CLK_LOCAL_MEM_FENCE) that the
> enum
> not supported.
>
> 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/ocl_common_defines.h | 6 +-----
> 3 files changed, 31 insertions(+), 9 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..2ff02c5 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
I think you should remove above too lines. Others looks good to me.
Thanks!
Ruiling
> #include "ocl_defines.h"
>
> #define NULL 0
> @@ -84,6 +86,34 @@ DEF(half);
> #undef DEF
>
> /////////////////////////////////////////////////////////////////////////////
> +// OpenCL atomic related types
> +/////////////////////////////////////////////////////////////////////////////
> +//atomic flags
> +#define CLK_LOCAL_MEM_FENCE (1 << 0)
> +#define CLK_GLOBAL_MEM_FENCE (1 << 1)
> +#define CLK_IMAGE_MEM_FENCE (1 << 2)
> +
> +typedef uint 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/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
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list