9#ifndef LLVM_FRONTEND_OFFLOADING_UTILITY_H
10#define LLVM_FRONTEND_OFFLOADING_UTILITY_H
101LLVM_ABI std::pair<Constant *, GlobalVariable *>
108LLVM_ABI std::pair<GlobalVariable *, GlobalVariable *>
130 std::numeric_limits<uint32_t>::max();
211 "symbols blob smaller than header");
212 const char *
Base = Symbols.data();
214 const auto *Entries =
reinterpret_cast<const SymbolTableEntry *
>(&Header + 1);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
Module.h This file contains the declarations for the Module class.
This file defines the SmallString class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an important base class in LLVM.
Lightweight error class with error context and mandatory checking.
This class implements a map that also provides access to all stored values in a deterministic order.
A Module instance is used to store all the information related to an LLVM module.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
Class to represent struct types.
Triple - Helper class for working with autoconf configuration names.
OffloadKind
The producer of the associated offloading image.
ImageKind
The type of contents the offloading image contains.
LLVM_ABI Error getAMDGPUMetaDataFromImage(MemoryBufferRef MemBuffer, StringMap< AMDGPUKernelMetaData > &KernelInfoMap, uint16_t &ELFABIVersion)
Reads AMDGPU specific metadata from the ELF file and propagates the KernelInfoMap.
LLVM_ABI bool isImageCompatibleWithEnv(StringRef ImageArch, uint32_t ImageFlags, StringRef EnvTargetID)
Check if an image is compatible with current system's environment.
LLVM_ABI Error containerizeOpenMPSPIRVImage(std::unique_ptr< MemoryBuffer > &Binary, llvm::Triple Triple, StringRef CompileOpts="", StringRef LinkOpts="")
Containerizes an OpenMP SPIR-V image into an OffloadBinary image.
LLVM_ABI void writeSymbolTable(ArrayRef< StringRef > Names, SmallString< 0 > &Out)
Serialize Names into Out.
void forEachSymbol(StringRef Symbols, Fn &&Callback)
Invoke Callback with a StringRef for each symbol in Symbols, the raw serialized symbol-table blob.
LLVM_ABI Error containerizeImage(std::unique_ptr< MemoryBuffer > &Binary, llvm::Triple Triple, object::ImageKind ImageKind, object::OffloadKind OffloadKind, int32_t ImageFlags, MapVector< StringRef, StringRef > &MetaData)
Containerizes an image within an OffloadBinary image.
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 StructType * getEntryTy(Module &M)
Returns the type of the offloading entry we use to store kernels and globals that will be registered ...
OffloadEntryKindFlag
Offloading entry flags for CUDA / HIP.
@ OffloadGlobalSurfaceEntry
Mark the entry as a surface variable.
@ OffloadGlobalTextureEntry
Mark the entry as a texture variable.
@ OffloadGlobalNormalized
Mark the entry as being a normalized surface.
@ OffloadGlobalEntry
Mark the entry as a global entry.
@ OffloadGlobalManagedEntry
Mark the entry as a managed global variable.
@ OffloadGlobalExtern
Mark the entry as being extern.
@ OffloadGlobalConstant
Mark the entry as being constant.
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)
LLVM_ABI std::pair< GlobalVariable *, GlobalVariable * > getOffloadEntryArray(Module &M)
Creates a pair of globals used to iterate the array of offloading entries by accessing the section va...
LLVM_ABI StringRef getOffloadEntrySection(Module &M)
Create an offloading section struct used to register this global at runtime.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
This is the record of an object that just be registered with the offloading runtime.
void * Address
The address of the global to be registered by the runtime.
uint64_t Size
The number of bytes the symbol takes.
uint16_t Kind
The expected consumer of this entry, e.g. CUDA or OpenMP.
char * SymbolName
The name of the symbol in the device image.
uint32_t Flags
Flags associated with the global.
uint64_t Reserved
Reserved bytes used to detect an older version of the struct, always zero.
uint16_t Version
The current version of the struct for runtime forward compatibility.
void * AuxAddr
An extra pointer, usually null.
uint64_t Data
Extra generic data used to register this entry.
uint32_t OffsetToSymbol
Byte offset from blob start to the symbol name.
uint32_t SymbolSize
Length of the symbol name in bytes, excluding the null terminator.