[Mlir-commits] [mlir] 660f281 - [mlir][Linalg] Make codegen strategy late transformations opt-in
Nicolas Vasilache
llvmlistbot at llvm.org
Wed Sep 15 04:02:22 PDT 2021
Author: Nicolas Vasilache
Date: 2021-09-15T11:02:14Z
New Revision: 660f281b5e755663b2d8ad061075eb5f5abdf9fb
URL: https://github.com/llvm/llvm-project/commit/660f281b5e755663b2d8ad061075eb5f5abdf9fb
DIFF: https://github.com/llvm/llvm-project/commit/660f281b5e755663b2d8ad061075eb5f5abdf9fb.diff
LOG: [mlir][Linalg] Make codegen strategy late transformations opt-in
Summary: Making the late transformations opt-in results in less surprising behavior when composing multiple calls to the codegen strategy.
Reviewers:
Subscribers:
Differential revision: https://reviews.llvm.org/D109820
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/Transforms/CodegenStrategy.h
mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/CodegenStrategy.h b/mlir/include/mlir/Dialect/Linalg/Transforms/CodegenStrategy.h
index bee0d5a12800f..d33dd81fa323a 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/CodegenStrategy.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/CodegenStrategy.h
@@ -152,12 +152,16 @@ struct Vectorize : public Transformation {
/// Options to control the application of late transformations.
struct LateCodegenStrategyOptions {
+ /// Hoisting transformations are always deemed beneficial and must disabled
+ /// explicitly.
bool enableLICM = true;
bool enableHoistRedundantVectorTransfers = true;
bool enableHoistRedundantVectorTransfersOnTensor = true;
- bool enableVectorTransferPartialRewrite = true;
- bool enableVectorContractLowering = true;
- bool enableVectorToSCFConversion = true;
+ /// Vector lowering operations may result in surprising behavior when
+ /// composing multiple codegen strategies and must be enabled explicitly.
+ bool enableVectorTransferPartialRewrite = false;
+ bool enableVectorContractLowering = false;
+ bool enableVectorToSCFConversion = false;
};
/// Codegen strategy controls how a Linalg op is progressively lowered.
diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
index 658eb8a61ac98..8f2cd6c689a0d 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgCodegenStrategy.cpp
@@ -148,6 +148,9 @@ void TestLinalgCodegenStrategy::runStrategy<LinalgOp>(
.setAlignment(16)
.setUseFullTileBuffersByDefault(registerPromoteFullTile))
.vectorizeIf(vectorize, anchorOpName)
+ .setEnableVectorTransferPartialRewrite(true)
+ .setEnableVectorContractLowering(true)
+ .setEnableVectorToSCFConversion(true)
.setVectorTransformsOptions(
vector::VectorTransformsOptions()
.setVectorTransformsOptions(vectorContractLowering)
@@ -177,6 +180,9 @@ void TestLinalgCodegenStrategy::runStrategy(
.setAlignment(16)
.setUseFullTileBuffersByDefault(registerPromoteFullTile))
.template vectorizeIf<OpType>(vectorize)
+ .setEnableVectorTransferPartialRewrite(true)
+ .setEnableVectorContractLowering(true)
+ .setEnableVectorToSCFConversion(true)
.setVectorTransformsOptions(
vector::VectorTransformsOptions()
.setVectorTransformsOptions(vectorContractLowering)
More information about the Mlir-commits
mailing list