MLIR  19.0.0git
Namespaces | Macros | Functions
BlockPackMatmul.cpp File Reference
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include <optional>
#include "mlir/Dialect/Linalg/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define GEN_PASS_DEF_LINALGBLOCKPACKMATMUL
 

Functions

static std::optional< int64_t > getConstantRange (const Range &range)
 Return constant range span or nullopt, otherwise. More...
 
static bool validateFullTilesOnDims (linalg::LinalgOp linalgOp, ArrayRef< OpFoldResult > tiles, ArrayRef< int64_t > dims)
 Return true if all dimensions are fully divisible by the respective tiles. More...
 
static FailureOr< PackTransposeResulttransposePackedMatmul (RewriterBase &rewriter, linalg::LinalgOp linalgOp, tensor::PackOp packOp, AffineMap operandMap, ArrayRef< unsigned > blocksStartDimPos, bool transposeOuterBlocks, bool transposeInnerBlocks)
 Return failure or packed matmul with one of its operands transposed. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_LINALGBLOCKPACKMATMUL

#define GEN_PASS_DEF_LINALGBLOCKPACKMATMUL

Definition at line 22 of file BlockPackMatmul.cpp.

Function Documentation

◆ getConstantRange()

static std::optional<int64_t> getConstantRange ( const Range range)
static

Return constant range span or nullopt, otherwise.

Definition at line 30 of file BlockPackMatmul.cpp.

References mlir::getConstantIntValue(), mlir::Range::offset, mlir::Range::size, and mlir::Range::stride.

Referenced by validateFullTilesOnDims().

◆ transposePackedMatmul()

static FailureOr<PackTransposeResult> transposePackedMatmul ( RewriterBase rewriter,
linalg::LinalgOp  linalgOp,
tensor::PackOp  packOp,
AffineMap  operandMap,
ArrayRef< unsigned >  blocksStartDimPos,
bool  transposeOuterBlocks,
bool  transposeInnerBlocks 
)
static

Return failure or packed matmul with one of its operands transposed.

Definition at line 90 of file BlockPackMatmul.cpp.

References mlir::AffineMap::getDimPosition(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), and mlir::linalg::packTranspose().

Referenced by mlir::linalg::blockPackMatmul().

◆ validateFullTilesOnDims()

static bool validateFullTilesOnDims ( linalg::LinalgOp  linalgOp,
ArrayRef< OpFoldResult tiles,
ArrayRef< int64_t >  dims 
)
static

Return true if all dimensions are fully divisible by the respective tiles.

Definition at line 44 of file BlockPackMatmul.cpp.

References mlir::detail::enumerate(), mlir::failed(), mlir::getConstantIntValue(), getConstantRange(), and mlir::linalg::inferContractionDims().

Referenced by mlir::linalg::blockPackMatmul().