LLVM 20.0.0git
|
Namespaces | |
namespace | amdgpu |
Typedefs | |
using | EntryArrayTy = std::pair< GlobalVariable *, GlobalVariable * > |
Enumerations | |
enum | OffloadEntryKindFlag : uint32_t { OffloadGlobalEntry = 0x0 , OffloadGlobalManagedEntry = 0x1 , OffloadGlobalSurfaceEntry = 0x2 , OffloadGlobalTextureEntry = 0x3 , OffloadGlobalExtern = 0x1 << 3 , OffloadGlobalConstant = 0x1 << 4 , OffloadGlobalNormalized = 0x1 << 5 } |
Offloading entry flags for CUDA / HIP. More... | |
Functions | |
llvm::Error | wrapOpenMPBinaries (llvm::Module &M, llvm::ArrayRef< llvm::ArrayRef< char > > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool Relocatable=false) |
Wraps the input device images into the module M as global symbols and registers the images with the OpenMP Offloading runtime libomptarget. | |
llvm::Error | wrapCudaBinary (llvm::Module &M, llvm::ArrayRef< char > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool EmitSurfacesAndTextures=true) |
Wraps the input fatbinary image into the module M as global symbols and registers the images with the CUDA runtime. | |
llvm::Error | wrapHIPBinary (llvm::Module &M, llvm::ArrayRef< char > Images, EntryArrayTy EntryArray, llvm::StringRef Suffix="", bool EmitSurfacesAndTextures=true) |
Wraps the input bundled image into the module M as global symbols and registers the images with the HIP runtime. | |
StructType * | getEntryTy (Module &M) |
Returns the type of the offloading entry we use to store kernels and globals that will be registered with the offloading runtime. | |
void | emitOffloadingEntry (Module &M, Constant *Addr, StringRef Name, uint64_t Size, int32_t Flags, int32_t Data, StringRef SectionName) |
Create an offloading section struct used to register this global at runtime. | |
std::pair< Constant *, GlobalVariable * > | getOffloadingEntryInitializer (Module &M, Constant *Addr, StringRef Name, uint64_t Size, int32_t Flags, int32_t Data) |
Create a constant struct initializer used to register this global at runtime. | |
std::pair< GlobalVariable *, GlobalVariable * > | getOffloadEntryArray (Module &M, StringRef SectionName) |
Creates a pair of globals used to iterate the array of offloading entries by accessing the section variables provided by the linker. | |
using llvm::offloading::EntryArrayTy = typedef std::pair<GlobalVariable *, GlobalVariable *> |
Definition at line 17 of file OffloadWrapper.h.
Offloading entry flags for CUDA / HIP.
The first three bits indicate the type of entry while the others are a bit field for additional information.
void llvm::offloading::emitOffloadingEntry | ( | Module & | M, |
Constant * | Addr, | ||
StringRef | Name, | ||
uint64_t | Size, | ||
int32_t | Flags, | ||
int32_t | Data, | ||
StringRef | SectionName | ||
) |
Create an offloading section struct used to register this global at runtime.
Type struct __tgt_offload_entry { void *addr; // Pointer to the offload entry info. // (function or global) char *name; // Name of the function or global. size_t size; // Size of the entry info (0 if it a function). int32_t flags; int32_t data; };
M | The module to be used |
Addr | The pointer to the global being registered. |
Name | The symbol name associated with the global. |
Size | The size in bytes of the global (0 for functions). |
Flags | Flags associated with the entry. |
Data | Extra data storage associated with the entry. |
SectionName | The section this entry will be placed at. |
Definition at line 77 of file Utility.cpp.
References Addr, getEntryTy(), getOffloadingEntryInitializer(), llvm::Triple::isNVPTX(), llvm::Triple::isOSBinFormatCOFF(), Name, llvm::GlobalValue::NotThreadLocal, Size, and llvm::GlobalValue::WeakAnyLinkage.
Referenced by llvm::OpenMPIRBuilder::createOffloadEntriesAndInfoMetadata(), and llvm::OpenMPIRBuilder::createOffloadEntry().
StructType * llvm::offloading::getEntryTy | ( | Module & | M | ) |
Returns the type of the offloading entry we use to store kernels and globals that will be registered with the offloading runtime.
Definition at line 24 of file Utility.cpp.
References llvm::CallingConv::C, llvm::StructType::create(), llvm::Type::getInt32Ty(), and llvm::StructType::getTypeByName().
Referenced by emitOffloadingEntry(), getOffloadEntryArray(), and getOffloadingEntryInitializer().
std::pair< GlobalVariable *, GlobalVariable * > llvm::offloading::getOffloadEntryArray | ( | Module & | M, |
StringRef | SectionName | ||
) |
Creates a pair of globals used to iterate the array of offloading entries by accessing the section variables provided by the linker.
Definition at line 102 of file Utility.cpp.
References llvm::appendToCompilerUsed(), llvm::GlobalValue::ExternalLinkage, llvm::ConstantAggregateZero::get(), getEntryTy(), llvm::GlobalValue::HiddenVisibility, llvm::Triple::isOSBinFormatCOFF(), llvm::Triple::isOSBinFormatELF(), and llvm::GlobalValue::WeakODRLinkage.
std::pair< Constant *, GlobalVariable * > llvm::offloading::getOffloadingEntryInitializer | ( | Module & | M, |
Constant * | Addr, | ||
StringRef | Name, | ||
uint64_t | Size, | ||
int32_t | Flags, | ||
int32_t | Data | ||
) |
Create a constant struct initializer used to register this global at runtime.
Definition at line 38 of file Utility.cpp.
References llvm::NamedMDNode::addOperand(), Addr, llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::ConstantStruct::get(), getEntryTy(), llvm::Type::getInt32Ty(), llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(), llvm::ConstantDataArray::getString(), llvm::Value::getType(), llvm::GlobalValue::InternalLinkage, llvm::Triple::isNVPTX(), Name, and Size.
Referenced by emitOffloadingEntry().
Error llvm::offloading::wrapCudaBinary | ( | llvm::Module & | M, |
llvm::ArrayRef< char > | Images, | ||
EntryArrayTy | EntryArray, | ||
llvm::StringRef | Suffix = "" , |
||
bool | EmitSurfacesAndTextures = true |
||
) |
Wraps the input fatbinary image into the module M
as global symbols and registers the images with the CUDA runtime.
EntryArray | Optional pair pointing to the __start and __stop symbols holding the __tgt_offload_entry array. |
Suffix | An optional suffix appended to the emitted symbols. |
EmitSurfacesAndTextures | Whether to emit surface and textures registration code. It defaults to false. |
Definition at line 603 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().
Error llvm::offloading::wrapHIPBinary | ( | llvm::Module & | M, |
llvm::ArrayRef< char > | Images, | ||
EntryArrayTy | EntryArray, | ||
llvm::StringRef | Suffix = "" , |
||
bool | EmitSurfacesAndTextures = true |
||
) |
Wraps the input bundled image into the module M
as global symbols and registers the images with the HIP runtime.
EntryArray | Optional pair pointing to the __start and __stop symbols holding the __tgt_offload_entry array. |
Suffix | An optional suffix appended to the emitted symbols. |
EmitSurfacesAndTextures | Whether to emit surface and textures registration code. It defaults to false. |
Definition at line 617 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().
Error llvm::offloading::wrapOpenMPBinaries | ( | llvm::Module & | M, |
llvm::ArrayRef< llvm::ArrayRef< char > > | Images, | ||
EntryArrayTy | EntryArray, | ||
llvm::StringRef | Suffix = "" , |
||
bool | Relocatable = false |
||
) |
Wraps the input device images into the module M
as global symbols and registers the images with the OpenMP Offloading runtime libomptarget.
EntryArray | Optional pair pointing to the __start and __stop symbols holding the __tgt_offload_entry array. |
Suffix | An optional suffix appended to the emitted symbols. |
Relocatable | Indicate if we need to change the offloading section to create a relocatable object. |
Definition at line 591 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().