MLIR  16.0.0git
Macros | Functions
TileUsingInterface.cpp File Reference
#include "mlir/Dialect/SCF/Transforms/TileUsingInterface.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/TilingInterface.h"
#include "llvm/Support/Debug.h"
+ Include dependency graph for TileUsingInterface.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "tile-using-interface"
 

Functions

static SmallVector< unsignedfillInterchangeVector (ArrayRef< unsigned > interchangeVector, size_t iterationDomainSize)
 Helper method to adjust the interchange vector to match the iteration domain. More...
 
template<typename T >
static SmallVector< T > applyPermutationToVector (const SmallVector< T > &vector, ArrayRef< unsigned > interchange)
 Helper method to apply permutation to a vector. More...
 
static SmallVector< unsignedinvertPermutationVector (ArrayRef< unsigned > interchange)
 Helper method to apply to invert a permutation. More...
 
static bool isPermutation (ArrayRef< unsigned > interchange)
 Method to check if an interchange vector is a permutation. More...
 
static bool tileDividesIterationDomain (Range loopRange)
 
static SmallVector< scf::ForOp > generateTileLoopNest (OpBuilder &builder, Location loc, ArrayRef< Range > loopRanges, ArrayRef< Value > tileSizeVals, SmallVector< OpFoldResult > &offsets, SmallVector< OpFoldResult > &sizes)
 Generate an empty loop nest that represents the tiled loop nest shell. More...
 
static Optional< OpResultgetFusableProducer (Value v)
 Return the Value that is defined by an operation that implements the TilingInterface. More...
 
static void replaceIterArgs (scf::ForOp outerFor, scf::ForOp innerFor, PatternRewriter &rewriter)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "tile-using-interface"

Definition at line 26 of file TileUsingInterface.cpp.

Function Documentation

◆ applyPermutationToVector()

template<typename T >
static SmallVector<T> applyPermutationToVector ( const SmallVector< T > &  vector,
ArrayRef< unsigned interchange 
)
static

Helper method to apply permutation to a vector.

Definition at line 63 of file TileUsingInterface.cpp.

◆ fillInterchangeVector()

static SmallVector<unsigned> fillInterchangeVector ( ArrayRef< unsigned interchangeVector,
size_t  iterationDomainSize 
)
static

Helper method to adjust the interchange vector to match the iteration domain.

Definition at line 49 of file TileUsingInterface.cpp.

Referenced by mlir::scf::TileUsingSCFForOp::returningMatchAndRewrite().

◆ generateTileLoopNest()

static SmallVector<scf::ForOp> generateTileLoopNest ( OpBuilder builder,
Location  loc,
ArrayRef< Range loopRanges,
ArrayRef< Value tileSizeVals,
SmallVector< OpFoldResult > &  offsets,
SmallVector< OpFoldResult > &  sizes 
)
static

Generate an empty loop nest that represents the tiled loop nest shell.

  • loopRanges specifies the lb, ub and step of the untiled iteration space.
  • tileSizeVals is the tile sizes to use. Zero represent untiled loops.
  • In offsets and sizes return the multi-dimensional offset and size of the tile processed within the inner most loop.

Definition at line 114 of file TileUsingInterface.cpp.

References mlir::bindDims(), mlir::bindSymbols(), mlir::OpBuilder::create(), mlir::detail::enumerate(), mlir::AffineMap::get(), mlir::Builder::getContext(), mlir::getValueOrCreateConstantIndexOp(), mlir::m_Zero(), mlir::matchPattern(), mlir::Range::offset, mlir::OpBuilder::setInsertionPoint(), and tileDividesIterationDomain().

Referenced by mlir::scf::TileUsingSCFForOp::returningMatchAndRewrite().

◆ getFusableProducer()

static Optional<OpResult> getFusableProducer ( Value  v)
static

Return the Value that is defined by an operation that implements the TilingInterface.

Looks through iter_args of scf.for nest if required.

Definition at line 369 of file TileUsingInterface.cpp.

References mlir::Value::cast(), mlir::Value::dyn_cast(), and mlir::Value::getDefiningOp().

Referenced by mlir::scf::TileConsumerAndFuseProducersUsingSCFForOp::returningMatchAndRewrite().

◆ invertPermutationVector()

static SmallVector<unsigned> invertPermutationVector ( ArrayRef< unsigned interchange)
static

Helper method to apply to invert a permutation.

Definition at line 71 of file TileUsingInterface.cpp.

References mlir::detail::enumerate().

Referenced by mlir::scf::TileUsingSCFForOp::returningMatchAndRewrite().

◆ isPermutation()

static bool isPermutation ( ArrayRef< unsigned interchange)
static

Method to check if an interchange vector is a permutation.

Definition at line 79 of file TileUsingInterface.cpp.

Referenced by mlir::scf::TileUsingSCFForOp::returningMatchAndRewrite().

◆ replaceIterArgs()

static void replaceIterArgs ( scf::ForOp  outerFor,
scf::ForOp  innerFor,
PatternRewriter rewriter 
)
static

◆ tileDividesIterationDomain()

static bool tileDividesIterationDomain ( Range  loopRange)
static