|
MLIR 22.0.0git
|
Base class for all XeVM serializations from GPU modules into binary strings. More...
#include "mlir/Target/LLVM/XeVM/Utils.h"
Public Member Functions | |
| SerializeGPUModuleBase (Operation &module, XeVMTargetAttr target, const gpu::TargetOptions &targetOptions={}) | |
| XeVMTargetAttr | getTarget () const |
| Returns the target attribute. | |
| std::optional< SmallVector< std::unique_ptr< llvm::Module > > > | loadBitcodeFiles (llvm::Module &module) override |
| Loads the bitcode files in librariesToLink. | |
| gpu::GPUModuleOp | getGPUModuleOp () |
| Returns the gpu module being serialized. | |
| std::optional< SmallVector< char, 0 > > | compileToBinary (const std::string &asmStr, StringRef inputFormat) |
| Compiles to native code using ocloc. | |
| Public Member Functions inherited from mlir::LLVM::ModuleToObject | |
| ModuleToObject (Operation &module, StringRef triple, StringRef chip, StringRef features={}, int optLevel=3, function_ref< void(llvm::Module &)> initialLlvmIRCallback={}, function_ref< void(llvm::Module &)> linkedLlvmIRCallback={}, function_ref< void(llvm::Module &)> optimizedLlvmIRCallback={}, function_ref< void(StringRef)> isaCallback={}) | |
| virtual | ~ModuleToObject () |
| Operation & | getOperation () |
| Returns the operation being serialized. | |
| virtual std::optional< SmallVector< char, 0 > > | run () |
| Runs the serialization pipeline, returning std::nullopt on error. | |
Protected Member Functions | |
| std::optional< std::string > | findTool (StringRef tool) |
| Returns the path to the tool used for serialization. | |
| Protected Member Functions inherited from mlir::LLVM::ModuleToObject | |
| virtual void | setDataLayoutAndTriple (llvm::Module &module) |
| Hook for computing the Datalayout. | |
| virtual LogicalResult | handleBitcodeFile (llvm::Module &module) |
| Hook for performing additional actions on a loaded bitcode file. | |
| virtual void | handleModulePreLink (llvm::Module &module) |
| Hook for performing additional actions on the llvmModule pre linking. | |
| virtual void | handleModulePostLink (llvm::Module &module) |
| Hook for performing additional actions on the llvmModule post linking. | |
| virtual std::optional< SmallVector< char, 0 > > | moduleToObject (llvm::Module &llvmModule) |
| Serializes the LLVM IR bitcode to an object file, by default it serializes to LLVM bitcode. | |
| std::optional< llvm::TargetMachine * > | getOrCreateTargetMachine () |
| Create the target machine based on the target triple and chip. | |
| std::unique_ptr< llvm::Module > | loadBitcodeFile (llvm::LLVMContext &context, StringRef path) |
| Loads a bitcode file from path. | |
| LogicalResult | loadBitcodeFilesFromList (llvm::LLVMContext &context, ArrayRef< Attribute > librariesToLink, SmallVector< std::unique_ptr< llvm::Module > > &llvmModules, bool failureOnError=true) |
| Loads multiple bitcode files. | |
| std::unique_ptr< llvm::Module > | translateToLLVMIR (llvm::LLVMContext &llvmContext) |
| Translates the operation to LLVM IR. | |
| LogicalResult | linkFiles (llvm::Module &module, SmallVector< std::unique_ptr< llvm::Module > > &&libs) |
| Link the llvmModule to other bitcode file. | |
| virtual LogicalResult | optimizeModule (llvm::Module &module, int optL) |
| Optimize the module. | |
Protected Attributes | |
| XeVMTargetAttr | xeTarget |
| XeVM Target attribute. | |
| SmallVector< Attribute > | librariesToLink |
| List of LLVM bitcode to link into after translation to LLVM IR. | |
| gpu::TargetOptions | targetOptions |
| GPU compilation target options. | |
| Protected Attributes inherited from mlir::LLVM::ModuleToObject | |
| Operation & | module |
| Module to transform to a binary object. | |
| StringRef | triple |
| Target triple. | |
| StringRef | chip |
| Target chip. | |
| StringRef | features |
| Target features. | |
| int | optLevel |
| Optimization level. | |
| 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. | |
Additional Inherited Members | |
| Static Protected Member Functions inherited from mlir::LLVM::ModuleToObject | |
| static std::optional< std::string > | translateToISA (llvm::Module &llvmModule, llvm::TargetMachine &targetMachine) |
| Utility function for translating to ISA, returns std::nullopt on failure. | |
Base class for all XeVM serializations from GPU modules into binary strings.
By default this class serializes into LLVM bitcode.
| SerializeGPUModuleBase::SerializeGPUModuleBase | ( | Operation & | module, |
| XeVMTargetAttr | target, | ||
| const gpu::TargetOptions & | targetOptions = {} ) |
Definition at line 78 of file Target.cpp.
References mlir::LLVM::ModuleToObject::module, mlir::LLVM::ModuleToObject::ModuleToObject(), targetOptions, and xeTarget.
| std::optional< SmallVector< char, 0 > > SerializeGPUModuleBase::compileToBinary | ( | const std::string & | asmStr, |
| StringRef | inputFormat ) |
Compiles to native code using ocloc.
Definition at line 111 of file Target.cpp.
References mlir::emitError(), findTool(), getGPUModuleOp(), getTarget(), and targetOptions.
|
protected |
Returns the path to the tool used for serialization.
Definition at line 215 of file Target.cpp.
References getGPUModuleOp(), and targetOptions.
Referenced by compileToBinary().
| gpu::GPUModuleOp SerializeGPUModuleBase::getGPUModuleOp | ( | ) |
Returns the gpu module being serialized.
Definition at line 102 of file Target.cpp.
References mlir::LLVM::ModuleToObject::getOperation().
Referenced by compileToBinary(), and findTool().
| XeVMTargetAttr SerializeGPUModuleBase::getTarget | ( | ) | const |
Returns the target attribute.
Definition at line 89 of file Target.cpp.
References xeTarget.
Referenced by compileToBinary().
|
overridevirtual |
Loads the bitcode files in librariesToLink.
Reimplemented from mlir::LLVM::ModuleToObject.
Definition at line 92 of file Target.cpp.
References librariesToLink, mlir::LLVM::ModuleToObject::loadBitcodeFilesFromList(), and mlir::LLVM::ModuleToObject::module.
|
protected |
|
protected |
GPU compilation target options.
Definition at line 58 of file Utils.h.
Referenced by compileToBinary(), findTool(), and SerializeGPUModuleBase().
|
protected |
XeVM Target attribute.
Definition at line 48 of file Utils.h.
Referenced by getTarget(), and SerializeGPUModuleBase().