MLIR  15.0.0git
Classes | Namespaces | Typedefs | Enumerations | Functions
Utils.h File Reference
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/SCF/SCF.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
+ Include dependency graph for Utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mlir::linalg::FusionInfo
 A struct containing the Linalg producer before and after fusion. More...
 
struct  mlir::linalg::ProcInfo
 Callback function type used to get processor ID, and number of processors used for distribution for all parallel loops generated. More...
 
struct  mlir::linalg::LinalgLoopDistributionOptions
 Options that allow distribution of loops generated in Linalg transforms to processors while generating the loops. More...
 
class  mlir::linalg::TileLoopNest
 A struct to manage the tile loop nest specific information. More...
 
struct  mlir::linalg::RegionMatcher
 A struct containing common matchers over linalg op's region. More...
 
struct  mlir::linalg::GenerateLoopNest< LoopTy >
 Utility class used to generate nested loops with ranges described by loopRanges and loop type described by the iteratorTypes. More...
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::tensor
 
 mlir::linalg
 

Typedefs

using mlir::linalg::FusableOpDependencesTy = llvm::MapVector< Operation *, SmallVector< LinalgDependenceGraph::LinalgDependenceGraphElem, 1 > >
 
using mlir::linalg::ProcInfoCallBackFn = std::function< SmallVector< ProcInfo, 2 >(OpBuilder &b, Location loc, ArrayRef< Range > parallelLoopRanges)>
 
using mlir::linalg::OneDimProcInfoCallBackFn = std::function< ProcInfo(OpBuilder &b, Location loc)>
 

Enumerations

enum  mlir::linalg::LinalgTilingLoopType { mlir::linalg::LinalgTilingLoopType::Loops = 0, mlir::linalg::LinalgTilingLoopType::AffineLoops = 1, mlir::linalg::LinalgTilingLoopType::ParallelLoops = 2, mlir::linalg::LinalgTilingLoopType::TiledLoops = 3 }
 The type of loops to be generated during tiling. More...
 
enum  mlir::linalg::DistributionMethod { mlir::linalg::DistributionMethod::Cyclic = 0, mlir::linalg::DistributionMethod::CyclicNumProcsGeNumIters = 1, mlir::linalg::DistributionMethod::CyclicNumProcsEqNumIters = 2 }
 Scheme used to distribute loops to processors. More...
 

Functions

bool mlir::linalg::isPermutation (ArrayRef< int64_t > permutation)
 Check if permutation is a permutation of the range [0, permutation.size()). More...
 
Value mlir::linalg::createOrFoldDimOp (OpBuilder &b, Location loc, Value source, int64_t dim)
 Helper function that creates a memref::DimOp or tensor::DimOp depending on the type of source. More...
 
SmallVector< Value, 4 > mlir::linalg::getDynOperands (Location loc, Value val, OpBuilder &b)
 Given an operation, retrieves the value of each dynamic dimension through constructing the necessary DimOp operators. More...
 
void mlir::linalg::getUpperBoundForIndex (Value value, AffineMap &boundMap, SmallVectorImpl< Value > &boundOperands, bool constantRequired=false)
 Computes an upper bound for the result value of an index computation. More...
 
FailureOr< int64_t > mlir::linalg::getConstantUpperBoundForIndex (Value value)
 Returns a constant upper bound for the result value of an index computation. More...
 
tensor::ExtractSliceOp mlir::linalg::makeComposedExtractSliceOp (OpBuilder &b, Location loc, Value source, ArrayRef< OpFoldResult > offsets, ArrayRef< OpFoldResult > sizes, ArrayRef< OpFoldResult > strides)
 Create an ExtractSliceOp and, if source is defined by an ExtractSliceOp, fold it by adding the offsets. More...
 
Value mlir::linalg::makeComposedPadHighOp (OpBuilder &b, Location loc, RankedTensorType type, Value source, Value pad, bool nofold)
 Create a tensor::PadOp that pads source to the size of the statically sized type whose static sizes are assumed to be greater than the dynamic source size. More...
 
GenericOp mlir::linalg::makeTransposeOp (OpBuilder &b, Location loc, Value inputTensor, Value outputTensor, ArrayRef< int64_t > transposeVector)
 Returns a GenericOp that tansposes inputTensor into outputTensor using transposeVector to permute the inputTensor dimensions. More...
 
GenericOp mlir::linalg::makeMemRefCopyOp (OpBuilder &b, Location loc, Value from, Value to)
 Returns GenericOp that copies an n-D memref. More...
 
bool mlir::linalg::isProducerLastWriteOfView (const LinalgDependenceGraph &graph, LinalgOp consumer, Value consumedView, LinalgOp producer)
 Checks whether the specific producer is the last write to exactly the whole consumedView. More...
 
bool mlir::linalg::isFusableInto (const LinalgDependenceGraph &graph, LinalgOp consumer, Value consumedView, LinalgOp producer)
 Checks whether fusing the specific producer of the consumedView is feasible. More...
 
SmallVector< Valuemlir::linalg::computeTileOffsets (OpBuilder &b, Location loc, ValueRange ivs, ValueRange tileSizes)
 Compute tile offsets, given a list of loop ivs and tileSizes. More...
 
SmallVector< Valuemlir::linalg::computeTileSizes (OpBuilder &b, Location loc, ValueRange ivs, ValueRange tileSizes, ArrayRef< Value > sizeBounds)
 Compute tile sizes, given a list of loop ivs, tileSizes and dimension sizes (sizeBounds). More...
 
Value mlir::linalg::makeTiledShape (OpBuilder &builder, Location loc, Value valueToTile, ValueRange tileSizes, AffineMap map, ValueRange lbs, ValueRange ubs, ValueRange subShapeSizes, bool omitPartialTileCheck)
 Creates an extract_slice/subview op for a single valueToTile with builder. More...
 
SmallVector< Value, 4 > mlir::linalg::makeTiledShapes (OpBuilder &builder, Location loc, LinalgOp linalgOp, ArrayRef< Value > valuesToTile, ValueRange ivs, ValueRange tileSizes, ArrayRef< Value > sizeBounds, bool omitPartialTileCheck)
 Creates extract_slice/subview ops for all valuesToTile of the given linalgOp with builder, assuming linalgOp is being fused into a loop nest for tiling with the given induction variables ivs and tile sizes tileSizes. More...
 
void mlir::linalg::addTileLoopIvsToIndexOpResults (OpBuilder &b, LinalgOp tiledOp, ArrayRef< Value > ivs)
 Add the tile loop induction variables ivs to the IndexOp results found in the body of the tiledOp to account for the tile offset. More...
 
FusableOpDependencesTy mlir::linalg::findAllFusableDependences (ArrayRef< LinalgOp > ops, const LinalgDependenceGraph &dependenceGraph)
 Find all dependences that are fusable. More...
 
FailureOr< FusionInfomlir::linalg::fuseProducerOfBuffer (OpBuilder &b, OpOperand &consumerOpOperand, const LinalgDependenceGraph &graph)
 Fuses producer into consumer if the producer is structurally feasible and the fusion would not violate dependencies. More...
 
FailureOr< FusionInfomlir::linalg::fuseProducerOfTensor (OpBuilder &b, OpOperand &consumerOpOperand)
 Tensor counterpart of fuseProducerOfBuffer. More...
 
FailureOr< FusionInfomlir::linalg::fuseProducerOfTensor (OpBuilder &b, OpResult producerOpResult, OpOperand &consumerOpOperand)
 Tensor counterpart of fuseProducerOfBuffer. More...
 
void mlir::linalg::updateBoundsForCyclicDistribution (OpBuilder &builder, Location loc, Value procId, Value nprocs, Value &lb, Value &ub, Value &step)
 Update the lb, ub and step to get per processor lb, ub and step. More...
 
FailureOr< TileLoopNestmlir::linalg::tileConsumerAndFuseProducers (OpBuilder &b, LinalgOp consumerOp, ArrayRef< int64_t > tileSizes, ArrayRef< int64_t > tileInterchange, const Optional< LinalgLoopDistributionOptions > &tileDistribution)
 Tiles consumerOp and fuses its dependencies if possible. More...