mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-03 13:51:39 +00:00
AMDGPU: mark llvm.amdgcn.image.atomic.* as a source of divergence
Summary: When multiple threads perform an atomic op with the same arguments, they will usually see different return values. Reviewers: arsenm, tstellarAMD Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D18101 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263440 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5fd81f79b8
commit
555e806a6f
@ -126,6 +126,19 @@ static bool isIntrinsicSourceOfDivergence(const TargetIntrinsicInfo *TII,
|
|||||||
case Intrinsic::r600_read_tidig_x:
|
case Intrinsic::r600_read_tidig_x:
|
||||||
case Intrinsic::r600_read_tidig_y:
|
case Intrinsic::r600_read_tidig_y:
|
||||||
case Intrinsic::r600_read_tidig_z:
|
case Intrinsic::r600_read_tidig_z:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_swap:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_add:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_sub:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_smin:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_umin:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_smax:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_umax:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_and:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_or:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_xor:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_inc:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_dec:
|
||||||
|
case Intrinsic::amdgcn_image_atomic_cmpswap:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
;RUN: opt -mtriple=amdgcn-mesa-mesa3d -analyze -divergence %s | FileCheck %s
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.swap.i32(
|
||||||
|
define float @image_atomic_swap(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.swap.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.add.i32(
|
||||||
|
define float @image_atomic_add(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.add.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.sub.i32(
|
||||||
|
define float @image_atomic_sub(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.sub.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.smin.i32(
|
||||||
|
define float @image_atomic_smin(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.smin.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.umin.i32(
|
||||||
|
define float @image_atomic_umin(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.umin.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.smax.i32(
|
||||||
|
define float @image_atomic_smax(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.smax.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.umax.i32(
|
||||||
|
define float @image_atomic_umax(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.umax.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.and.i32(
|
||||||
|
define float @image_atomic_and(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.and.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.or.i32(
|
||||||
|
define float @image_atomic_or(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.or.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.xor.i32(
|
||||||
|
define float @image_atomic_xor(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.xor.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.inc.i32(
|
||||||
|
define float @image_atomic_inc(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.inc.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.dec.i32(
|
||||||
|
define float @image_atomic_dec(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.dec.i32(i32 %data, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
;CHECK: DIVERGENT: %orig = call i32 @llvm.amdgcn.image.atomic.cmpswap.i32(
|
||||||
|
define float @image_atomic_cmpswap(<8 x i32> inreg %rsrc, i32 inreg %addr, i32 inreg %data, i32 inreg %cmp) #0 {
|
||||||
|
main_body:
|
||||||
|
%orig = call i32 @llvm.amdgcn.image.atomic.cmpswap.i32(i32 %data, i32 %cmp, i32 %addr, <8 x i32> %rsrc, i1 0, i1 0, i1 0)
|
||||||
|
%r = bitcast i32 %orig to float
|
||||||
|
ret float %r
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.swap.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.add.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.sub.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.smin.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.umin.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.smax.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.umax.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.and.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.or.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.xor.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.inc.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.dec.i32(i32, i32, <8 x i32>, i1, i1, i1) #1
|
||||||
|
declare i32 @llvm.amdgcn.image.atomic.cmpswap.i32(i32, i32, i32, <8 x i32>,i1, i1, i1) #1
|
||||||
|
|
||||||
|
attributes #0 = { "ShaderType"="0" }
|
||||||
|
attributes #1 = { nounwind }
|
Loading…
x
Reference in New Issue
Block a user