forked from OSchip/llvm-project
AMDGPU: Add support for amdgpu-unsafe-fp-atomics attribute
If amdgpu-unsafe-fp-atomics is specified, allow {flat|global}_atomic_add_f32 even if atomic modes don't match. Differential Revision: https://reviews.llvm.org/D95391
This commit is contained in:
parent
83e2710eb0
commit
6054a456da
|
@ -11773,7 +11773,9 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
|
|||
unsigned AS = RMW->getPointerAddressSpace();
|
||||
|
||||
if (AS == AMDGPUAS::GLOBAL_ADDRESS && Subtarget->hasAtomicFaddInsts()) {
|
||||
if (!fpModeMatchesGlobalFPAtomicMode(RMW))
|
||||
if (!fpModeMatchesGlobalFPAtomicMode(RMW) ||
|
||||
RMW->getFunction()->getFnAttribute("amdgpu-unsafe-fp-atomics")
|
||||
.getValueAsString() != "true")
|
||||
return AtomicExpansionKind::CmpXChg;
|
||||
|
||||
return RMW->use_empty() ? AtomicExpansionKind::None :
|
||||
|
|
|
@ -61,5 +61,5 @@ define amdgpu_kernel void @global_atomic_fadd_noret_f32_wrong_subtarget(float ad
|
|||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign"}
|
||||
attributes #0 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign" "amdgpu-unsafe-fp-atomics"="true" }
|
||||
attributes #1 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign" "target-cpu"="gfx803" "target-features"="+atomic-fadd-insts" }
|
||||
|
|
|
@ -463,4 +463,4 @@ define double @test_atomicrmw_fadd_f64_local(double addrspace(3)* %ptr, double %
|
|||
ret double %res
|
||||
}
|
||||
|
||||
attributes #0 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign" }
|
||||
attributes #0 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign" "amdgpu-unsafe-fp-atomics"="true" }
|
||||
|
|
Loading…
Reference in New Issue