Skip to content

Commit

Permalink
move them after expand_shape
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhanW committed Aug 24, 2023
1 parent aa33602 commit 047a194
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions compiler/src/iree/compiler/GlobalOptimization/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ void buildGlobalOptimizationPassPipeline(
.addPass(mlir::createLinalgNamedOpConversionPass)
.addPass(IREE::Flow::createConvert1X1FilterConv2DToMatmulPass);
mainPassManager.addPass(IREE::Flow::createEraseUnusedLinalgOperands());

// Expand tensor shapes into SSA values and optimize the whole program.
// The more we are able to equate shape dimensions at this level the
// better our fusions will be.
FunctionLikeNest(mainPassManager)
.addPass(IREE::Flow::createTopLevelSCFToCFGPass);
mainPassManager.addPass(IREE::Flow::createExpandTensorShapesPass());

FunctionLikeNest(mainPassManager)
// Preprocess the input to a form more amenable for fusion
// - Convert all elementwise ops to Linalg
Expand All @@ -43,13 +51,6 @@ void buildGlobalOptimizationPassPipeline(
.addPass(mlir::createCanonicalizerPass)
.addPass(mlir::createCSEPass);

// Expand tensor shapes into SSA values and optimize the whole program.
// The more we are able to equate shape dimensions at this level the
// better our fusions will be.
FunctionLikeNest(mainPassManager)
.addPass(IREE::Flow::createTopLevelSCFToCFGPass);
mainPassManager.addPass(IREE::Flow::createExpandTensorShapesPass());

OpPassManager pipeline(ModuleOp::getOperationName());
FunctionLikeNest(pipeline)
// Simplify util.global accesses early on; this can help with dispatch
Expand Down

0 comments on commit 047a194

Please sign in to comment.