mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 16:50:51 +08:00
Implement barrier() builtin
Reviewed and Tested-by: Aaron Watry <awatry@gmail.com> llvm-svn: 185837
This commit is contained in:
@@ -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
|
||||
|
||||
15
libclc/r600/lib/synchronization/barrier.cl
Normal file
15
libclc/r600/lib/synchronization/barrier.cl
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
12
libclc/r600/lib/synchronization/barrier_impl.ll
Normal file
12
libclc/r600/lib/synchronization/barrier_impl.ll
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user