[OpenMP][FIX] The `llvm.amdgcn.s.barrier` is actually not aligned

If we assume `llvm.amdgcn.s.barrier` is aligned we may remove it and
cause OpenMP GPU applications on the AMD GPU to be stuck or wrongly
synchronized.

Reported by Carlo Bertolli.
This commit is contained in:
Johannes Doerfert 2022-02-11 12:22:51 -06:00
parent 87dd3d350c
commit ede248e614
2 changed files with 6 additions and 5 deletions

View File

@ -1458,7 +1458,6 @@ private:
case Intrinsic::nvvm_barrier0_and:
case Intrinsic::nvvm_barrier0_or:
case Intrinsic::nvvm_barrier0_popc:
case Intrinsic::amdgcn_s_barrier:
return true;
default:
break;

View File

@ -66,8 +66,9 @@ define void @pos_empty_6() {
call i32 @llvm.nvvm.barrier0.popc(i32 0)
ret void
}
define void @pos_empty_7() {
; CHECK-LABEL: define {{[^@]+}}@pos_empty_7() {
define void @neg_empty_7() {
; CHECK-LABEL: define {{[^@]+}}@neg_empty_7() {
; CHECK-NEXT: call void @llvm.amdgcn.s.barrier()
; CHECK-NEXT: ret void
;
call void @llvm.amdgcn.s.barrier()
@ -211,6 +212,7 @@ define void @neg_mem() {
define void @pos_multiple() {
; CHECK-LABEL: define {{[^@]+}}@pos_multiple() {
; CHECK-NEXT: call void @llvm.amdgcn.s.barrier()
; CHECK-NEXT: ret void
;
call void @llvm.nvvm.barrier0()
@ -233,7 +235,7 @@ define void @pos_multiple() {
!3 = !{void ()* @pos_empty_4, !"kernel", i32 1}
!4 = !{void ()* @pos_empty_5, !"kernel", i32 1}
!5 = !{void ()* @pos_empty_6, !"kernel", i32 1}
!6 = !{void ()* @pos_empty_7, !"kernel", i32 1}
!6 = !{void ()* @neg_empty_7, !"kernel", i32 1}
!7 = !{void ()* @pos_constant_loads, !"kernel", i32 1}
!8 = !{void ()* @neg_loads, !"kernel", i32 1}
!9 = !{void ()* @pos_priv_mem, !"kernel", i32 1}
@ -254,7 +256,7 @@ define void @pos_multiple() {
; CHECK: [[META5:![0-9]+]] = !{void ()* @pos_empty_4, !"kernel", i32 1}
; CHECK: [[META6:![0-9]+]] = !{void ()* @pos_empty_5, !"kernel", i32 1}
; CHECK: [[META7:![0-9]+]] = !{void ()* @pos_empty_6, !"kernel", i32 1}
; CHECK: [[META8:![0-9]+]] = !{void ()* @pos_empty_7, !"kernel", i32 1}
; CHECK: [[META8:![0-9]+]] = !{void ()* @neg_empty_7, !"kernel", i32 1}
; CHECK: [[META9:![0-9]+]] = !{void ()* @pos_constant_loads, !"kernel", i32 1}
; CHECK: [[META10:![0-9]+]] = !{void ()* @neg_loads, !"kernel", i32 1}
; CHECK: [[META11:![0-9]+]] = !{void ()* @pos_priv_mem, !"kernel", i32 1}