Skip to content

Commit

Permalink
only move set_encoding to preprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhanW committed Aug 18, 2023
1 parent 259919a commit ff8c92c
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions compiler/src/iree/compiler/Dialect/Flow/Transforms/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,12 @@ void buildFlowTransformPassPipeline(OpPassManager &passManager,
}

// Preprocessing passes to get the program into a canonical state.
passManager.addPass(IREE::Flow::createEraseUnusedLinalgOperands());
FunctionLikeNest(passManager)
.addPass(IREE::Flow::createRemoveZeroExtentTensorsPass)
.addPass(IREE::Flow::createDetachElementwiseFromNamedOpsPass)
.addPass(mlir::createLinalgNamedOpConversionPass)
.addPass(IREE::Flow::createConvert1X1FilterConv2DToMatmulPass);
passManager.addPass(IREE::Flow::createEraseUnusedLinalgOperands());
FunctionLikeNest(passManager)
// Preprocess the input to a form more amenable for fusion
// - Convert all elementwise ops to Linalg
// - Remove unit-extent dimensions.
.addPass(mlir::createConvertElementwiseToLinalgPass)
.addPass(createGeneralizeLinalgNamedOpsPass)
.addPass(createFoldUnitExtentDimsPass)
.addPass(createRaiseSpecialOps)
.addPass(createInterchangeGenericOpsPass)
.addPass(createCollapseDimsPass)
.addPass(memref::createResolveShapedTypeResultDimsPass)
.addPass(mlir::createCanonicalizerPass)
.addPass(mlir::createCSEPass)
.addPass(IREE::Flow::createConvert1X1FilterConv2DToMatmulPass)
.addPredicatedPass(clEnableDataTiling, createSetEncodingPass);

// Start of Flow pipeline, verify input legality.
Expand All @@ -253,6 +240,18 @@ void buildFlowTransformPassPipeline(OpPassManager &passManager,
}

FunctionLikeNest(passManager)
// Preprocess the input to a form more amenable for fusion
// - Convert all elementwise ops to Linalg
// - Remove unit-extent dimensions.
.addPass(mlir::createConvertElementwiseToLinalgPass)
.addPass(createGeneralizeLinalgNamedOpsPass)
.addPass(createFoldUnitExtentDimsPass)
.addPass(createRaiseSpecialOps)
.addPass(createInterchangeGenericOpsPass)
.addPass(createCollapseDimsPass)
.addPass(memref::createResolveShapedTypeResultDimsPass)
.addPass(mlir::createCanonicalizerPass)
.addPass(mlir::createCSEPass)
// Elementwise fusion.
.addPass(
[]() { return createFusionOfTensorOpsPass(clEnableFuseMultiUse); })
Expand Down

0 comments on commit ff8c92c

Please sign in to comment.