Skip to content

Commit 11056ea

Browse files
authored
Running cleanup before -iree-stream-optimization-pipeline. (#8156)
Turns out that if you write passes that rely on canonicalization and CSE it really helps if you actually run them.
1 parent 7dd6719 commit 11056ea

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

iree/compiler/Dialect/Stream/Transforms/Passes.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,15 @@ void buildStreamCmdPassPipeline(OpPassManager &passManager,
223223

224224
void buildStreamOptimizationPassPipeline(
225225
OpPassManager &passManager, const TransformOptions &transformOptions) {
226+
// Forming streams involves a fair amount of subgraph stitching, which can
227+
// cause duplication. Run CSE to collapse.
228+
addCleanupPatterns(passManager);
229+
226230
//----------------------------------------------------------------------------
227231
// Binding optimization
228232
//----------------------------------------------------------------------------
229233

230234
if (transformOptions.optimizeBindings) {
231-
// Canonicalizer needs to run so that we have predictable inputs for fusion.
232-
passManager.addPass(mlir::createCanonicalizerPass());
233235
passManager.addPass(IREE::Stream::createFuseDispatchBindingsPass());
234236

235237
// Folding operands requires that CSE folds the inputs that we check for.
@@ -284,8 +286,7 @@ void buildStreamTransformPassPipeline(
284286
// Post-pipeline cleanup
285287
//----------------------------------------------------------------------------
286288

287-
// Forming streams involves a fair amount of subgraph stitching, which can
288-
// cause duplication. Run CSE to collapse.
289+
// Final cleanup after we optimize dispatches and fuse operands and bindings.
289290
addCleanupPatterns(passManager);
290291

291292
// Symbol DCE any remaining variables/functions that are now no longer

0 commit comments

Comments
 (0)