[llvm-branch-commits] [clang] [llvm] [mlir] [MLIR][OpenMP] Add LLVM translation support for OpenMP UserDefinedMappers (PR #124746)
Sergio Afonso via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Feb 10 09:03:48 PST 2025
================
@@ -4438,14 +4546,49 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
findAllocaInsertPoint(builder, moduleTranslation);
llvm::OpenMPIRBuilder::LocationDescription ompLoc(builder);
+ llvm::OpenMPIRBuilder::TargetDataInfo info(
+ /*RequiresDevicePointerInfo=*/false,
+ /*SeparateBeginEndCalls=*/true);
+ llvm::Value *ifCond = nullptr;
+ if (Value targetIfCond = targetOp.getIfExpr())
+ ifCond = moduleTranslation.lookupValue(targetIfCond);
+
+ auto customMapperCB = [&](unsigned int i) {
+ llvm::Value *mapperFunc = nullptr;
+ if (combinedInfos.Mappers[i]) {
+ info.HasMapper = true;
+ llvm::Expected<llvm::Function *> newFn = getOrCreateUserDefinedMapperFunc(
+ combinedInfos.Mappers[i], builder, moduleTranslation);
+ assert(newFn && "Expect a valid mapper function is available");
+ mapperFunc = *newFn;
+ }
+ return mapperFunc;
+ };
+
+ llvm::OpenMPIRBuilder::TargetDataInfo info(
+ /*RequiresDevicePointerInfo=*/false,
+ /*SeparateBeginEndCalls=*/true);
+
+ auto customMapperCB = [&](unsigned int i) {
+ llvm::Value *mapperFunc = nullptr;
+ if (combinedInfos.Mappers[i]) {
+ info.HasMapper = true;
+ llvm::Expected<llvm::Function *> newFn = getOrCreateUserDefinedMapperFunc(
+ combinedInfos.Mappers[i], builder, moduleTranslation);
+ assert(newFn && "Expect a valid mapper function is available");
+ mapperFunc = *newFn;
+ }
+ return mapperFunc;
+ };
----------------
skatrak wrote:
Looks like this got copy-pasted twice.
https://github.com/llvm/llvm-project/pull/124746
More information about the llvm-branch-commits
mailing list