diff options
Diffstat (limited to 'backend/src/ocl_stdlib.h')
-rw-r--r-- | backend/src/ocl_stdlib.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h index 561599ec..bf22af5f 100644 --- a/backend/src/ocl_stdlib.h +++ b/backend/src/ocl_stdlib.h @@ -420,6 +420,25 @@ INLINE OVERLOADABLE float8 mix(float8 x, float8 y, float a) { return mix(x,y,(fl INLINE OVERLOADABLE float16 mix(float16 x, float16 y, float a) { return mix(x,y,(float16)(a));} ///////////////////////////////////////////////////////////////////////////// +// Synchronization functions +///////////////////////////////////////////////////////////////////////////// +#define CLK_LOCAL_MEM_FENCE (1 << 0) +#define CLK_GLOBAL_MEM_FENCE (1 << 1) + +extern void __gen_ocl_barrier_local(void); +extern void __gen_ocl_barrier_global(void); +extern void __gen_ocl_barrier_local_and_global(void); + +INLINE void barrier(cl_mem_fence_flags flags) { + if (flags == CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE) + __gen_ocl_barrier_local_and_global(); + else if (flags == CLK_LOCAL_MEM_FENCE) + __gen_ocl_barrier_local(); + else if (flags == CLK_GLOBAL_MEM_FENCE) + __gen_ocl_barrier_global(); +} + +///////////////////////////////////////////////////////////////////////////// // Force the compilation to SIMD8 or SIMD16 ///////////////////////////////////////////////////////////////////////////// |