[libclc] r312492 - r600: Cleanup barrier implementation.

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 4 08:52:05 PDT 2017


Author: jvesely
Date: Mon Sep  4 08:52:05 2017
New Revision: 312492

URL: http://llvm.org/viewvc/llvm-project?rev=312492&view=rev
Log:
r600: Cleanup barrier implementation.

We don't have memory fences for r600 so just call group barrier directly
Make sure that barrier is called even with 0 flags

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Aaron Watry <awatry at gmail.com>

Removed:
    libclc/trunk/amdgpu/lib/synchronization/barrier.cl
Modified:
    libclc/trunk/amdgpu/lib/SOURCES
    libclc/trunk/r600/lib/synchronization/barrier_impl.ll

Modified: libclc/trunk/amdgpu/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES?rev=312492&r1=312491&r2=312492&view=diff
==============================================================================
--- libclc/trunk/amdgpu/lib/SOURCES (original)
+++ libclc/trunk/amdgpu/lib/SOURCES Mon Sep  4 08:52:05 2017
@@ -1,7 +1,6 @@
 atomic/atomic.cl
 math/nextafter.cl
 math/sqrt.cl
-synchronization/barrier.cl
 image/get_image_width.cl
 image/get_image_height.cl
 image/get_image_depth.cl

Removed: libclc/trunk/amdgpu/lib/synchronization/barrier.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/synchronization/barrier.cl?rev=312491&view=auto
==============================================================================
--- libclc/trunk/amdgpu/lib/synchronization/barrier.cl (original)
+++ libclc/trunk/amdgpu/lib/synchronization/barrier.cl (removed)
@@ -1,10 +0,0 @@
-
-#include <clc/clc.h>
-
-_CLC_DEF int __clc_clk_local_mem_fence() {
-  return CLK_LOCAL_MEM_FENCE;
-}
-
-_CLC_DEF int __clc_clk_global_mem_fence() {
-  return CLK_GLOBAL_MEM_FENCE;
-}

Modified: libclc/trunk/r600/lib/synchronization/barrier_impl.ll
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/synchronization/barrier_impl.ll?rev=312492&r1=312491&r2=312492&view=diff
==============================================================================
--- libclc/trunk/r600/lib/synchronization/barrier_impl.ll (original)
+++ libclc/trunk/r600/lib/synchronization/barrier_impl.ll Mon Sep  4 08:52:05 2017
@@ -1,32 +1,11 @@
-declare i32 @__clc_clk_local_mem_fence() #1
-declare i32 @__clc_clk_global_mem_fence() #1
 declare void @llvm.r600.group.barrier() #0
 
-define void @barrier(i32 %flags) #2 {
-barrier_local_test:
-  %CLK_LOCAL_MEM_FENCE = call i32 @__clc_clk_local_mem_fence()
-  %0 = and i32 %flags, %CLK_LOCAL_MEM_FENCE
-  %1 = icmp ne i32 %0, 0
-  br i1 %1, label %barrier_local, label %barrier_global_test
-
-barrier_local:
-  call void @llvm.r600.group.barrier()
-  br label %barrier_global_test
-
-barrier_global_test:
-  %CLK_GLOBAL_MEM_FENCE = call i32 @__clc_clk_global_mem_fence()
-  %2 = and i32 %flags, %CLK_GLOBAL_MEM_FENCE
-  %3 = icmp ne i32 %2, 0
-  br i1 %3, label %barrier_global, label %done
-
-barrier_global:
-  call void @llvm.r600.group.barrier()
-  br label %done
-
-done:
+define void @barrier(i32 %flags) #1 {
+entry:
+  ; We should call mem_fence here, but that is not implemented for r600 yet
+  tail call void @llvm.r600.group.barrier()
   ret void
 }
 
 attributes #0 = { nounwind convergent }
-attributes #1 = { nounwind alwaysinline }
-attributes #2 = { nounwind convergent alwaysinline }
+attributes #1 = { nounwind convergent alwaysinline }




More information about the cfe-commits mailing list