forked from OSchip/llvm-project
[mlir][linalg] Merge all tiling passes into a single one.
Passes such as `linalg-tile-to-tiled-loop` are merged into `linalg-tile`. Differential Revision: https://reviews.llvm.org/D110214
This commit is contained in:
parent
7da4ee2df0
commit
8dc16ba8d2
|
@ -13,9 +13,11 @@
|
||||||
#ifndef MLIR_DIALECT_LINALG_PASSES_H_
|
#ifndef MLIR_DIALECT_LINALG_PASSES_H_
|
||||||
#define MLIR_DIALECT_LINALG_PASSES_H_
|
#define MLIR_DIALECT_LINALG_PASSES_H_
|
||||||
|
|
||||||
|
#include "mlir/Dialect/Linalg/Utils/Utils.h"
|
||||||
#include "mlir/Pass/Pass.h"
|
#include "mlir/Pass/Pass.h"
|
||||||
|
|
||||||
namespace mlir {
|
namespace mlir {
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>> createConvertElementwiseToLinalgPass();
|
std::unique_ptr<OperationPass<FuncOp>> createConvertElementwiseToLinalgPass();
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>> createLinalgFoldUnitExtentDimsPass();
|
std::unique_ptr<OperationPass<FuncOp>> createLinalgFoldUnitExtentDimsPass();
|
||||||
|
@ -23,15 +25,10 @@ std::unique_ptr<OperationPass<FuncOp>> createLinalgFoldUnitExtentDimsPass();
|
||||||
std::unique_ptr<Pass> createLinalgElementwiseOpFusionPass();
|
std::unique_ptr<Pass> createLinalgElementwiseOpFusionPass();
|
||||||
std::unique_ptr<Pass> createFoldReshapeOpsByLinearizationPass();
|
std::unique_ptr<Pass> createFoldReshapeOpsByLinearizationPass();
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
std::unique_ptr<OperationPass<FuncOp>> createLinalgTilingPass(
|
||||||
createLinalgTilingPass(ArrayRef<int64_t> tileSizes = {});
|
ArrayRef<int64_t> tileSizes = {},
|
||||||
|
linalg::LinalgTilingLoopType loopType = linalg::LinalgTilingLoopType::Loops,
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
ArrayRef<StringRef> distributionTypes = {});
|
||||||
createLinalgTilingToParallelLoopsPass(ArrayRef<int64_t> tileSizes = {});
|
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
|
||||||
createLinalgTilingToTiledLoopPass(ArrayRef<int64_t> tileSizes = {},
|
|
||||||
ArrayRef<StringRef> distributionTypes = {});
|
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
std::unique_ptr<OperationPass<FuncOp>>
|
||||||
createLinalgPromotionPass(bool dynamicBuffers, bool useAlloca);
|
createLinalgPromotionPass(bool dynamicBuffers, bool useAlloca);
|
||||||
|
|
|
@ -169,43 +169,15 @@ def LinalgTiling : FunctionPass<"linalg-tile"> {
|
||||||
"scf::SCFDialect"
|
"scf::SCFDialect"
|
||||||
];
|
];
|
||||||
let options = [
|
let options = [
|
||||||
ListOption<"tileSizes", "linalg-tile-sizes", "int64_t", "Tile sizes",
|
ListOption<"tileSizes", "tile-sizes", "int64_t", "Tile sizes",
|
||||||
"llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated">
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
def LinalgTilingToParallelLoops
|
|
||||||
: FunctionPass<"linalg-tile-to-parallel-loops"> {
|
|
||||||
let summary = "Tile operations in the linalg dialect to parallel loops";
|
|
||||||
let constructor = "mlir::createLinalgTilingToParallelLoopsPass()";
|
|
||||||
let options = [
|
|
||||||
ListOption<"tileSizes", "linalg-tile-sizes", "int64_t", "Tile sizes",
|
|
||||||
"llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated">
|
|
||||||
];
|
|
||||||
let dependentDialects = [
|
|
||||||
"AffineDialect",
|
|
||||||
"linalg::LinalgDialect",
|
|
||||||
"memref::MemRefDialect",
|
|
||||||
"scf::SCFDialect"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
def LinalgTilingToTiledLoops
|
|
||||||
: FunctionPass<"linalg-tile-to-tiled-loop"> {
|
|
||||||
let summary = "Tile operations in the linalg dialect to linalg.tiled_loop";
|
|
||||||
let constructor = "mlir::createLinalgTilingToTiledLoopPass()";
|
|
||||||
let options = [
|
|
||||||
ListOption<"tileSizes", "linalg-tile-sizes", "int64_t", "Tile sizes",
|
|
||||||
"llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated">,
|
"llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated">,
|
||||||
ListOption<"distributionTypes", "linalg-distribution-types", "std::string",
|
Option<"loopType", "loop-type", "std::string", /*default=*/"\"for\"",
|
||||||
"DistributionTypes",
|
"Specify the type of loops to generate: for, parallel or "
|
||||||
|
"tiled_loop">,
|
||||||
|
ListOption<"distributionTypes", "distribution-types", "std::string",
|
||||||
|
"DistributionTypes (if loop-type=tiled_loop)",
|
||||||
"llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated">
|
"llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated">
|
||||||
];
|
|
||||||
let dependentDialects = [
|
|
||||||
"AffineDialect",
|
|
||||||
"linalg::LinalgDialect",
|
|
||||||
"memref::MemRefDialect",
|
|
||||||
"scf::SCFDialect"
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,19 +435,6 @@ private:
|
||||||
Optional<Identifier> replacement;
|
Optional<Identifier> replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
|
||||||
/// Linalg tiling patterns.
|
|
||||||
///
|
|
||||||
/// Apply the `tileLinalgOp` transformation as a pattern.
|
|
||||||
/// `filter` controls LinalgTransformMarker matching and update when specified.
|
|
||||||
/// See `tileLinalgOp` for more details.
|
|
||||||
enum class LinalgTilingLoopType {
|
|
||||||
Loops = 0,
|
|
||||||
AffineLoops = 1,
|
|
||||||
ParallelLoops = 2,
|
|
||||||
TiledLoops = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
using TileSizeComputationFunction =
|
using TileSizeComputationFunction =
|
||||||
std::function<SmallVector<Value, 4>(OpBuilder &, Operation *)>;
|
std::function<SmallVector<Value, 4>(OpBuilder &, Operation *)>;
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,17 @@ tensor::ExtractSliceOp makeComposedExtractSliceOp(
|
||||||
ArrayRef<OpFoldResult> sizes, ArrayRef<OpFoldResult> strides);
|
ArrayRef<OpFoldResult> sizes, ArrayRef<OpFoldResult> strides);
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Fusion utilities
|
// Fusion / Tiling utilities
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
/// The type of loops to be generated during tiling.
|
||||||
|
enum class LinalgTilingLoopType {
|
||||||
|
Loops = 0,
|
||||||
|
AffineLoops = 1,
|
||||||
|
ParallelLoops = 2,
|
||||||
|
TiledLoops = 3,
|
||||||
|
};
|
||||||
|
|
||||||
/// Checks whether the specific `producer` is the last write to exactly the
|
/// Checks whether the specific `producer` is the last write to exactly the
|
||||||
/// whole `consumedView`. This checks structural dominance, that the dependence
|
/// whole `consumedView`. This checks structural dominance, that the dependence
|
||||||
/// is a RAW without any interleaved write to any piece of `consumedView`.
|
/// is a RAW without any interleaved write to any piece of `consumedView`.
|
||||||
|
|
|
@ -510,89 +510,59 @@ static void applyExtractSliceOfPadTensorSwapPattern(FuncOp funcOp) {
|
||||||
funcOp, getLinalgTilingCanonicalizationPatterns(ctx));
|
funcOp, getLinalgTilingCanonicalizationPatterns(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
applyTilingToLoopPatterns(LinalgTilingLoopType loopType, FuncOp funcOp,
|
|
||||||
ArrayRef<int64_t> tileSizes,
|
|
||||||
ArrayRef<StringRef> distributionTypes = {}) {
|
|
||||||
auto options = LinalgTilingOptions()
|
|
||||||
.setTileSizes(tileSizes)
|
|
||||||
.setLoopType(loopType)
|
|
||||||
.setDistributionTypes(distributionTypes);
|
|
||||||
MLIRContext *ctx = funcOp.getContext();
|
|
||||||
RewritePatternSet patterns(ctx);
|
|
||||||
insertTilingPatterns(patterns, options);
|
|
||||||
scf::populateSCFForLoopCanonicalizationPatterns(patterns);
|
|
||||||
(void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
|
|
||||||
(void)applyPatternsAndFoldGreedily(
|
|
||||||
funcOp, getLinalgTilingCanonicalizationPatterns(ctx));
|
|
||||||
// Drop the marker.
|
|
||||||
funcOp.walk([](LinalgOp op) {
|
|
||||||
op->removeAttr(LinalgTransforms::kLinalgTransformMarker);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Apply swap pattern after generating loop nest and running
|
|
||||||
// canonicalizations.
|
|
||||||
applyExtractSliceOfPadTensorSwapPattern(funcOp);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> {
|
struct LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> {
|
||||||
LinalgTilingPass() = default;
|
LinalgTilingPass() = default;
|
||||||
LinalgTilingPass(ArrayRef<int64_t> sizes) { tileSizes = sizes; }
|
LinalgTilingPass(ArrayRef<int64_t> tileSizes, LinalgTilingLoopType loopType,
|
||||||
|
ArrayRef<StringRef> distributionTypes) {
|
||||||
void runOnFunction() override {
|
this->tileSizes = tileSizes;
|
||||||
applyTilingToLoopPatterns(LinalgTilingLoopType::Loops, getFunction(),
|
this->loopType = "";
|
||||||
tileSizes);
|
this->loopTypeEnum = loopType;
|
||||||
}
|
this->distributionTypes = llvm::to_vector<2>(llvm::map_range(
|
||||||
};
|
distributionTypes, [](StringRef ref) { return ref.str(); }));
|
||||||
|
|
||||||
struct LinalgTilingToParallelLoopsPass
|
|
||||||
: public LinalgTilingToParallelLoopsBase<LinalgTilingToParallelLoopsPass> {
|
|
||||||
LinalgTilingToParallelLoopsPass() = default;
|
|
||||||
LinalgTilingToParallelLoopsPass(ArrayRef<int64_t> sizes) {
|
|
||||||
tileSizes = sizes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void runOnFunction() override {
|
void runOnFunction() override {
|
||||||
applyTilingToLoopPatterns(LinalgTilingLoopType::ParallelLoops,
|
FuncOp funcOp = getFunction();
|
||||||
getFunction(), tileSizes);
|
LinalgTilingLoopType type =
|
||||||
}
|
llvm::StringSwitch<LinalgTilingLoopType>(loopType)
|
||||||
};
|
.Case("for", LinalgTilingLoopType::Loops)
|
||||||
|
.Case("affine", LinalgTilingLoopType::AffineLoops)
|
||||||
|
.Case("parallel", LinalgTilingLoopType::ParallelLoops)
|
||||||
|
.Case("tiled_loop", LinalgTilingLoopType::TiledLoops)
|
||||||
|
.Default(loopTypeEnum);
|
||||||
|
auto distTypes = llvm::to_vector<2>(llvm::map_range(
|
||||||
|
distributionTypes, [](std::string &str) { return StringRef(str); }));
|
||||||
|
auto options = LinalgTilingOptions()
|
||||||
|
.setTileSizes(tileSizes)
|
||||||
|
.setLoopType(type)
|
||||||
|
.setDistributionTypes(distTypes);
|
||||||
|
MLIRContext *ctx = funcOp.getContext();
|
||||||
|
RewritePatternSet patterns(ctx);
|
||||||
|
insertTilingPatterns(patterns, options);
|
||||||
|
scf::populateSCFForLoopCanonicalizationPatterns(patterns);
|
||||||
|
(void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
|
||||||
|
(void)applyPatternsAndFoldGreedily(
|
||||||
|
funcOp, getLinalgTilingCanonicalizationPatterns(ctx));
|
||||||
|
// Drop the marker.
|
||||||
|
funcOp.walk([](LinalgOp op) {
|
||||||
|
op->removeAttr(LinalgTransforms::kLinalgTransformMarker);
|
||||||
|
});
|
||||||
|
|
||||||
struct LinalgTilingToTiledLoopsPass
|
// Apply swap pattern after generating loop nest and running
|
||||||
: public LinalgTilingToTiledLoopsBase<LinalgTilingToTiledLoopsPass> {
|
// canonicalizations.
|
||||||
LinalgTilingToTiledLoopsPass() = default;
|
applyExtractSliceOfPadTensorSwapPattern(funcOp);
|
||||||
LinalgTilingToTiledLoopsPass(ArrayRef<int64_t> sizes,
|
|
||||||
ArrayRef<StringRef> types) {
|
|
||||||
tileSizes = sizes;
|
|
||||||
distributionTypes = llvm::to_vector<2>(
|
|
||||||
llvm::map_range(types, [](StringRef ref) { return ref.str(); }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void runOnFunction() override {
|
LinalgTilingLoopType loopTypeEnum;
|
||||||
applyTilingToLoopPatterns(
|
|
||||||
LinalgTilingLoopType::TiledLoops, getFunction(), tileSizes,
|
|
||||||
llvm::to_vector<2>(
|
|
||||||
llvm::map_range(distributionTypes,
|
|
||||||
[](std::string &str) { return StringRef(str); })));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
std::unique_ptr<OperationPass<FuncOp>>
|
||||||
mlir::createLinalgTilingPass(ArrayRef<int64_t> tileSizes) {
|
mlir::createLinalgTilingPass(ArrayRef<int64_t> tileSizes,
|
||||||
return std::make_unique<LinalgTilingPass>(tileSizes);
|
linalg::LinalgTilingLoopType loopType,
|
||||||
}
|
ArrayRef<StringRef> distributionTypes) {
|
||||||
|
return std::make_unique<LinalgTilingPass>(tileSizes, loopType,
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
distributionTypes);
|
||||||
mlir::createLinalgTilingToParallelLoopsPass(ArrayRef<int64_t> tileSizes) {
|
|
||||||
return std::make_unique<LinalgTilingToParallelLoopsPass>(tileSizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<OperationPass<FuncOp>>
|
|
||||||
mlir::createLinalgTilingToTiledLoopPass(ArrayRef<int64_t> tileSizes,
|
|
||||||
ArrayRef<StringRef> distributionTypes) {
|
|
||||||
return std::make_unique<LinalgTilingToTiledLoopsPass>(tileSizes,
|
|
||||||
distributionTypes);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,0,0,4" | FileCheck %s -check-prefix=TILE-23004
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,0,0,4" | FileCheck %s -check-prefix=TILE-23004
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2" | FileCheck %s -check-prefix=TILE-20000
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2" | FileCheck %s -check-prefix=TILE-20000
|
||||||
|
|
||||||
// TILE-23004-DAG: #[[$strided4D:.*]] = affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3 + d3)>
|
// TILE-23004-DAG: #[[$strided4D:.*]] = affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3 + d3)>
|
||||||
// TILE-20000-DAG: #[[$strided4D:.*]] = affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3 + d3)>
|
// TILE-20000-DAG: #[[$strided4D:.*]] = affine_map<(d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0 * s1 + s0 + d1 * s2 + d2 * s3 + d3)>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,0,0,4" | FileCheck %s -check-prefix=TILE-23004
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,0,0,4" | FileCheck %s -check-prefix=TILE-23004
|
||||||
|
|
||||||
// TILE-23004-DAG: #[[$D0x30pS0x10:.*]] = affine_map<(d0) -> (d0 * 30)>
|
// TILE-23004-DAG: #[[$D0x30pS0x10:.*]] = affine_map<(d0) -> (d0 * 30)>
|
||||||
// TILE-23004-DAG: #[[$S0x10p90D0x30pS1:.*]] = affine_map<(d0)[s0, s1] -> (s0 * 10 + 51, d0 * -30 + s0 * 10 + s1 * 30)>
|
// TILE-23004-DAG: #[[$S0x10p90D0x30pS1:.*]] = affine_map<(d0)[s0, s1] -> (s0 * 10 + 51, d0 * -30 + s0 * 10 + s1 * 30)>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=10,25" -split-input-file | FileCheck %s -check-prefix=TILE-10n25
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=10,25" -split-input-file | FileCheck %s -check-prefix=TILE-10n25
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=25,0" -split-input-file | FileCheck %s -check-prefix=TILE-25n0
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=25,0" -split-input-file | FileCheck %s -check-prefix=TILE-25n0
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,25" -split-input-file | FileCheck %s -check-prefix=TILE-0n25
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,25" -split-input-file | FileCheck %s -check-prefix=TILE-0n25
|
||||||
|
|
||||||
func @indexed_vector(%arg0: memref<50xindex>) {
|
func @indexed_vector(%arg0: memref<50xindex>) {
|
||||||
linalg.generic {indexing_maps = [affine_map<(i) -> (i)>],
|
linalg.generic {indexing_maps = [affine_map<(i) -> (i)>],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3" -cse -split-input-file | \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3" -cse -split-input-file | \
|
||||||
// RUN: FileCheck %s -check-prefix=TILE2
|
// RUN: FileCheck %s -check-prefix=TILE2
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,3" -resolve-shaped-type-result-dims -cse -split-input-file | \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,3" -resolve-shaped-type-result-dims -cse -split-input-file | \
|
||||||
// RUN: FileCheck %s -check-prefix=TILE1
|
// RUN: FileCheck %s -check-prefix=TILE1
|
||||||
|
|
||||||
// TILE2-DAG: #[[MAP0:.*]] = affine_map<()[s0] -> (s0 + 8)>
|
// TILE2-DAG: #[[MAP0:.*]] = affine_map<()[s0] -> (s0 + 8)>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=2,4,8" -split-input-file | FileCheck %s
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,4,8 loop-type=parallel" -split-input-file | FileCheck %s
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=2" -split-input-file | FileCheck %s -check-prefix=TILE1
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2 loop-type=parallel" -split-input-file | FileCheck %s -check-prefix=TILE1
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=2,4" -split-input-file | FileCheck %s -check-prefix=TILE2
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,4 loop-type=parallel" -split-input-file | FileCheck %s -check-prefix=TILE2
|
||||||
|
|
||||||
func @gemm(%arg0 : memref<?x?xf32>,
|
func @gemm(%arg0 : memref<?x?xf32>,
|
||||||
%arg1 : memref<?x?xf32>,
|
%arg1 : memref<?x?xf32>,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=2" | FileCheck %s -check-prefix=TILE-2
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2 loop-type=parallel" | FileCheck %s -check-prefix=TILE-2
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=0,2" | FileCheck %s -check-prefix=TILE-02
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,2 loop-type=parallel" | FileCheck %s -check-prefix=TILE-02
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=0,0,2" | FileCheck %s -check-prefix=TILE-002
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,0,2 loop-type=parallel" | FileCheck %s -check-prefix=TILE-002
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-parallel-loops="linalg-tile-sizes=2,3,4" | FileCheck %s -check-prefix=TILE-234
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,4 loop-type=parallel" | FileCheck %s -check-prefix=TILE-234
|
||||||
|
|
||||||
#id_2d = affine_map<(i, j) -> (i, j)>
|
#id_2d = affine_map<(i, j) -> (i, j)>
|
||||||
#pointwise_2d_trait = {
|
#pointwise_2d_trait = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,4" | FileCheck %s
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,4" | FileCheck %s
|
||||||
|
|
||||||
// CHECK-DAG: #[[MAP0:.*]] = affine_map<(d0)[s0] -> (2, -d0 + s0)>
|
// CHECK-DAG: #[[MAP0:.*]] = affine_map<(d0)[s0] -> (2, -d0 + s0)>
|
||||||
// CHECK-DAG: #[[MAP1:.*]] = affine_map<(d0)[s0, s1] -> (s0 + 2, -d0 + s0 + s1)>
|
// CHECK-DAG: #[[MAP1:.*]] = affine_map<(d0)[s0, s1] -> (s0 + 2, -d0 + s0 + s1)>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,4" -split-input-file | FileCheck %s
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,4" -split-input-file | FileCheck %s
|
||||||
// RUN: mlir-opt %s -linalg-tile-to-tiled-loop="linalg-tile-sizes=2,3,4 linalg-distribution-types=block_x,block_y,none" -split-input-file | FileCheck %s -check-prefix=TLOOP
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,4 loop-type=tiled_loop distribution-types=block_x,block_y,none" -split-input-file | FileCheck %s -check-prefix=TLOOP
|
||||||
|
|
||||||
// CHECK-LABEL: func @matmul_tensors(
|
// CHECK-LABEL: func @matmul_tensors(
|
||||||
// CHECK-SAME: %[[TA:[0-9a-z]+]]: tensor<?x?xf32>
|
// CHECK-SAME: %[[TA:[0-9a-z]+]]: tensor<?x?xf32>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-2
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-2
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,2" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-02
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,2" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-02
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,0,2" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-002
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,0,2" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-002
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,4" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-234
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,4" -mlir-disable-threading=true | FileCheck %s -check-prefix=TILE-234
|
||||||
|
|
||||||
// TILE-2-DAG: #[[$strided1D:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
|
// TILE-2-DAG: #[[$strided1D:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
|
||||||
// TILE-02-DAG: #[[$strided1D:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
|
// TILE-02-DAG: #[[$strided1D:.*]] = affine_map<(d0)[s0] -> (d0 + s0)>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=4" -convert-linalg-to-loops -convert-scf-to-std \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=4" -convert-linalg-to-loops -convert-scf-to-std \
|
||||||
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=4" \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=4" \
|
||||||
// RUN: -test-conv-vectorization="tile-sizes=1,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -test-conv-vectorization="tile-sizes=1,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,4" -convert-linalg-to-loops -convert-scf-to-std \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,4" -convert-linalg-to-loops -convert-scf-to-std \
|
||||||
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,4" \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,4" \
|
||||||
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,2" -convert-linalg-to-loops -convert-scf-to-std \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,2" -convert-linalg-to-loops -convert-scf-to-std \
|
||||||
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,2" \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,2" \
|
||||||
// RUN: -test-conv-vectorization="tile-sizes=1,1,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -test-conv-vectorization="tile-sizes=1,1,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,3,2" -convert-linalg-to-loops -convert-scf-to-std \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,3,2" -convert-linalg-to-loops -convert-scf-to-std \
|
||||||
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,3,3,2" \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,3,3,2" \
|
||||||
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,1,3,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,1,3,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,2,2" -convert-linalg-to-loops -convert-scf-to-std \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,2,2" -convert-linalg-to-loops -convert-scf-to-std \
|
||||||
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=2,2,2" \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=2,2,2" \
|
||||||
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,3,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,3,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,5,5,5" -convert-linalg-to-loops -convert-scf-to-std \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,5,5,5" -convert-linalg-to-loops -convert-scf-to-std \
|
||||||
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -convert-linalg-to-llvm -lower-affine -convert-scf-to-std --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=0,5,5,5" \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=0,5,5,5" \
|
||||||
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,1,1,3,3,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
// RUN: -test-conv-vectorization="tile-sizes=1,1,1,1,1,3,3,3,3" -convert-linalg-to-llvm -lower-affine -convert-scf-to-std -convert-vector-to-llvm --convert-memref-to-llvm -convert-std-to-llvm -reconcile-unrealized-casts | \
|
||||||
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_runner_utils%shlibext \
|
||||||
// RUN: | FileCheck %s
|
// RUN: | FileCheck %s
|
||||||
|
|
||||||
// RUN: mlir-opt %s -linalg-tile="linalg-tile-sizes=1,2,3" -linalg-bufferize \
|
// RUN: mlir-opt %s -linalg-tile="tile-sizes=1,2,3" -linalg-bufferize \
|
||||||
// RUN: -scf-bufferize -std-bufferize -tensor-constant-bufferize -tensor-bufferize \
|
// RUN: -scf-bufferize -std-bufferize -tensor-constant-bufferize -tensor-bufferize \
|
||||||
// RUN: -func-bufferize \
|
// RUN: -func-bufferize \
|
||||||
// RUN: -finalizing-bufferize -convert-linalg-to-loops -convert-scf-to-std -convert-scf-to-std \
|
// RUN: -finalizing-bufferize -convert-linalg-to-loops -convert-scf-to-std -convert-scf-to-std \
|
||||||
|
|
Loading…
Reference in New Issue