original) (raw)
MLIR: lib/Dialect/Linalg/IR/LinalgInterfaces.cpp File Reference (#include "[mlir/Dialect/Linalg/IR/LinalgInterfaces.h](LinalgInterfaces%5F8h%5Fsource.html)"
#include "[mlir/Dialect/Affine/IR/AffineOps.h](AffineOps%5F8h%5Fsource.html)"
#include "[mlir/Dialect/Arith/IR/Arith.h](mlir%5F2Dialect%5F2Arith%5F2IR%5F2Arith%5F8h%5Fsource.html)"
#include "[mlir/Dialect/Arith/Utils/Utils.h](Dialect%5F2Arith%5F2Utils%5F2Utils%5F8h%5Fsource.html)"
#include "[mlir/Dialect/Complex/IR/Complex.h](Complex%5F8h%5Fsource.html)"
#include "[mlir/Dialect/Linalg/IR/Linalg.h](mlir%5F2Dialect%5F2Linalg%5F2IR%5F2Linalg%5F8h%5Fsource.html)"
#include "[mlir/IR/AffineExpr.h](mlir%5F2IR%5F2AffineExpr%5F8h%5Fsource.html)"
#include "[mlir/IR/AffineExprVisitor.h](AffineExprVisitor%5F8h%5Fsource.html)"
#include "[mlir/IR/AffineMap.h](mlir%5F2IR%5F2AffineMap%5F8h%5Fsource.html)"
#include "[mlir/IR/BuiltinTypeInterfaces.h](BuiltinTypeInterfaces%5F8h%5Fsource.html)"
#include "[mlir/IR/MLIRContext.h](MLIRContext%5F8h%5Fsource.html)"
#include "[mlir/IR/TypeUtilities.h](TypeUtilities%5F8h%5Fsource.html)"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <numeric>
#include <optional>
#include "mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc"
Go to the source code of this file.
Classes | |
---|---|
struct | HasAffineDimExprVisitor |
Visitor to check if any of the given set of positions from AffineDimExprs are used within an AffineExpr. More... | |
Namespaces |
---|
Functions | |
---|---|
static bool | isaElemwiseSingleUnaryOrBinaryOpInterface (linalg::GenericOp op, unsigned arity) |
static Value | getSourceSkipUnary (Value value) |
If the value is defined by a chain of unary side effect-free, go up the use-def chain until the first value that isn't defined by such an op. More... | |
template<typename AddOpTy , typename MulOpTy , typename... Args> | |
static bool | isPairTemplateImpl (Operation *add, Operation *mul) |
Returns true if the two operations are of the kinds specified by a pair of consecutive template arguments. More... | |
template<typename... Args> | |
static bool | isContractionBody (Block &block) |
Returns true if the block is a body of a contraction with the kinds of operations given pairwise by template arguments. More... | |
static llvm::SmallDenseSet< int64_t > | findPermutationsIndexingOperand (AffineMap indexingMap, ArrayRef< utils::IteratorType > iterators, utils::IteratorType iter) |
Given an indexingMap and its corresponding iterators, returns the positions of the iterators of type iter that are indexed by the indexingMap as a permutation. More... | |
static FailureOr< SmallVector< utils::IteratorType > > | inferIteratorsFromOutMap (AffineMap map) |
Infer the iterator types from the init affine map. More... | |
static FailureOr< ContractionDimensions > | inferContractionDimsImpl (ArrayRef< AffineMap > indexingMaps, ArrayRef< utils::IteratorType > iterators) |
Find 2 parallel (m and n) and 1 reduction (k) dimension candidates that form a matmul subcomputation within linalgOp. More... | |
template | |
static T | getAffineExprOfType (AffineExpr lhs, AffineExpr rhs) |
Of the given two expressions returns one that is of type T (lhs gets preference over rhs) More... | |
static llvm::SmallDenseSet< int64_t > | getPreservedDims (AffineMap map) |
static SmallVector< int64_t, 2 > | getConstantsFromExprList (const SmallVector< AffineExpr, 2 > &exprs) |
static FailureOr< ConvolutionDimensions > | inferConvolutionDimsImpl (LinalgOp linalgOp, ConvAccessExprWalker &inputExprWalker, bool allowEmptyConvolvedDims) |
Classifies dimensions in the linalgOp used by a convolution subcomputation, as captured by inputExprWalker. More... | |
static MatchFillResult | isFillInterfaceImpl (Operation *op) |
static std::pair< int64_t, int64_t > | getResultsPositionInLoopsToShapeMap (LinalgOp &op) |
◆ MatchFillResult
◆ findPermutationsIndexingOperand()
static llvm::SmallDenseSet<int64_t> findPermutationsIndexingOperand ( AffineMap indexingMap, ArrayRef< utils::IteratorType > iterators, utils::IteratorType iter ) | static |
---|
◆ getAffineExprOfType()
Of the given two expressions returns one that is of type T (lhs
gets preference over rhs
)
Definition at line 564 of file LinalgInterfaces.cpp.
◆ getConstantsFromExprList()
◆ getPreservedDims()
static llvm::SmallDenseSet<int64_t> getPreservedDims ( AffineMap map) | static |
---|
◆ getResultsPositionInLoopsToShapeMap()
static std::pair<int64_t, int64_t> getResultsPositionInLoopsToShapeMap ( LinalgOp & op) | static |
---|
◆ getSourceSkipUnary()
static Value getSourceSkipUnary ( Value value) | static |
---|
◆ inferContractionDimsImpl()
Find 2 parallel (m and n) and 1 reduction (k) dimension candidates that form a matmul subcomputation within linalgOp
.
These dimensions are such that:
- The m dimension is involved in an outer-product along LHS (i.e. it is a permutation on RES and LHS and does not appear in RHS).
- The n dimension is involved in an outer-product along RHS (i.e. it is a permutation on RES and RHS and does not appear in LHS).
- The k dimension appears as a permutation on LHS and RHS.
- m, n and k appear only once in any given indexing.
- Optional batch dimensions that appear in all operands are captured. This allows e.g. detecting that some contraction is embedded within
linalgOp
with some orthogonal heuristic.
Definition at line 404 of file LinalgInterfaces.cpp.
References findPermutationsIndexingOperand().
Referenced by mlir::linalg::inferContractionDims().
◆ inferConvolutionDimsImpl()
static FailureOr<ConvolutionDimensions> inferConvolutionDimsImpl ( LinalgOp linalgOp, ConvAccessExprWalker & inputExprWalker, bool allowEmptyConvolvedDims ) | static |
---|
◆ inferIteratorsFromOutMap()
static FailureOr<SmallVectorutils::IteratorType > inferIteratorsFromOutMap ( AffineMap map) | static |
---|
◆ isaElemwiseSingleUnaryOrBinaryOpInterface()
static bool isaElemwiseSingleUnaryOrBinaryOpInterface ( linalg::GenericOp op, unsigned arity ) | static |
---|
◆ isContractionBody()
template<typename... Args>
static bool isContractionBody ( Block & block) | static |
---|
◆ isFillInterfaceImpl()
◆ isPairTemplateImpl()
template<typename AddOpTy , typename MulOpTy , typename... Args>
Returns true if the two operations are of the kinds specified by a pair of consecutive template arguments.
Definition at line 328 of file LinalgInterfaces.cpp.