15#ifndef MLIR_DIALECT_OPENMP_OPENMPOFFLOADUTILS_H_
16#define MLIR_DIALECT_OPENMP_OPENMPOFFLOADUTILS_H_
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/TargetParser/Triple.h"
32 bool openMPThreadSubscription,
bool openMPNoThreadState,
33 bool openMPNoNestedParallelism,
bool openMPIsTargetDevice,
34 bool openMPIsGPU,
bool openMPForceUSM,
35 uint32_t openMPVersion, std::string ompHostIRFile = {},
36 const std::vector<llvm::Triple> &ompTargetTriples = {},
37 bool noGPULib =
false)
65[[maybe_unused]]
static void
68 llvm::dyn_cast<OffloadModuleInterface>(module.getOperation())) {
72 offloadMod.setRequires(ClauseRequires::unified_shared_memory);
81 auto strTriples = llvm::to_vector(
83 return triple.normalize();
85 offloadMod.setTargetTriples(strTriples);
91 module.getOperation()->setAttr(
92 StringAttr::get(module.getContext(), llvm::Twine{"omp.version"}),
93 VersionAttr::get(module.getContext(), version));
98 if (
Attribute verAttr = module->getAttr(
"omp.version"))
99 return llvm::cast<VersionAttr>(verAttr).getVersion();
Attributes are known-constant values of operations.
static void setOffloadModuleInterfaceAttributes(ModuleOp module, OffloadModuleOpts opts)
Sets OpenMP offload module interface attributes on a ModuleOp, shared between Flang and Clang (CIR) f...
static int64_t getOpenMPVersionAttribute(ModuleOp module, int64_t fallback=-1)
static void setOpenMPVersionAttribute(ModuleOp module, int64_t version)
uint32_t OpenMPTargetDebug
std::vector< llvm::Triple > OMPTargetTriples
bool OpenMPIsTargetDevice
bool OpenMPThreadSubscription
OffloadModuleOpts()=default
std::string OMPHostIRFile
OffloadModuleOpts(uint32_t openMPTargetDebug, bool openMPTeamSubscription, bool openMPThreadSubscription, bool openMPNoThreadState, bool openMPNoNestedParallelism, bool openMPIsTargetDevice, bool openMPIsGPU, bool openMPForceUSM, uint32_t openMPVersion, std::string ompHostIRFile={}, const std::vector< llvm::Triple > &ompTargetTriples={}, bool noGPULib=false)
bool OpenMPNoNestedParallelism
bool OpenMPTeamSubscription