|
MLIR 24.0.0git
|
This class serves as an opaque interface for passing options to the TargetAttrInterface methods. More...
#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h"
Public Member Functions | |
| TargetOptions (StringRef toolkitPath={}, ArrayRef< Attribute > librariesToLink={}, StringRef cmdOptions={}, StringRef elfSection={}, CompilationTarget compilationTarget=getDefaultCompilationTarget(), function_ref< SymbolTable *()> getSymbolTableCallback={}, function_ref< void(llvm::Module &)> initialLlvmIRCallback={}, function_ref< void(llvm::Module &)> linkedLlvmIRCallback={}, function_ref< void(llvm::Module &)> optimizedLlvmIRCallback={}, function_ref< void(StringRef)> isaCallback={}) | |
| Constructor initializing the toolkit path, the list of files to link to, extra command line options, the compilation target and a callback for obtaining the parent symbol table. | |
| TypeID | getTypeID () const |
| Returns the typeID. | |
| StringRef | getToolkitPath () const |
| Returns the toolkit path. | |
| ArrayRef< Attribute > | getLibrariesToLink () const |
| Returns the LLVM libraries to link to. | |
| StringRef | getCmdOptions () const |
| Returns the command line options. | |
| StringRef | getELFSection () const |
| Returns the ELF section. | |
| std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > | tokenizeCmdOptions () const |
| Returns a tokenization of the command line options. | |
| std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > | tokenizeAndRemoveSuffixCmdOptions (llvm::StringRef startsWith) |
| Returns a tokenization of the substr of the command line options that starts with startsWith and ends with end of the command line options and consumes it. | |
| CompilationTarget | getCompilationTarget () const |
| Returns the compilation target. | |
| SymbolTable * | getSymbolTable () const |
| Returns the result of the getSymbolTableCallback callback or a nullptr if no callback was provided. | |
| function_ref< void(llvm::Module &)> | getInitialLlvmIRCallback () const |
| Returns the callback invoked with the initial LLVM IR for the device module. | |
| function_ref< void(llvm::Module &)> | getLinkedLlvmIRCallback () const |
| Returns the callback invoked with LLVM IR for the device module after linking the device libraries. | |
| function_ref< void(llvm::Module &)> | getOptimizedLlvmIRCallback () const |
| Returns the callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen. | |
| function_ref< void(StringRef)> | getISACallback () const |
| Returns the callback invoked with the target ISA for the device, for example PTX assembly. | |
| const llvm::cl::LibraryOptionsContext * | getLibraryOptions () const |
| Returns the LLVM library options for the LLVMContext and TargetMachine that serialization creates, or nullptr for their defaults. | |
| void | setLibraryOptions (const llvm::cl::LibraryOptionsContext *options) |
| Sets the LLVM library options. They must outlive the serialization. | |
Static Public Member Functions | |
| static CompilationTarget | getDefaultCompilationTarget () |
| Returns the default compilation target: CompilationTarget::Fatbin. | |
| static std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > | tokenizeCmdOptions (const std::string &cmdOptions) |
| Returns a tokenization of the command line options. | |
Protected Member Functions | |
| TargetOptions (TypeID typeID, StringRef toolkitPath={}, ArrayRef< Attribute > librariesToLink={}, StringRef cmdOptions={}, StringRef elfSection={}, CompilationTarget compilationTarget=getDefaultCompilationTarget(), function_ref< SymbolTable *()> getSymbolTableCallback={}, function_ref< void(llvm::Module &)> initialLlvmIRCallback={}, function_ref< void(llvm::Module &)> linkedLlvmIRCallback={}, function_ref< void(llvm::Module &)> optimizedLlvmIRCallback={}, function_ref< void(StringRef)> isaCallback={}) | |
| Derived classes must use this constructor to initialize typeID to the appropiate value: ie. | |
Protected Attributes | |
| std::string | toolkitPath |
| Path to the target toolkit. | |
| SmallVector< Attribute > | librariesToLink |
| List of files to link with the LLVM module. | |
| std::string | cmdOptions |
| An optional set of command line options to be used by the compilation process. | |
| std::string | elfSection |
| ELF Section where the binary needs to be located. | |
| CompilationTarget | compilationTarget |
| Compilation process target format. | |
| function_ref< SymbolTable *()> | getSymbolTableCallback |
| Callback for obtaining the parent symbol table of all the GPU modules being serialized. | |
| function_ref< void(llvm::Module &)> | initialLlvmIRCallback |
| Callback invoked with the initial LLVM IR for the device module. | |
| function_ref< void(llvm::Module &)> | linkedLlvmIRCallback |
| Callback invoked with LLVM IR for the device module after linking the device libraries. | |
| function_ref< void(llvm::Module &)> | optimizedLlvmIRCallback |
| Callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen. | |
| function_ref< void(StringRef)> | isaCallback |
| Callback invoked with the target ISA for the device, for example PTX assembly. | |
| const llvm::cl::LibraryOptionsContext * | libraryOptions = nullptr |
This class serves as an opaque interface for passing options to the TargetAttrInterface methods.
Users of this class must implement the classof method as well as using the macros MLIR_*_EXPLICIT_TYPE_ID to ensure type safeness. Targets are free to ignore these options.
Definition at line 51 of file CompilationInterfaces.h.
| TargetOptions::TargetOptions | ( | StringRef | toolkitPath = {}, |
| ArrayRef< Attribute > | librariesToLink = {}, | ||
| StringRef | cmdOptions = {}, | ||
| StringRef | elfSection = {}, | ||
| CompilationTarget | compilationTarget = getDefaultCompilationTarget(), | ||
| function_ref< SymbolTable *()> | getSymbolTableCallback = {}, | ||
| function_ref< void(llvm::Module &)> | initialLlvmIRCallback = {}, | ||
| function_ref< void(llvm::Module &)> | linkedLlvmIRCallback = {}, | ||
| function_ref< void(llvm::Module &)> | optimizedLlvmIRCallback = {}, | ||
| function_ref< void(StringRef)> | isaCallback = {} ) |
Constructor initializing the toolkit path, the list of files to link to, extra command line options, the compilation target and a callback for obtaining the parent symbol table.
The default compilation target is Fatbin.
Definition at line 374 of file GPUBase.cpp.
References cmdOptions, compilationTarget, elfSection, mlir::get(), getSymbolTableCallback, initialLlvmIRCallback, isaCallback, librariesToLink, linkedLlvmIRCallback, optimizedLlvmIRCallback, TargetOptions(), and toolkitPath.
Referenced by TargetOptions().
|
protected |
Derived classes must use this constructor to initialize typeID to the appropiate value: ie.
TargetOptions(TypeID::get<DerivedClass>()).
Definition at line 389 of file GPUBase.cpp.
References cmdOptions, compilationTarget, elfSection, getSymbolTableCallback, initialLlvmIRCallback, isaCallback, librariesToLink, linkedLlvmIRCallback, optimizedLlvmIRCallback, and toolkitPath.
| StringRef TargetOptions::getCmdOptions | ( | ) | const |
Returns the command line options.
Definition at line 415 of file GPUBase.cpp.
References cmdOptions.
| CompilationTarget TargetOptions::getCompilationTarget | ( | ) | const |
Returns the compilation target.
Definition at line 442 of file GPUBase.cpp.
References compilationTarget.
Referenced by mlir::ROCDL::SerializeGPUModuleBase::moduleToObjectImpl().
|
static |
Returns the default compilation target: CompilationTarget::Fatbin.
Definition at line 446 of file GPUBase.cpp.
| StringRef TargetOptions::getELFSection | ( | ) | const |
| function_ref< void(llvm::Module &)> TargetOptions::getInitialLlvmIRCallback | ( | ) | const |
Returns the callback invoked with the initial LLVM IR for the device module.
Definition at line 424 of file GPUBase.cpp.
References initialLlvmIRCallback.
| function_ref< void(StringRef)> TargetOptions::getISACallback | ( | ) | const |
Returns the callback invoked with the target ISA for the device, for example PTX assembly.
Definition at line 438 of file GPUBase.cpp.
References isaCallback.
Returns the LLVM libraries to link to.
Definition at line 411 of file GPUBase.cpp.
References librariesToLink.
|
inline |
Returns the LLVM library options for the LLVMContext and TargetMachine that serialization creates, or nullptr for their defaults.
Definition at line 120 of file CompilationInterfaces.h.
References libraryOptions.
| function_ref< void(llvm::Module &)> TargetOptions::getLinkedLlvmIRCallback | ( | ) | const |
Returns the callback invoked with LLVM IR for the device module after linking the device libraries.
Definition at line 429 of file GPUBase.cpp.
References linkedLlvmIRCallback.
| function_ref< void(llvm::Module &)> TargetOptions::getOptimizedLlvmIRCallback | ( | ) | const |
Returns the callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen.
Definition at line 434 of file GPUBase.cpp.
References optimizedLlvmIRCallback.
| SymbolTable * TargetOptions::getSymbolTable | ( | ) | const |
Returns the result of the getSymbolTableCallback callback or a nullptr if no callback was provided.
Note: The callback itself can return nullptr. It is up to the target how to react to getting a nullptr, e.g., emitting an error or constructing the table.
Definition at line 419 of file GPUBase.cpp.
References getSymbolTableCallback.
| StringRef TargetOptions::getToolkitPath | ( | ) | const |
| TypeID TargetOptions::getTypeID | ( | ) | const |
Returns the typeID.
Definition at line 407 of file GPUBase.cpp.
|
inline |
Sets the LLVM library options. They must outlive the serialization.
Definition at line 124 of file CompilationInterfaces.h.
References libraryOptions, and options.
| std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > TargetOptions::tokenizeAndRemoveSuffixCmdOptions | ( | llvm::StringRef | startsWith | ) |
Returns a tokenization of the substr of the command line options that starts with startsWith and ends with end of the command line options and consumes it.
Definition at line 479 of file GPUBase.cpp.
References cmdOptions, and tokenizeCmdOptions().
| std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > TargetOptions::tokenizeCmdOptions | ( | ) | const |
Returns a tokenization of the command line options.
Definition at line 474 of file GPUBase.cpp.
References cmdOptions, and tokenizeCmdOptions().
Referenced by mlir::impl::GpuNVVMAttachTargetBase< DerivedT >::getDescription(), tokenizeAndRemoveSuffixCmdOptions(), and tokenizeCmdOptions().
|
static |
Returns a tokenization of the command line options.
Definition at line 451 of file GPUBase.cpp.
References cmdOptions, and options.
|
protected |
An optional set of command line options to be used by the compilation process.
Definition at line 157 of file CompilationInterfaces.h.
Referenced by getCmdOptions(), TargetOptions(), TargetOptions(), tokenizeAndRemoveSuffixCmdOptions(), tokenizeCmdOptions(), and tokenizeCmdOptions().
|
protected |
Compilation process target format.
Definition at line 163 of file CompilationInterfaces.h.
Referenced by getCompilationTarget(), TargetOptions(), and TargetOptions().
|
protected |
ELF Section where the binary needs to be located.
Definition at line 160 of file CompilationInterfaces.h.
Referenced by getELFSection(), TargetOptions(), and TargetOptions().
|
protected |
Callback for obtaining the parent symbol table of all the GPU modules being serialized.
Definition at line 167 of file CompilationInterfaces.h.
Referenced by getSymbolTable(), TargetOptions(), and TargetOptions().
|
protected |
Callback invoked with the initial LLVM IR for the device module.
Definition at line 170 of file CompilationInterfaces.h.
Referenced by getInitialLlvmIRCallback(), TargetOptions(), and TargetOptions().
|
protected |
Callback invoked with the target ISA for the device, for example PTX assembly.
Definition at line 182 of file CompilationInterfaces.h.
Referenced by getISACallback(), TargetOptions(), and TargetOptions().
|
protected |
List of files to link with the LLVM module.
Definition at line 153 of file CompilationInterfaces.h.
Referenced by getLibrariesToLink(), TargetOptions(), and TargetOptions().
|
protected |
Definition at line 184 of file CompilationInterfaces.h.
Referenced by getLibraryOptions(), and setLibraryOptions().
|
protected |
Callback invoked with LLVM IR for the device module after linking the device libraries.
Definition at line 174 of file CompilationInterfaces.h.
Referenced by getLinkedLlvmIRCallback(), TargetOptions(), and TargetOptions().
|
protected |
Callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen.
Definition at line 178 of file CompilationInterfaces.h.
Referenced by getOptimizedLlvmIRCallback(), TargetOptions(), and TargetOptions().
|
protected |
Path to the target toolkit.
Definition at line 150 of file CompilationInterfaces.h.
Referenced by getToolkitPath(), TargetOptions(), and TargetOptions().