LLVM 22.0.0git
|
Namespaces | |
namespace | amdgpu |
namespace | intel |
Classes | |
struct | EntryTy |
This is the record of an object that just be registered with the offloading runtime. More... | |
Typedefs | |
using | EntryArrayTy = std::pair< GlobalVariable *, GlobalVariable * > |
using | ByteArray = SmallVector< unsigned char, 0 > |
using | PropertyValue = std::variant< uint32_t, ByteArray > |
using | PropertySet = std::map< std::string, PropertyValue > |
using | PropertySetRegistry = std::map< std::string, PropertySet > |
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_ABI 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_ABI 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_ABI 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. | |
LLVM_ABI void | writePropertiesToJSON (const PropertySetRegistry &P, raw_ostream &O) |
LLVM_ABI Expected< PropertySetRegistry > | readPropertiesFromJSON (MemoryBufferRef Buf) |
LLVM_ABI 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. | |
LLVM_ABI void | emitOffloadingEntry (Module &M, object::OffloadKind Kind, Constant *Addr, StringRef Name, uint64_t Size, uint32_t Flags, uint64_t Data, Constant *AuxAddr=nullptr, StringRef SectionName="llvm_offload_entries") |
Create an offloading section struct used to register this global at runtime. | |
LLVM_ABI std::pair< Constant *, GlobalVariable * > | getOffloadingEntryInitializer (Module &M, object::OffloadKind Kind, Constant *Addr, StringRef Name, uint64_t Size, uint32_t Flags, uint64_t Data, Constant *AuxAddr) |
Create a constant struct initializer used to register this global at runtime. | |
LLVM_ABI std::pair< GlobalVariable *, GlobalVariable * > | getOffloadEntryArray (Module &M, StringRef SectionName="llvm_offload_entries") |
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::ByteArray = typedef SmallVector<unsigned char, 0> |
Definition at line 25 of file PropertySet.h.
using llvm::offloading::EntryArrayTy = typedef std::pair<GlobalVariable *, GlobalVariable *> |
Definition at line 18 of file OffloadWrapper.h.
using llvm::offloading::PropertySet = typedef std::map<std::string, PropertyValue> |
Definition at line 27 of file PropertySet.h.
using llvm::offloading::PropertySetRegistry = typedef std::map<std::string, PropertySet> |
Definition at line 28 of file PropertySet.h.
using llvm::offloading::PropertyValue = typedef std::variant<uint32_t, ByteArray> |
Definition at line 26 of file PropertySet.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, |
object::OffloadKind | Kind, | ||
Constant * | Addr, | ||
StringRef | Name, | ||
uint64_t | Size, | ||
uint32_t | Flags, | ||
uint64_t | Data, | ||
Constant * | AuxAddr = nullptr , |
||
StringRef | SectionName = "llvm_offload_entries" |
||
) |
Create an offloading section struct used to register this global at runtime.
M | The module to be used |
Addr | The pointer to the global being registered. |
Kind | The offloading language expected to consume this. |
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. |
AuxAddr | An extra pointer if needed. |
Definition at line 85 of file Utility.cpp.
References Addr, llvm::object::OffloadBinary::getAlignment(), 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 26 of file Utility.cpp.
References llvm::CallingConv::C, llvm::StructType::create(), llvm::Type::getInt16Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), and llvm::StructType::getTypeByName().
Referenced by emitOffloadingEntry(), getOffloadEntryArray(), and getOffloadingEntryInitializer().
std::pair< GlobalVariable *, GlobalVariable * > llvm::offloading::getOffloadEntryArray | ( | Module & | M, |
StringRef | SectionName = "llvm_offload_entries" |
||
) |
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 112 of file Utility.cpp.
References llvm::appendToCompilerUsed(), llvm::GlobalValue::ExternalLinkage, llvm::ConstantAggregateZero::get(), llvm::object::OffloadBinary::getAlignment(), getEntryTy(), llvm::GlobalValue::HiddenVisibility, llvm::Triple::isOSBinFormatCOFF(), llvm::Triple::isOSBinFormatELF(), and llvm::GlobalValue::WeakODRLinkage.
std::pair< Constant *, GlobalVariable * > llvm::offloading::getOffloadingEntryInitializer | ( | Module & | M, |
object::OffloadKind | Kind, | ||
Constant * | Addr, | ||
StringRef | Name, | ||
uint64_t | Size, | ||
uint32_t | Flags, | ||
uint64_t | Data, | ||
Constant * | AuxAddr | ||
) |
Create a constant struct initializer used to register this global at runtime.
Definition at line 40 of file Utility.cpp.
References llvm::NamedMDNode::addOperand(), Addr, llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::ConstantStruct::get(), getEntryTy(), llvm::Type::getInt16Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(), llvm::ConstantDataArray::getString(), llvm::Value::getType(), llvm::GlobalValue::InternalLinkage, llvm::Triple::isNVPTX(), Name, and Size.
Referenced by emitOffloadingEntry().
Expected< PropertySetRegistry > llvm::offloading::readPropertiesFromJSON | ( | MemoryBufferRef | Buf | ) |
Definition at line 67 of file PropertySet.cpp.
References assert(), createStringErrorV(), llvm::MemoryBufferRef::getBuffer(), llvm::json::parse(), readPropertyValueFromJSON(), llvm::Expected< T >::takeError(), and llvm::toString().
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 637 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 651 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 625 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().
void llvm::offloading::writePropertiesToJSON | ( | const PropertySetRegistry & | P, |
raw_ostream & | O | ||
) |
Definition at line 17 of file PropertySet.cpp.
References llvm::json::OStream::attributeObject(), and llvm::json::OStream::object().