MLIR
21.0.0git
|
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FormatVariadic.h"
#include "mlir/Conversion/Passes.h.inc"
Go to the source code of this file.
Namespaces | |
mlir | |
Include the generated interface declarations. | |
Macros | |
#define | GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS |
Functions | |
static std::string | descriptorSetName () |
Returns the string name of the DescriptorSet decoration. More... | |
static std::string | bindingName () |
Returns the string name of the Binding decoration. More... | |
static unsigned | calculateGlobalIndex (spirv::GlobalVariableOp op) |
Calculates the index of the kernel's operand that is represented by the given global variable with the bind attribute. More... | |
static void | copy (Location loc, Value dst, Value src, Value size, OpBuilder &builder) |
Copies the given number of bytes from src to dst pointers. More... | |
static std::string | createGlobalVariableWithBindName (spirv::GlobalVariableOp op, StringRef kernelModuleName) |
Encodes the binding and descriptor set numbers into a new symbolic name. More... | |
static bool | hasDescriptorSetAndBinding (spirv::GlobalVariableOp op) |
Returns true if the given global variable has both a descriptor set number and a binding number. More... | |
static LogicalResult | getKernelGlobalVariables (spirv::ModuleOp module, DenseMap< uint32_t, spirv::GlobalVariableOp > &globalVariableMap) |
Fills globalVariableMap with SPIR-V global variables that represent kernel arguments from the given SPIR-V module. More... | |
static LogicalResult | encodeKernelName (spirv::ModuleOp module) |
Encodes the SPIR-V module's symbolic name into the name of the entry point function. More... | |
Variables | |
static constexpr const char | kSPIRVModule [] = "__spv__" |
#define GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS |
Definition at line 34 of file ConvertLaunchFuncToLLVMCalls.cpp.
|
static |
Returns the string name of the Binding
decoration.
Definition at line 53 of file ConvertLaunchFuncToLLVMCalls.cpp.
Referenced by calculateGlobalIndex(), createGlobalVariableWithBindName(), hasDescriptorSetAndBinding(), and mlir::spirv::printVariableDecorations().
|
static |
Calculates the index of the kernel's operand that is represented by the given global variable with the bind
attribute.
We assume that the index of each kernel's operand is mapped to (descriptorSet, binding) by the map: i -> (0, i) which is implemented under LowerABIAttributesPass
.
Definition at line 63 of file ConvertLaunchFuncToLLVMCalls.cpp.
References bindingName().
Referenced by getKernelGlobalVariables().
Copies the given number of bytes from src to dst pointers.
Definition at line 69 of file ConvertLaunchFuncToLLVMCalls.cpp.
References mlir::OpBuilder::create().
Referenced by mlir::bufferization::castOrReallocMemRefValue(), mlir::presburger::IntegerRelation::computeReprWithOnlyDivLocals(), mlir::computeShapeRatio(), mlir::detail::DenseIntOrFPElementsAttrStorage::construct(), mlir::detail::DenseStringElementsAttrStorage::construct(), mlir::presburger::IntegerRelation::containsPointNoLocal(), convertDenseArrayFromAttr(), copyStringWithNull(), createNewAliasScopesFromNoAliasParameter(), doubleBuffer(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtLvls(), mlir::sparse_tensor::LoopEmitter::enterCurrentCoIterationCase(), mlir::sparse_tensor::LoopEmitter::exitCurrentLoop(), foldDenseElementsAttrDestInsertOp(), foldDenseElementsAttrSrcExtractOp(), foldExtractStridedSliceNonSplatConstant(), mlir::mesh::MeshSharding::get(), mlir::presburger::MultiAffineFunction::getAsRelation(), mlir::tosa::hasUniqueConstantScatterIndices(), isMaterializing(), mlir::detail::makeStridedMemRefDescriptor(), mlir::presburger::MultiAffineFunction::mergeDivs(), mlirMemRefTypeGetStridesAndOffset(), mlir::detail::TileOffsetRangeIterator< ElementType >::operator++(), replaceByPackingResult(), mlir::sparse_tensor::SparseIterator::seek(), and mlir::presburger::IntegerRelation::unionBoundingBox().
|
static |
Encodes the binding and descriptor set numbers into a new symbolic name.
The name is specified by {kernel_module_name}_{variable_name}_descriptor_set{ds}_binding{b} to avoid symbolic conflicts, where 'ds' and 'b' are descriptor set and binding numbers.
Definition at line 80 of file ConvertLaunchFuncToLLVMCalls.cpp.
References bindingName(), and descriptorSetName().
|
static |
Returns the string name of the DescriptorSet
decoration.
Definition at line 47 of file ConvertLaunchFuncToLLVMCalls.cpp.
Referenced by createGlobalVariableWithBindName(), hasDescriptorSetAndBinding(), and mlir::spirv::printVariableDecorations().
|
static |
Encodes the SPIR-V module's symbolic name into the name of the entry point function.
Definition at line 122 of file ConvertLaunchFuncToLLVMCalls.cpp.
References mlir::get(), kSPIRVModule, mlir::SymbolTable::replaceAllSymbolUses(), and mlir::SymbolTable::setSymbolName().
|
static |
Fills globalVariableMap
with SPIR-V global variables that represent kernel arguments from the given SPIR-V module.
We assume that the module contains a single entry point function. Hence, all spirv.GlobalVariable
s with a bind attribute are kernel arguments.
Definition at line 104 of file ConvertLaunchFuncToLLVMCalls.cpp.
References calculateGlobalIndex(), and hasDescriptorSetAndBinding().
|
static |
Returns true if the given global variable has both a descriptor set number and a binding number.
Definition at line 93 of file ConvertLaunchFuncToLLVMCalls.cpp.
References bindingName(), and descriptorSetName().
Referenced by getKernelGlobalVariables().
|
staticconstexpr |
Definition at line 40 of file ConvertLaunchFuncToLLVMCalls.cpp.
Referenced by encodeKernelName().