[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
This commit is contained in:
Nicolas Vasilache 2021-09-15 11:00:06 +00:00
parent e3889b3059
commit 660f281b5e
2 changed files with 13 additions and 3 deletions

View File

@ -152,12 +152,16 @@ private:
/// 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.

View File

@ -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)