|
MLIR 22.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. | |
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. | |
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 47 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 2650 of file GPUDialect.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 2665 of file GPUDialect.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 2691 of file GPUDialect.cpp.
References cmdOptions.
| CompilationTarget TargetOptions::getCompilationTarget | ( | ) | const |
Returns the compilation target.
Definition at line 2718 of file GPUDialect.cpp.
References compilationTarget.
Referenced by mlir::ROCDL::SerializeGPUModuleBase::moduleToObjectImpl().
|
static |
Returns the default compilation target: CompilationTarget::Fatbin.
Definition at line 2722 of file GPUDialect.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 2700 of file GPUDialect.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 2714 of file GPUDialect.cpp.
References isaCallback.
Returns the LLVM libraries to link to.
Definition at line 2687 of file GPUDialect.cpp.
References librariesToLink.
| 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 2705 of file GPUDialect.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 2710 of file GPUDialect.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 2695 of file GPUDialect.cpp.
References getSymbolTableCallback.
| StringRef TargetOptions::getToolkitPath | ( | ) | const |
| TypeID TargetOptions::getTypeID | ( | ) | const |
Returns the typeID.
Definition at line 2683 of file GPUDialect.cpp.
| 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 2755 of file GPUDialect.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 2750 of file GPUDialect.cpp.
References cmdOptions, and tokenizeCmdOptions().
Referenced by tokenizeAndRemoveSuffixCmdOptions(), and tokenizeCmdOptions().
|
static |
Returns a tokenization of the command line options.
Definition at line 2727 of file GPUDialect.cpp.
References cmdOptions, and options.
|
protected |
An optional set of command line options to be used by the compilation process.
Definition at line 143 of file CompilationInterfaces.h.
Referenced by getCmdOptions(), TargetOptions(), TargetOptions(), tokenizeAndRemoveSuffixCmdOptions(), tokenizeCmdOptions(), and tokenizeCmdOptions().
|
protected |
Compilation process target format.
Definition at line 149 of file CompilationInterfaces.h.
Referenced by getCompilationTarget(), TargetOptions(), and TargetOptions().
|
protected |
ELF Section where the binary needs to be located.
Definition at line 146 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 153 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 156 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 168 of file CompilationInterfaces.h.
Referenced by getISACallback(), TargetOptions(), and TargetOptions().
|
protected |
List of files to link with the LLVM module.
Definition at line 139 of file CompilationInterfaces.h.
Referenced by getLibrariesToLink(), TargetOptions(), and TargetOptions().
|
protected |
Callback invoked with LLVM IR for the device module after linking the device libraries.
Definition at line 160 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 164 of file CompilationInterfaces.h.
Referenced by getOptimizedLlvmIRCallback(), TargetOptions(), and TargetOptions().
|
protected |
Path to the target toolkit.
Definition at line 136 of file CompilationInterfaces.h.
Referenced by getToolkitPath(), TargetOptions(), and TargetOptions().