|
MLIR 24.0.0git
|
#include "../SPIRVCommon/Pattern.h"#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/LLVMCallOps.h"#include "mlir/Dialect/LLVMIR/LLVMConstantOps.h"#include "mlir/Dialect/LLVMIR/LLVMMemoryIntrinsicOps.h"#include "mlir/Dialect/LLVMIR/LLVMModuleOps.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 | |
| namespace | mlir |
| Include the generated interface declarations. | |
Macros | |
| #define | GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS |
Functions | |
| 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. | |
| static void | copy (Location loc, Value dst, Value src, Value size, OpBuilder &builder) |
| Copies the given number of bytes from src to dst pointers. | |
| static std::string | createGlobalVariableWithBindName (spirv::GlobalVariableOp op, StringRef kernelModuleName) |
| Encodes the binding and descriptor set numbers into a new symbolic name. | |
| static bool | hasDescriptorSetAndBinding (spirv::GlobalVariableOp op) |
| Returns true if the given global variable has both a descriptor set number and a binding number. | |
| static LogicalResult | getKernelGlobalVariables (spirv::ModuleOp moduleOp, DenseMap< uint32_t, spirv::GlobalVariableOp > &globalVariableMap) |
| Fills globalVariableMap with SPIR-V global variables that represent kernel arguments from the given SPIR-V module. | |
| static LogicalResult | encodeKernelName (spirv::ModuleOp moduleOp) |
| Encodes the SPIR-V module's symbolic name into the name of the entry point function. | |
Variables | |
| static constexpr const char | kSPIRVModule [] = "__spv__" |
| #define GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS |
Definition at line 38 of file ConvertLaunchFuncToLLVMCalls.cpp.
|
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 55 of file ConvertLaunchFuncToLLVMCalls.cpp.
Referenced by getKernelGlobalVariables().
Copies the given number of bytes from src to dst pointers.
Definition at line 60 of file ConvertLaunchFuncToLLVMCalls.cpp.
Referenced by calculateInsertPosition(), mlir::bufferization::castOrReallocMemRefValue(), mlir::remark::RemarkOpts::category(), mlir::presburger::IntegerRelation::computeReprWithOnlyDivLocals(), mlir::detail::DenseStringElementsAttrStorage::construct(), mlir::detail::DenseTypedElementsAttrStorage::construct(), mlir::presburger::IntegerRelation::containsPointNoLocal(), foldDenseElementsAttrDestInsertOp(), foldDenseElementsAttrSrcExtractOp(), foldExtractStridedSliceNonSplatConstant(), mlir::remark::RemarkOpts::function(), isMaterializing(), makeRankReducingSubview(), mlir::detail::TileOffsetRangeIterator< int64_t >::operator++(), mlir::remark::RemarkOpts::relatedTo(), mlir::remark::RemarkEmittingPolicyFinal::reportRemark(), mlir::remark::detail::Remark::setRelatedRemarkIds(), and mlir::remark::RemarkOpts::subCategory().
|
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 71 of file ConvertLaunchFuncToLLVMCalls.cpp.
|
static |
Encodes the SPIR-V module's symbolic name into the name of the entry point function.
Definition at line 107 of file ConvertLaunchFuncToLLVMCalls.cpp.
References kSPIRVModule, mlir::SymbolTable::replaceAllSymbolUses(), mlir::SymbolTable::setSymbolName(), and success().
|
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.GlobalVariables with a bind attribute are kernel arguments.
Definition at line 89 of file ConvertLaunchFuncToLLVMCalls.cpp.
References calculateGlobalIndex(), hasDescriptorSetAndBinding(), and success().
|
static |
Returns true if the given global variable has both a descriptor set number and a binding number.
Definition at line 81 of file ConvertLaunchFuncToLLVMCalls.cpp.
Referenced by getKernelGlobalVariables().
|
staticconstexpr |
Definition at line 44 of file ConvertLaunchFuncToLLVMCalls.cpp.