You've already forked llvm-project
mirror of
https://github.com/encounter/llvm-project.git
synced 2026-03-30 11:27:19 -07:00
a5b9316b24
Rename mlir::applyPatternsGreedily -> applyPatternsAndFoldGreedily. The new name is a more accurate description of the method - it performs both, application of the specified patterns and folding of all ops in the op's region irrespective of whether any patterns have been supplied. Differential Revision: https://reviews.llvm.org/D77478
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
//===- TestLinalgMatmulToVector.cpp - Test VectorTransfers lowering -------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <type_traits>
|
|
|
|
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
|
#include "mlir/Dialect/Linalg/IR/LinalgOps.h"
|
|
#include "mlir/Dialect/Linalg/Transforms/LinalgTransforms.h"
|
|
#include "mlir/Dialect/Vector/VectorOps.h"
|
|
#include "mlir/Dialect/Vector/VectorTransforms.h"
|
|
#include "mlir/IR/PatternMatch.h"
|
|
#include "mlir/IR/StandardTypes.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
|
|
using namespace mlir;
|
|
using namespace mlir::linalg;
|
|
using namespace mlir::vector;
|
|
|
|
namespace {
|
|
#include "TestLinalgMatmulToVectorPatterns.h.inc"
|
|
|
|
struct DeclarativeTransforms
|
|
: public PassWrapper<DeclarativeTransforms, FunctionPass> {
|
|
void runOnFunction() override {
|
|
OwningRewritePatternList patterns;
|
|
auto *context = &getContext();
|
|
AffineApplyOp::getCanonicalizationPatterns(patterns, context);
|
|
AffineMinOp::getCanonicalizationPatterns(patterns, context);
|
|
AffineMaxOp::getCanonicalizationPatterns(patterns, context);
|
|
AllocOp::getCanonicalizationPatterns(patterns, context);
|
|
SubViewOp::getCanonicalizationPatterns(patterns, context);
|
|
ViewOp::getCanonicalizationPatterns(patterns, context);
|
|
populateWithGenerated(context, &patterns);
|
|
applyPatternsAndFoldGreedily(getFunction(), patterns);
|
|
}
|
|
};
|
|
} // end anonymous namespace
|
|
|
|
namespace mlir {
|
|
void registerTestLinalgMatmulToVectorPass() {
|
|
PassRegistration<DeclarativeTransforms> pass(
|
|
"linalg-matmul-to-vector",
|
|
"Test declarative transform patterns for matmul 3-D tiling + promotion"
|
|
" + vectorization");
|
|
}
|
|
} // namespace mlir
|