summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libclc/ptx-nvidiacl/lib/SOURCES1
-rw-r--r--libclc/ptx-nvidiacl/lib/mem_fence/fence.cl15
2 files changed, 16 insertions, 0 deletions
diff --git a/libclc/ptx-nvidiacl/lib/SOURCES b/libclc/ptx-nvidiacl/lib/SOURCES
index ce26bcb8557..c92c2a65d9a 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 00000000000..16b039176ec
--- /dev/null
+++ b/libclc/ptx-nvidiacl/lib/mem_fence/fence.cl
@@ -0,0 +1,15 @@
+#include <clc/clc.h>
+
+_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);
+}
OpenPOWER on IntegriCloud