MLIR
20.0.0git
|
#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#include <iterator>
#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
Go to the source code of this file.
Classes | |
class | ConvertAliasResource< OpTy > |
struct | ConvertVariable |
struct | ConvertAddressOf |
struct | ConvertAccessChain |
struct | ConvertLoad |
struct | ConvertStore |
Namespaces | |
mlir | |
Include the generated interface declarations. | |
mlir::spirv | |
Macros | |
#define | GEN_PASS_DEF_SPIRVUNIFYALIASEDRESOURCEPASS |
#define | DEBUG_TYPE "spirv-unify-aliased-resource" |
Typedefs | |
using | Descriptor = std::pair< uint32_t, uint32_t > |
using | AliasedResourceMap = DenseMap< Descriptor, SmallVector< spirv::GlobalVariableOp > > |
Functions | |
static AliasedResourceMap | collectAliasedResources (spirv::ModuleOp moduleOp) |
Collects all aliased resources in the given SPIR-V moduleOp . More... | |
static Type | getRuntimeArrayElementType (Type type) |
Returns the element type if the given type is a runtime array resource: !spirv.ptr<!spirv.struct<!spirv.rtarray<...>>> . More... | |
static std::optional< int > | deduceCanonicalResource (ArrayRef< spirv::SPIRVType > types) |
Given a list of resource element types , returns the index of the canonical resource that all resources should be unified into. More... | |
static bool | areSameBitwidthScalarType (Type a, Type b) |
#define DEBUG_TYPE "spirv-unify-aliased-resource" |
Definition at line 38 of file UnifyAliasedResourcePass.cpp.
#define GEN_PASS_DEF_SPIRVUNIFYALIASEDRESOURCEPASS |
Definition at line 33 of file UnifyAliasedResourcePass.cpp.
using AliasedResourceMap = DenseMap<Descriptor, SmallVector<spirv::GlobalVariableOp> > |
Definition at line 47 of file UnifyAliasedResourcePass.cpp.
using Descriptor = std::pair<uint32_t, uint32_t> |
Definition at line 46 of file UnifyAliasedResourcePass.cpp.
Definition at line 149 of file UnifyAliasedResourcePass.cpp.
References mlir::Type::getIntOrFloatBitWidth(), and mlir::Type::isIntOrFloat().
Referenced by ConvertAccessChain::matchAndRewrite(), ConvertLoad::matchAndRewrite(), and ConvertStore::matchAndRewrite().
|
static |
Collects all aliased resources in the given SPIR-V moduleOp
.
Definition at line 51 of file UnifyAliasedResourcePass.cpp.
|
static |
Given a list of resource element types
, returns the index of the canonical resource that all resources should be unified into.
Returns std::nullopt if unable to unify.
Definition at line 88 of file UnifyAliasedResourcePass.cpp.
References mlir::detail::enumerate(), mlir::Type::getIntOrFloatBitWidth(), mlir::spirv::SPIRVType::getSizeInBytes(), and mlir::spirv::SPIRVType::isScalarOrVector().
Returns the element type if the given type
is a runtime array resource: !spirv.ptr<!spirv.struct<!spirv.rtarray<...>>>
.
Returns null type otherwise.
Definition at line 67 of file UnifyAliasedResourcePass.cpp.