MLIR
17.0.0git
|
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/ViewLikeInterfaceUtils.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
#include "mlir/Dialect/MemRef/Transforms/Transforms.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
Go to the source code of this file.
Namespaces | |
mlir | |
This header declares functions that assit transformations in the MemRef dialect. | |
mlir::memref | |
Macros | |
#define | GEN_PASS_DEF_FOLDMEMREFALIASOPS |
Functions | |
static LogicalResult | resolveSourceIndicesExpandShape (Location loc, PatternRewriter &rewriter, memref::ExpandShapeOp expandShapeOp, ValueRange indices, SmallVectorImpl< Value > &sourceIndices) |
Given the 'indices' of a load/store operation where the memref is a result of a expand_shape op, returns the indices w.r.t to the source memref of the expand_shape op. More... | |
static LogicalResult | resolveSourceIndicesCollapseShape (Location loc, PatternRewriter &rewriter, memref::CollapseShapeOp collapseShapeOp, ValueRange indices, SmallVectorImpl< Value > &sourceIndices) |
Given the 'indices' of a load/store operation where the memref is a result of a collapse_shape op, returns the indices w.r.t to the source memref of the collapse_shape op. More... | |
template<typename LoadOrStoreOpTy > | |
static Value | getMemRefOperand (LoadOrStoreOpTy op) |
Helpers to access the memref operand for each op. More... | |
static Value | getMemRefOperand (vector::TransferReadOp op) |
static Value | getMemRefOperand (vector::TransferWriteOp op) |
static Value | getMemRefOperand (gpu::SubgroupMmaLoadMatrixOp op) |
static Value | getMemRefOperand (gpu::SubgroupMmaStoreMatrixOp op) |
static SmallVector< Value > | calculateExpandedAccessIndices (AffineMap affineMap, const SmallVector< Value > &indices, Location loc, PatternRewriter &rewriter) |
template<typename XferOp > | |
static LogicalResult | preconditionsFoldSubViewOpImpl (RewriterBase &rewriter, XferOp xferOp, memref::SubViewOp subviewOp) |
static LogicalResult | preconditionsFoldSubViewOp (RewriterBase &rewriter, Operation *op, memref::SubViewOp subviewOp) |
static LogicalResult | preconditionsFoldSubViewOp (RewriterBase &rewriter, vector::TransferReadOp readOp, memref::SubViewOp subviewOp) |
static LogicalResult | preconditionsFoldSubViewOp (RewriterBase &rewriter, vector::TransferWriteOp writeOp, memref::SubViewOp subviewOp) |
#define GEN_PASS_DEF_FOLDMEMREFALIASOPS |
Definition at line 32 of file FoldMemRefAliasOps.cpp.
|
static |
Definition at line 299 of file FoldMemRefAliasOps.cpp.
References mlir::AffineMap::getNumResults(), mlir::AffineMap::getSubMap(), mlir::getValueOrCreateConstantIndexOp(), and mlir::makeComposedFoldedAffineApply().
|
static |
Definition at line 171 of file FoldMemRefAliasOps.cpp.
|
static |
Definition at line 175 of file FoldMemRefAliasOps.cpp.
|
static |
Helpers to access the memref operand for each op.
Definition at line 159 of file FoldMemRefAliasOps.cpp.
|
static |
Definition at line 163 of file FoldMemRefAliasOps.cpp.
|
static |
Definition at line 167 of file FoldMemRefAliasOps.cpp.
|
static |
Definition at line 332 of file FoldMemRefAliasOps.cpp.
References mlir::success().
|
static |
Definition at line 338 of file FoldMemRefAliasOps.cpp.
References preconditionsFoldSubViewOpImpl().
|
static |
Definition at line 344 of file FoldMemRefAliasOps.cpp.
References preconditionsFoldSubViewOpImpl().
|
static |
Definition at line 316 of file FoldMemRefAliasOps.cpp.
References mlir::RewriterBase::notifyMatchFailure(), and mlir::success().
Referenced by preconditionsFoldSubViewOp().
|
static |
Given the 'indices' of a load/store operation where the memref is a result of a collapse_shape op, returns the indices w.r.t to the source memref of the collapse_shape op.
For example
%0 = ... : memref<2x6x42xf32> %1 = memref.collapse_shape %0 [[0, 1], [2]] : memref<2x6x42xf32> into memref<12x42xf32> %2 = load %1[i1, i2] : memref<12x42xf32>
could be folded into
%2 = load %0[i1 / 6, i1 % 6, i2] : memref<2x6x42xf32>
Definition at line 108 of file FoldMemRefAliasOps.cpp.
References mlir::computeSuffixProduct(), mlir::delinearize(), mlir::AffineMap::get(), mlir::Builder::getAffineDimExpr(), mlir::Builder::getConstantAffineMap(), mlir::getValueOrCreateConstantIndexOp(), mlir::makeComposedFoldedAffineApply(), and mlir::success().
|
static |
Given the 'indices' of a load/store operation where the memref is a result of a expand_shape op, returns the indices w.r.t to the source memref of the expand_shape op.
For example
%0 = ... : memref<12x42xf32> %1 = memref.expand_shape %0 [[0, 1], [2]] : memref<12x42xf32> into memref<2x6x42xf32> %2 = load %1[i1, i2, i3] : memref<2x6x42xf32
could be folded into
%2 = load %0[6 * i1 + i2, i3] : memref<12x42xf32>
Apply permutation and create AffineApplyOp.
Definition at line 57 of file FoldMemRefAliasOps.cpp.
References mlir::bindDimsList(), mlir::computeSuffixProduct(), mlir::AffineMap::get(), mlir::Builder::getContext(), mlir::getValueOrCreateConstantIndexOp(), mlir::linearize(), mlir::makeComposedFoldedAffineApply(), and mlir::success().