|
MLIR 22.0.0git
|
#include "mlir/Dialect/Linalg/Passes.h"#include "mlir/Dialect/Affine/IR/AffineOps.h"#include "mlir/Dialect/Arith/IR/Arith.h"#include "mlir/Dialect/Linalg/IR/Linalg.h"#include "mlir/Dialect/Linalg/Transforms/Transforms.h"#include "mlir/Dialect/Linalg/Utils/Utils.h"#include "mlir/Dialect/MemRef/Transforms/Transforms.h"#include "mlir/Dialect/Tensor/IR/Tensor.h"#include "mlir/Dialect/Tensor/Transforms/Transforms.h"#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"#include "mlir/IR/AffineExpr.h"#include "mlir/IR/AffineMap.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/Transforms/FoldUtils.h"#include "mlir/Transforms/GreedyPatternRewriteDriver.h"#include "llvm/Support/Debug.h"#include "mlir/Dialect/Linalg/Passes.h.inc"Go to the source code of this file.
Classes | |
| class | mlir::impl::LinalgFoldUnitExtentDimsPassBase< DerivedT > |
| struct | UnitExtentReplacementInfo |
| Compute the modified metadata for an operands of operation whose unit dims are being dropped. More... | |
Namespaces | |
| namespace | mlir |
| Include the generated interface declarations. | |
| namespace | mlir::impl |
| Attribute collections provide a dictionary-like interface. | |
Macros | |
| #define | GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS |
| #define | DEBUG_TYPE "linalg-drop-unit-dims" |
| #define DEBUG_TYPE "linalg-drop-unit-dims" |
Definition at line 38 of file DropUnitDims.cpp.
| #define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS |
Definition at line 34 of file DropUnitDims.cpp.
|
static |
Collapse the given value so that the type matches the type of origOutput.
The reassociation is used when rankReductionStrategy is set to RankReductionStrategy::ReassociativeReshape.
Definition at line 278 of file DropUnitDims.cpp.
References mlir::linalg::ControlDropUnitDims::ExtractInsertSlice, mlir::Value::getType(), and mlir::linalg::ControlDropUnitDims::ReassociativeReshape.
Referenced by mlir::linalg::dropUnitDims().
|
static |
Definition at line 334 of file DropUnitDims.cpp.
References mlir::AffineMap::get(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResults(), UnitExtentReplacementInfo::indexMap, UnitExtentReplacementInfo::reassociation, and UnitExtentReplacementInfo::targetShape.
Referenced by mlir::linalg::dropUnitDims().
|
static |
Expand the given value so that the type matches the type of origDest.
The reassociation is used when rankReductionStrategy is set to RankReductionStrategy::ReassociativeReshape.
Definition at line 251 of file DropUnitDims.cpp.
References mlir::OpBuilder::createOrFold(), mlir::linalg::ControlDropUnitDims::ExtractInsertSlice, mlir::Builder::getIndexAttr(), mlir::tensor::getMixedSizes(), mlir::Value::getType(), mlir::linalg::ControlDropUnitDims::ReassociativeReshape, and result.
Referenced by mlir::linalg::dropUnitDims().
|
static |
Patterns that are used to canonicalize the use of unit-extent dims for broadcasting.
Definition at line 804 of file DropUnitDims.cpp.
References options, mlir::patterns, mlir::tensor::populateFoldTensorEmptyPatterns(), mlir::memref::populateResolveRankedShapedTypeResultDimsPatterns(), and mlir::memref::populateResolveShapedTypeResultDimsPatterns().
Referenced by mlir::linalg::populateFoldUnitExtentDimsPatterns().
|
static |
Definition at line 824 of file DropUnitDims.cpp.
References options, mlir::patterns, mlir::tensor::populateFoldTensorEmptyPatterns(), mlir::memref::populateResolveRankedShapedTypeResultDimsPatterns(), and mlir::memref::populateResolveShapedTypeResultDimsPatterns().
Referenced by mlir::linalg::populateFoldUnitExtentDimsPatterns().
|
static |
Implements a pass that canonicalizes the uses of unit-extent dimensions for broadcasting.
For example,
mlir #accesses = [ affine_map<(d0, d1) -> (d1)>, affine_map<(d0, d1) -> (d0)>, affine_map<(d0, d1) -> (d0, d1)> ]
#trait = { indexing_maps = #accesses, iterator_types = ["parallel", "parallel"], library_call = "some_external_fn" }
func @broadcast_test(arg0 : tensor<5xf32>, arg1 : tensor<5xf32>) -> tensor<5x5xf32> { %0 = linalg.generic #trait arg0, arg1 { ^bb0(arg2: f32, arg3: f32): %3 = arith.addf arg2, arg3 : f32 linalg.yield %3 : f32 } : tensor<5xf32>, tensor<5xf32> -> tensor<5x5xf32> return %0 : tensor<5x5xf32> } Update the index accesses of linalg operations having index semantics.
Definition at line 227 of file DropUnitDims.cpp.
References mlir::RewriterBase::replaceOpWithNewOp(), and mlir::OpBuilder::setInsertionPoint().
Referenced by mlir::linalg::dropUnitDims().