[libclc] 66/291: Implement barrier() builtin
Andreas Beckmann
anbe at moszumanska.debian.org
Tue Sep 8 10:53:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
anbe pushed a commit to branch master
in repository libclc.
commit efd6599fc741c849dfce8e1e312e28fb33857315
Author: Tom Stellard <thomas.stellard at amd.com>
Date: Mon Jul 8 17:26:39 2013 +0000
Implement barrier() builtin
Reviewed and Tested-by: Aaron Watry <awatry at gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185837 91177308-0d34-0410-b5e6-96231b3b80d8
---
r600/lib/SOURCES | 2 ++
r600/lib/synchronization/barrier.cl | 15 +++++++++++++++
r600/lib/synchronization/barrier_impl.ll | 12 ++++++++++++
3 files changed, 29 insertions(+)
diff --git a/r600/lib/SOURCES b/r600/lib/SOURCES
index af8c8c8..16ef3ac 100644
--- a/r600/lib/SOURCES
+++ b/r600/lib/SOURCES
@@ -2,3 +2,5 @@ workitem/get_group_id.ll
workitem/get_local_size.ll
workitem/get_local_id.ll
workitem/get_global_size.ll
+synchronization/barrier.cl
+synchronization/barrier_impl.ll
diff --git a/r600/lib/synchronization/barrier.cl b/r600/lib/synchronization/barrier.cl
new file mode 100644
index 0000000..ac0b4b3
--- /dev/null
+++ b/r600/lib/synchronization/barrier.cl
@@ -0,0 +1,15 @@
+
+#include <clc/clc.h>
+
+void barrier_local(void);
+void barrier_global(void);
+
+void barrier(cl_mem_fence_flags flags) {
+ if (flags & CLK_LOCAL_MEM_FENCE) {
+ barrier_local();
+ }
+
+ if (flags & CLK_GLOBAL_MEM_FENCE) {
+ barrier_global();
+ }
+}
diff --git a/r600/lib/synchronization/barrier_impl.ll b/r600/lib/synchronization/barrier_impl.ll
new file mode 100644
index 0000000..99ac018
--- /dev/null
+++ b/r600/lib/synchronization/barrier_impl.ll
@@ -0,0 +1,12 @@
+declare void @llvm.AMDGPU.barrier.local() nounwind
+declare void @llvm.AMDGPU.barrier.global() nounwind
+
+define void @barrier_local() nounwind alwaysinline {
+ call void @llvm.AMDGPU.barrier.local()
+ ret void
+}
+
+define void @barrier_global() nounwind alwaysinline {
+ call void @llvm.AMDGPU.barrier.global()
+ ret void
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git
More information about the Pkg-opencl-commits
mailing list