diff options
author | Andrew Gozillon <Andrew.Gozillon@amd.com> | 2023-05-16 11:22:22 -0500 |
---|---|---|
committer | Andrew Gozillon <Andrew.Gozillon@amd.com> | 2023-05-16 11:51:36 -0500 |
commit | 48c3ae5cc3d4612283018ea597db3f7214aabfd9 (patch) | |
tree | 6012171fcc9f648ad03ce258838aaa273ded3b02 /mlir | |
parent | e47fbb7cd2d22b787d1022fd2f3bef4a051d67c8 (diff) | |
download | llvm-48c3ae5cc3d4612283018ea597db3f7214aabfd9.tar.gz |
[Clang][Flang][OpenMP] Add loadOffloadInfoMetadata and createOffloadEntriesAndInfoMetadata into OMPIRBuilder's finalize and initialize
This allows the generation of OpenMP offload metadata for the OpenMP
dialect when lowering to LLVM-IR and moves some of the shared logic
between the OpenMP Dialect and Clang into the IRBuilder.
Reviewers: jsjodin, jdoerfert, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D148370
Diffstat (limited to 'mlir')
-rw-r--r-- | mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp index 70171e77eab9..864095fa3464 100644 --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -1274,19 +1274,23 @@ SmallVector<llvm::Value *> ModuleTranslation::lookupValues(ValueRange values) { llvm::OpenMPIRBuilder *ModuleTranslation::getOpenMPBuilder() { if (!ompBuilder) { ompBuilder = std::make_unique<llvm::OpenMPIRBuilder>(*llvmModule); - ompBuilder->initialize(); bool isDevice = false; + llvm::StringRef hostIRFilePath = ""; if (auto offloadMod = - dyn_cast<mlir::omp::OffloadModuleInterface>(mlirModule)) + dyn_cast<mlir::omp::OffloadModuleInterface>(mlirModule)) { isDevice = offloadMod.getIsDevice(); + hostIRFilePath = offloadMod.getHostIRFilePath(); + } + + ompBuilder->initialize(hostIRFilePath); // TODO: set the flags when available - llvm::OpenMPIRBuilderConfig Config( + llvm::OpenMPIRBuilderConfig config( isDevice, /* IsTargetCodegen */ false, /* HasRequiresUnifiedSharedMemory */ false, /* OpenMPOffloadMandatory */ false); - ompBuilder->setConfig(Config); + ompBuilder->setConfig(config); } return ompBuilder.get(); } |