MLIR
16.0.0git
|
#include "PassDetail.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/Transforms/Passes.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>
Go to the source code of this file.
Classes | |
class | ConvertAliasResource< OpTy > |
struct | ConvertVariable |
struct | ConvertAddressOf |
struct | ConvertAccessChain |
struct | ConvertLoad |
struct | ConvertStore |
Macros | |
#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: !spv.ptr<!spv.struct<!spv.rtarray<...>>> . More... | |
static 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 30 of file UnifyAliasedResourcePass.cpp.
using AliasedResourceMap = DenseMap<Descriptor, SmallVector<spirv::GlobalVariableOp> > |
Definition at line 40 of file UnifyAliasedResourcePass.cpp.
using Descriptor = std::pair<uint32_t, uint32_t> |
Definition at line 38 of file UnifyAliasedResourcePass.cpp.
Definition at line 138 of file UnifyAliasedResourcePass.cpp.
References mlir::Type::cast(), collectAliasedResources(), deduceCanonicalResource(), mlir::detail::enumerate(), getElementType(), mlir::Type::getIntOrFloatBitWidth(), getRuntimeArrayElementType(), mlir::Type::isIntOrFloat(), mlir::SymbolTable::lookupSymbolIn(), and MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID.
Referenced by ConvertAccessChain::matchAndRewrite(), ConvertLoad::matchAndRewrite(), and ConvertStore::matchAndRewrite().
|
static |
Collects all aliased resources in the given SPIR-V moduleOp
.
Definition at line 43 of file UnifyAliasedResourcePass.cpp.
Referenced by areSameBitwidthScalarType(), and ConvertStore::matchAndRewrite().
|
static |
Given a list of resource element types
, returns the index of the canonical resource that all resources should be unified into.
Returns llvm::None if unable to unify.
Definition at line 78 of file UnifyAliasedResourcePass.cpp.
References mlir::Type::dyn_cast(), mlir::detail::enumerate(), mlir::Type::getIntOrFloatBitWidth(), mlir::spirv::SPIRVType::getSizeInBytes(), mlir::spirv::SPIRVType::isScalarOrVector(), and vectorType().
Referenced by areSameBitwidthScalarType().
Returns the element type if the given type
is a runtime array resource: !spv.ptr<!spv.struct<!spv.rtarray<...>>>
.
Returns null type otherwise.
Definition at line 58 of file UnifyAliasedResourcePass.cpp.
References mlir::Type::dyn_cast(), mlir::spirv::RuntimeArrayType::getElementType(), mlir::spirv::StructType::getElementType(), and mlir::spirv::PointerType::getPointeeType().
Referenced by areSameBitwidthScalarType().