[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. /// Options to control the application of late transformations.
struct LateCodegenStrategyOptions { struct LateCodegenStrategyOptions {
/// Hoisting transformations are always deemed beneficial and must disabled
/// explicitly.
bool enableLICM = true; bool enableLICM = true;
bool enableHoistRedundantVectorTransfers = true; bool enableHoistRedundantVectorTransfers = true;
bool enableHoistRedundantVectorTransfersOnTensor = true; bool enableHoistRedundantVectorTransfersOnTensor = true;
bool enableVectorTransferPartialRewrite = true; /// Vector lowering operations may result in surprising behavior when
bool enableVectorContractLowering = true; /// composing multiple codegen strategies and must be enabled explicitly.
bool enableVectorToSCFConversion = true; bool enableVectorTransferPartialRewrite = false;
bool enableVectorContractLowering = false;
bool enableVectorToSCFConversion = false;
}; };
/// Codegen strategy controls how a Linalg op is progressively lowered. /// Codegen strategy controls how a Linalg op is progressively lowered.

View File

@ -148,6 +148,9 @@ void TestLinalgCodegenStrategy::runStrategy<LinalgOp>(
.setAlignment(16) .setAlignment(16)
.setUseFullTileBuffersByDefault(registerPromoteFullTile)) .setUseFullTileBuffersByDefault(registerPromoteFullTile))
.vectorizeIf(vectorize, anchorOpName) .vectorizeIf(vectorize, anchorOpName)
.setEnableVectorTransferPartialRewrite(true)
.setEnableVectorContractLowering(true)
.setEnableVectorToSCFConversion(true)
.setVectorTransformsOptions( .setVectorTransformsOptions(
vector::VectorTransformsOptions() vector::VectorTransformsOptions()
.setVectorTransformsOptions(vectorContractLowering) .setVectorTransformsOptions(vectorContractLowering)
@ -177,6 +180,9 @@ void TestLinalgCodegenStrategy::runStrategy(
.setAlignment(16) .setAlignment(16)
.setUseFullTileBuffersByDefault(registerPromoteFullTile)) .setUseFullTileBuffersByDefault(registerPromoteFullTile))
.template vectorizeIf<OpType>(vectorize) .template vectorizeIf<OpType>(vectorize)
.setEnableVectorTransferPartialRewrite(true)
.setEnableVectorContractLowering(true)
.setEnableVectorToSCFConversion(true)
.setVectorTransformsOptions( .setVectorTransformsOptions(
vector::VectorTransformsOptions() vector::VectorTransformsOptions()
.setVectorTransformsOptions(vectorContractLowering) .setVectorTransformsOptions(vectorContractLowering)