[flang-commits] [flang] [Flang] Adding atomicadd as a cudadevice intrinsic and converting it LLVM dialect (PR #123840)

via flang-commits flang-commits at lists.llvm.org
Wed Jan 22 01:45:54 PST 2025


================
@@ -2574,6 +2578,26 @@ mlir::Value IntrinsicLibrary::genAtanpi(mlir::Type resultType,
   return builder.create<mlir::arith::MulFOp>(loc, atan, factor);
 }
 
+static mlir::Value genAtomBinOp(fir::FirOpBuilder &builder, mlir::Location &loc,
+                                mlir::LLVM::AtomicBinOp binOp, mlir::Value arg0,
+                                mlir::Value arg1) {
+  auto llvmPointerType = mlir::LLVM::LLVMPointerType::get(builder.getContext());
----------------
jeanPerier wrote:

Out of curiosity, do you now if FIR alias analysis is clever enough to go through convert from this LLVM type and deduce what the `llvm.atomicrmw` is reading/writing not (or mainly, to deduce what it is not reading/writing to)?

It makes sense to me that we interoperate with LLVM pointer type to avoid redefining all the intrinsics at the FIR level, I just wonder if we need to improve AA here.

https://github.com/llvm/llvm-project/pull/123840


More information about the flang-commits mailing list