[llvm-branch-commits] [Flang][OpenMP][MLIR] Extend derived (record) type map support in Flang OpenMP by adding some initial support for explicit member mapping (PR #81511)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Feb 13 06:44:13 PST 2024
================
@@ -1841,14 +1867,112 @@ createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc,
llvm::cast<mlir::omp::PointerLikeType>(retTy).getElementType());
mlir::omp::MapInfoOp op = builder.create<mlir::omp::MapInfoOp>(
- loc, retTy, baseAddr, varType, varPtrPtr, members, bounds,
+ loc, retTy, baseAddr, varType, varPtrPtr, members, membersIndex, bounds,
builder.getIntegerAttr(builder.getIntegerType(64, false), mapType),
builder.getAttr<mlir::omp::VariableCaptureKindAttr>(mapCaptureType),
- builder.getStringAttr(name));
+ builder.getStringAttr(name), builder.getBoolAttr(partialMap));
return op;
}
+int findComponenetMemberPlacement(
+ const Fortran::semantics::Symbol *dTypeSym,
+ const Fortran::semantics::Symbol *componentSym) {
+ int placement = -1;
+ if (const auto *derived{
+ dTypeSym->detailsIf<Fortran::semantics::DerivedTypeDetails>()}) {
+ for (auto t : derived->componentNames()) {
+ placement++;
+ if (t == componentSym->name())
+ return placement;
+ }
+ }
+ return placement;
+}
+
+static void
+checkAndApplyDeclTargetMapFlags(Fortran::lower::AbstractConverter &converter,
+ llvm::omp::OpenMPOffloadMappingFlags &mapFlags,
+ Fortran::semantics::Symbol *symbol) {
+ mlir::Operation *op =
+ converter.getModuleOp().lookupSymbol(converter.mangleName(*symbol));
+ if (op)
+ if (auto declareTargetOp =
+ llvm::dyn_cast<mlir::omp::DeclareTargetInterface>(op)) {
+ // only Link clauses have OMP_MAP_PTR_AND_OBJ applied, To clause
+ // functions fairly different.
+ if (declareTargetOp.getDeclareTargetCaptureClause() ==
+ mlir::omp::DeclareTargetCaptureClause::link)
+ mapFlags |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_PTR_AND_OBJ;
+ }
+}
+
+static void insertChildMapInfoIntoParent(
+ Fortran::lower::AbstractConverter &converter,
+ llvm::SmallVector<const Fortran::semantics::Symbol *> &memberParentSyms,
+ llvm::SmallVector<mlir::Value> &memberMaps,
----------------
agozillon wrote:
No reason from what I recall, we just tend to pass things around as mlir::Value's (and I've gotten complacent with it I imagine) perhaps as it makes it easier to pass things around as we tend to use the more generalised mlir::Value most places as opposed to the operation itself. However, I'll see what I can do!
https://github.com/llvm/llvm-project/pull/81511
More information about the llvm-branch-commits
mailing list