LLVM: llvm::offloading Namespace Reference (original) (raw)
| 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 llvm::Error | wrapSYCLBinaries (llvm::Module &M, llvm::ArrayRef< char > Buffer, SYCLJITOptions Options=SYCLJITOptions()) |
| Wraps OffloadBinaries in the given Buffers into the module M as global symbols and registers the images with the SYCL 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 GlobalVariable * | 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. |
◆ ByteArray
◆ EntryArrayTy
◆ PropertySet
using llvm::offloading::PropertySet = std::map<std::string, PropertyValue>
◆ PropertySetRegistry
using llvm::offloading::PropertySetRegistry = std::map<std::string, PropertySet>
◆ PropertyValue
◆ OffloadEntryKindFlag
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.
| Enumerator | |
|---|---|
| OffloadGlobalEntry | Mark the entry as a global entry. This indicates the presense of a kernel if the size size field is zero and a variable otherwise. |
| OffloadGlobalManagedEntry | Mark the entry as a managed global variable. |
| OffloadGlobalSurfaceEntry | Mark the entry as a surface variable. |
| OffloadGlobalTextureEntry | Mark the entry as a texture variable. |
| OffloadGlobalExtern | Mark the entry as being extern. |
| OffloadGlobalConstant | Mark the entry as being constant. |
| OffloadGlobalNormalized | Mark the entry as being a normalized surface. |
Definition at line 51 of file Utility.h.
◆ emitOffloadingEntry()
◆ getEntryTy()
◆ getOffloadEntryArray()
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 113 of file Utility.cpp.
References llvm::appendToCompilerUsed(), llvm::GlobalValue::ExternalLinkage, llvm::ArrayType::get(), llvm::ConstantAggregateZero::get(), llvm::object::OffloadBinary::getAlignment(), getEntryTy(), llvm::GlobalValue::HiddenVisibility, llvm::GlobalValue::InternalLinkage, llvm::Triple::isOSBinFormatCOFF(), llvm::Triple::isOSBinFormatELF(), and llvm::GlobalValue::WeakODRLinkage.
◆ getOffloadingEntryInitializer()
Create a constant struct initializer used to register this global at runtime.
Returns
the constant struct and the global variable holding the symbol name.
Definition at line 40 of file Utility.cpp.
References llvm::NamedMDNode::addOperand(), llvm::Data, llvm::ConstantAsMetadata::get(), llvm::ConstantStruct::get(), llvm::MDNode::get(), getEntryTy(), llvm::Type::getInt16Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Constant::getNullValue(), llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(), llvm::ConstantDataArray::getString(), llvm::Value::getType(), llvm::PointerType::getUnqual(), llvm::GlobalValue::Global, llvm::Int32Ty, llvm::GlobalValue::InternalLinkage, llvm::Triple::isNVPTX(), and Size.
Referenced by emitOffloadingEntry().
◆ readPropertiesFromJSON()
◆ wrapCudaBinary()
Wraps the input fatbinary image into the module M as global symbols and registers the images with the CUDA runtime.
Parameters
| 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 1042 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().
◆ wrapHIPBinary()
Wraps the input bundled image into the module M as global symbols and registers the images with the HIP runtime.
Parameters
| 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 1056 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().
◆ wrapOpenMPBinaries()
Wraps the input device images into the module M as global symbols and registers the images with the OpenMP Offloading runtime libomptarget.
Parameters
| 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 1030 of file OffloadWrapper.cpp.
References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::Error::success().