Skip to content

Commit 8c40bd4

Browse files
committed
Using the monotonic memory order as it is the order used in the more recent nvhpc libraries
1 parent 18120ce commit 8c40bd4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

flang/lib/Optimizer/Builder/IntrinsicCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2584,7 +2584,7 @@ static mlir::Value genAtomBinOp(fir::FirOpBuilder &builder, mlir::Location &loc,
25842584
auto llvmPointerType = mlir::LLVM::LLVMPointerType::get(builder.getContext());
25852585
arg0 = builder.createConvert(loc, llvmPointerType, arg0);
25862586
return builder.create<mlir::LLVM::AtomicRMWOp>(
2587-
loc, binOp, arg0, arg1, mlir::LLVM::AtomicOrdering::seq_cst);
2587+
loc, binOp, arg0, arg1, mlir::LLVM::AtomicOrdering::monotonic);
25882588
}
25892589

25902590
mlir::Value IntrinsicLibrary::genAtomAdd(mlir::Type resultType,

flang/test/Lower/CUDA/cuda-device-proc.cuf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ end
3434
! CHECK: %{{.*}} = fir.call @llvm.nvvm.barrier0.and(%c1_i32_0) fastmath<contract> : (i32) -> i32
3535
! CHECK: %{{.*}} = fir.call @llvm.nvvm.barrier0.popc(%c1_i32_1) fastmath<contract> : (i32) -> i32
3636
! CHECK: %{{.*}} = fir.call @llvm.nvvm.barrier0.or(%c1_i32_2) fastmath<contract> : (i32) -> i32
37-
! CHECK: %{{.*}} = llvm.atomicrmw add %{{.*}}, %{{.*}} seq_cst : !llvm.ptr, i32
38-
! CHECK: %{{.*}} = llvm.atomicrmw add %{{.*}}, %{{.*}} seq_cst : !llvm.ptr, i64
39-
! CHECK: %{{.*}} = llvm.atomicrmw fadd %{{.*}}, %{{.*}} seq_cst : !llvm.ptr, f32
40-
! CHECK: %{{.*}} = llvm.atomicrmw fadd %{{.*}}, %{{.*}} seq_cst : !llvm.ptr, f64
37+
! CHECK: %{{.*}} = llvm.atomicrmw add %{{.*}}, %{{.*}} monotonic : !llvm.ptr, i32
38+
! CHECK: %{{.*}} = llvm.atomicrmw add %{{.*}}, %{{.*}} monotonic : !llvm.ptr, i64
39+
! CHECK: %{{.*}} = llvm.atomicrmw fadd %{{.*}}, %{{.*}} monotonic : !llvm.ptr, f32
40+
! CHECK: %{{.*}} = llvm.atomicrmw fadd %{{.*}}, %{{.*}} monotonic : !llvm.ptr, f64
4141

4242
! CHECK: func.func private @llvm.nvvm.barrier0()
4343
! CHECK: func.func private @__syncwarp(!fir.ref<i32> {cuf.data_attr = #cuf.cuda<device>}) attributes {cuf.proc_attr = #cuf.cuda_proc<device>, fir.bindc_name = "__syncwarp", fir.proc_attrs = #fir.proc_attrs<bind_c>}

0 commit comments

Comments
 (0)