diff --git a/libclc/ptx-nvidiacl/lib/SOURCES b/libclc/ptx-nvidiacl/lib/SOURCES index ce26bcb8557e..c92c2a65d9ab 100644 --- a/libclc/ptx-nvidiacl/lib/SOURCES +++ b/libclc/ptx-nvidiacl/lib/SOURCES @@ -1,3 +1,4 @@ +mem_fence/fence.cl synchronization/barrier.cl workitem/get_global_id.cl workitem/get_group_id.cl diff --git a/libclc/ptx-nvidiacl/lib/mem_fence/fence.cl b/libclc/ptx-nvidiacl/lib/mem_fence/fence.cl new file mode 100644 index 000000000000..16b039176ece --- /dev/null +++ b/libclc/ptx-nvidiacl/lib/mem_fence/fence.cl @@ -0,0 +1,15 @@ +#include + +_CLC_DEF void mem_fence(cl_mem_fence_flags flags) { + if (flags & (CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE)) + __nvvm_membar_cta(); +} + +// We do not have separate mechanism for read and write fences. +_CLC_DEF void read_mem_fence(cl_mem_fence_flags flags) { + mem_fence(flags); +} + +_CLC_DEF void write_mem_fence(cl_mem_fence_flags flags) { + mem_fence(flags); +}