MLIR  20.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mlir::gpu::TargetOptions Class Reference

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. More...
 
TypeID getTypeID () const
 Returns the typeID. More...
 
StringRef getToolkitPath () const
 Returns the toolkit path. More...
 
ArrayRef< AttributegetLibrariesToLink () const
 Returns the LLVM libraries to link to. More...
 
StringRef getCmdOptions () const
 Returns the command line options. More...
 
StringRef getELFSection () const
 Returns the ELF section. More...
 
std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > tokenizeCmdOptions () const
 Returns a tokenization of the command line options. More...
 
CompilationTarget getCompilationTarget () const
 Returns the compilation target. More...
 
SymbolTablegetSymbolTable () const
 Returns the result of the getSymbolTableCallback callback or a nullptr if no callback was provided. More...
 
function_ref< void(llvm::Module &)> getInitialLlvmIRCallback () const
 Returns the callback invoked with the initial LLVM IR for the device module. More...
 
function_ref< void(llvm::Module &)> getLinkedLlvmIRCallback () const
 Returns the callback invoked with LLVM IR for the device module after linking the device libraries. More...
 
function_ref< void(llvm::Module &)> getOptimizedLlvmIRCallback () const
 Returns the callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen. More...
 
function_ref< void(StringRef)> getISACallback () const
 Returns the callback invoked with the target ISA for the device, for example PTX assembly. More...
 

Static Public Member Functions

static CompilationTarget getDefaultCompilationTarget ()
 Returns the default compilation target: CompilationTarget::Fatbin. More...
 

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. More...
 

Protected Attributes

std::string toolkitPath
 Path to the target toolkit. More...
 
SmallVector< AttributelibrariesToLink
 List of files to link with the LLVM module. More...
 
std::string cmdOptions
 An optional set of command line options to be used by the compilation process. More...
 
std::string elfSection
 ELF Section where the binary needs to be located. More...
 
CompilationTarget compilationTarget
 Compilation process target format. More...
 
function_ref< SymbolTable *()> getSymbolTableCallback
 Callback for obtaining the parent symbol table of all the GPU modules being serialized. More...
 
function_ref< void(llvm::Module &)> initialLlvmIRCallback
 Callback invoked with the initial LLVM IR for the device module. More...
 
function_ref< void(llvm::Module &)> linkedLlvmIRCallback
 Callback invoked with LLVM IR for the device module after linking the device libraries. More...
 
function_ref< void(llvm::Module &)> optimizedLlvmIRCallback
 Callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen. More...
 
function_ref< void(StringRef)> isaCallback
 Callback invoked with the target ISA for the device, for example PTX assembly. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TargetOptions() [1/2]

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 2485 of file GPUDialect.cpp.

◆ TargetOptions() [2/2]

TargetOptions::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 = {} 
)
protected

Derived classes must use this constructor to initialize typeID to the appropiate value: ie.

TargetOptions(TypeID::get<DerivedClass>()).

Definition at line 2500 of file GPUDialect.cpp.

Member Function Documentation

◆ getCmdOptions()

StringRef TargetOptions::getCmdOptions ( ) const

Returns the command line options.

Definition at line 2526 of file GPUDialect.cpp.

◆ getCompilationTarget()

CompilationTarget TargetOptions::getCompilationTarget ( ) const

Returns the compilation target.

Definition at line 2553 of file GPUDialect.cpp.

Referenced by mlir::ROCDL::SerializeGPUModuleBase::moduleToObjectImpl().

◆ getDefaultCompilationTarget()

CompilationTarget TargetOptions::getDefaultCompilationTarget ( )
static

Returns the default compilation target: CompilationTarget::Fatbin.

Definition at line 2557 of file GPUDialect.cpp.

◆ getELFSection()

StringRef TargetOptions::getELFSection ( ) const

Returns the ELF section.

Definition at line 2528 of file GPUDialect.cpp.

◆ getInitialLlvmIRCallback()

function_ref< void(llvm::Module &)> TargetOptions::getInitialLlvmIRCallback ( ) const

Returns the callback invoked with the initial LLVM IR for the device module.

Definition at line 2535 of file GPUDialect.cpp.

◆ getISACallback()

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 2549 of file GPUDialect.cpp.

◆ getLibrariesToLink()

ArrayRef< Attribute > TargetOptions::getLibrariesToLink ( ) const

Returns the LLVM libraries to link to.

Definition at line 2522 of file GPUDialect.cpp.

◆ getLinkedLlvmIRCallback()

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 2540 of file GPUDialect.cpp.

◆ getOptimizedLlvmIRCallback()

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 2545 of file GPUDialect.cpp.

◆ getSymbolTable()

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 2530 of file GPUDialect.cpp.

◆ getToolkitPath()

StringRef TargetOptions::getToolkitPath ( ) const

Returns the toolkit path.

Definition at line 2520 of file GPUDialect.cpp.

◆ getTypeID()

TypeID TargetOptions::getTypeID ( ) const

Returns the typeID.

Definition at line 2518 of file GPUDialect.cpp.

◆ tokenizeCmdOptions()

std::pair< llvm::BumpPtrAllocator, SmallVector< const char * > > TargetOptions::tokenizeCmdOptions ( ) const

Returns a tokenization of the command line options.

Definition at line 2562 of file GPUDialect.cpp.

Member Data Documentation

◆ cmdOptions

std::string mlir::gpu::TargetOptions::cmdOptions
protected

An optional set of command line options to be used by the compilation process.

Definition at line 133 of file CompilationInterfaces.h.

◆ compilationTarget

CompilationTarget mlir::gpu::TargetOptions::compilationTarget
protected

Compilation process target format.

Definition at line 139 of file CompilationInterfaces.h.

◆ elfSection

std::string mlir::gpu::TargetOptions::elfSection
protected

ELF Section where the binary needs to be located.

Definition at line 136 of file CompilationInterfaces.h.

◆ getSymbolTableCallback

function_ref<SymbolTable *()> mlir::gpu::TargetOptions::getSymbolTableCallback
protected

Callback for obtaining the parent symbol table of all the GPU modules being serialized.

Definition at line 143 of file CompilationInterfaces.h.

◆ initialLlvmIRCallback

function_ref<void(llvm::Module &)> mlir::gpu::TargetOptions::initialLlvmIRCallback
protected

Callback invoked with the initial LLVM IR for the device module.

Definition at line 146 of file CompilationInterfaces.h.

◆ isaCallback

function_ref<void(StringRef)> mlir::gpu::TargetOptions::isaCallback
protected

Callback invoked with the target ISA for the device, for example PTX assembly.

Definition at line 158 of file CompilationInterfaces.h.

◆ librariesToLink

SmallVector<Attribute> mlir::gpu::TargetOptions::librariesToLink
protected

List of files to link with the LLVM module.

Definition at line 129 of file CompilationInterfaces.h.

◆ linkedLlvmIRCallback

function_ref<void(llvm::Module &)> mlir::gpu::TargetOptions::linkedLlvmIRCallback
protected

Callback invoked with LLVM IR for the device module after linking the device libraries.

Definition at line 150 of file CompilationInterfaces.h.

◆ optimizedLlvmIRCallback

function_ref<void(llvm::Module &)> mlir::gpu::TargetOptions::optimizedLlvmIRCallback
protected

Callback invoked with LLVM IR for the device module after LLVM optimizations but before codegen.

Definition at line 154 of file CompilationInterfaces.h.

◆ toolkitPath

std::string mlir::gpu::TargetOptions::toolkitPath
protected

Path to the target toolkit.

Definition at line 126 of file CompilationInterfaces.h.


The documentation for this class was generated from the following files: