MLIR  21.0.0git
Classes | Namespaces | Typedefs | Enumerations | Functions
Utils.h File Reference
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "llvm/ADT/StringSet.h"
#include <optional>

Go to the source code of this file.

Classes

struct  mlir::linalg::SliceParameters
 A struct containg offsets-sizes-strides arguments of the tiled shape. More...
 
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...
 
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::affine
 
 mlir::tensor
 
 mlir::linalg
 

Typedefs

using mlir::linalg::ProcInfoCallBackFn = std::function< SmallVector< ProcInfo >(OpBuilder &b, Location loc, ArrayRef< Range > parallelLoopRanges)>
 

Enumerations

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

Functions

SmallVector< int64_t > mlir::linalg::getPackInverseDestPerm (linalg::PackOp packOp)
 Shell function to compute the Destination Permutation of PackOp This function uses the helper function computePackUnPackPerm to get the permutation vector. More...
 
SmallVector< int64_t > mlir::linalg::getUnPackInverseSrcPerm (linalg::UnPackOp unpackOp)
 Shell function to compute the Source Permutation of unPackOp. More...
 
SmallVector< int64_t > mlir::linalg::getUnPackInverseSrcPerm (linalg::UnPackOp, PackingMetadata &metadata)
 Shell function to compute the Source rank permutation for unpackOp Unpack requires some packing metadata data information, so created another function where this value is passed by reference. More...
 
bool mlir::linalg::allIndexingsAreProjectedPermutation (LinalgOp op)
 Check if all indexing maps are projected permutations. More...
 
bool mlir::linalg::hasOnlyScalarElementwiseOp (Region &r)
 Detect whether r has only ConstantOp, ElementwiseMappable and YieldOp. More...
 
bool mlir::linalg::isElementwise (LinalgOp op)
 Check if a LinalgOp is an element-wise operation. More...
 
bool mlir::linalg::isParallelIterator (utils::IteratorType iteratorType)
 Check if iterator type has "parallel" semantics. More...
 
bool mlir::linalg::isReductionIterator (utils::IteratorType iteratorType)
 Check if iterator type has "reduction" semantics. 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::makeMemRefCopyOp (OpBuilder &b, Location loc, Value from, Value to)
 Returns GenericOp that copies an n-D memref. More...
 
std::optional< SmallVector< ReassociationIndices > > mlir::linalg::getReassociationMapForFoldingUnitDims (ArrayRef< OpFoldResult > mixedSizes)
 Get the reassociation maps to fold the result of a extract_slice (or source of a insert_slice) operation with given offsets, and sizes to its rank-reduced version. More...
 
SmallVector< OpFoldResultmlir::linalg::computeTileOffsets (OpBuilder &b, Location loc, ArrayRef< OpFoldResult > ivs, ArrayRef< OpFoldResult > tileSizes)
 Computes tile offsets, given a list of loop ivs and tileSizes. More...
 
SmallVector< OpFoldResultmlir::linalg::computeTileSizes (OpBuilder &b, Location loc, ArrayRef< OpFoldResult > tileSizes, ArrayRef< OpFoldResult > sizeBounds)
 Computes tile sizes, given a list of tileSizes and dimension sizes (sizeBounds). More...
 
SmallVector< Typemlir::linalg::getTensorOutputTypes (LinalgOp op, ValueRange operands)
 Returns the list of tensor output types produced when the given structured operation op is applied to the given operands. More...
 
SmallVector< Valuemlir::linalg::insertSlicesBack (OpBuilder &builder, Location loc, LinalgOp op, ValueRange operands, ValueRange results)
 Creates insert_slice ops that insert results back into larger tensors they were originally extracted from with extract_slice before being passed as operands to the given structured operation op or its clone. More...
 
SliceParameters mlir::linalg::computeSliceParameters (OpBuilder &builder, Location loc, Value valueToTile, ArrayRef< OpFoldResult > tileSizes, AffineMap map, ArrayRef< OpFoldResult > lbs, ArrayRef< OpFoldResult > ubs, ArrayRef< OpFoldResult > subShapeSizes, bool omitPartialTileCheck)
 Computes SliceParameters for a single valueToTile assuming that its user is being tiled with the given loop bounds lbs and ubs and the tile sizes tileSizes. More...
 
SmallVector< std::optional< SliceParameters > > mlir::linalg::computeAllSliceParameters (OpBuilder &builder, Location loc, LinalgOp linalgOp, ValueRange valuesToTile, ArrayRef< OpFoldResult > ivs, ArrayRef< OpFoldResult > tileSizes, ArrayRef< OpFoldResult > sizeBounds, bool omitPartialTileCheck)
 Computes SliceParamaters for all valuesToTile of the given linalgOp, assuming linalgOp is being fused into a loop nest. More...
 
Operationmlir::linalg::makeTiledShape (OpBuilder &builder, Location loc, Value valueToTile, ArrayRef< OpFoldResult > tileSizes, AffineMap map, ArrayRef< OpFoldResult > lbs, ArrayRef< OpFoldResult > ubs, ArrayRef< OpFoldResult > subShapeSizes, bool omitPartialTileCheck)
 Creates an extract_slice/subview op for a single valueToTile with builder. More...
 
SmallVector< Valuemlir::linalg::makeTiledShapes (OpBuilder &builder, Location loc, LinalgOp linalgOp, ValueRange valuesToTile, ArrayRef< OpFoldResult > ivs, ArrayRef< OpFoldResult > tileSizes, ArrayRef< OpFoldResult > 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::offsetIndices (OpBuilder &b, LinalgOp linalgOp, ArrayRef< OpFoldResult > offests)
 Add the specified offsets to any linalg.index ops contained in the given linalgOp. More...
 
void mlir::linalg::offsetIndices (RewriterBase &b, LinalgOp linalgOp, ArrayRef< OpFoldResult > offests)
 
FailureOr< FusionInfomlir::linalg::fuseProducerOfTensor (OpBuilder &b, OpOperand &consumerOpOperand)
 This implements the fusion part of the "tileAndFuse on tensors" transformation and thus requires the consumerOpOperand to be a extract_slice op (generally obtained by applying the tiling transformation). More...
 
FailureOr< FusionInfomlir::linalg::fuseProducerOfTensor (OpBuilder &b, OpResult producerOpResult, OpOperand &consumerOpOperand)
 This implements the fusion part of the "tileAndFuse on tensors" transformation and thus requires the consumerOpOperand to be a extract_slice op (generally obtained by applying the tiling transformation). 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...
 
template<typename OpTy >
SmallVector< NamedAttribute > mlir::linalg::getPrunedAttributeList (OpTy op)
 Returns an attribute list that excludes pre-defined attributes. More...