@@ -54,11 +54,6 @@ static llvm::cl::opt<bool> clEnableFuseHorizontalContractions(
54
54
" Enables horizontal fusion of contractions with one common operand" ),
55
55
llvm::cl::init(false ));
56
56
57
- static llvm::cl::opt<bool >
58
- clEnableFuseMultiUse (" iree-dispatch-creation-fuse-multi-use" ,
59
- llvm::cl::desc (" Fuse multi-use ops." ),
60
- llvm::cl::init(false ));
61
-
62
57
static llvm::cl::opt<bool > clEnableDataTiling (
63
58
" iree-dispatch-creation-experimental-data-tiling" ,
64
59
llvm::cl::desc (" Enable data-tiling at flow level, i.e., it sets encodings "
@@ -116,7 +111,9 @@ static void addCleanupPatterns(OpPassManager &passManager) {
116
111
// Pipelines
117
112
// ===----------------------------------------------------------------------===//
118
113
119
- void addDispatchRegionCreationPreprocessingPasses (OpPassManager &passManager) {
114
+ static void addDispatchRegionCreationPreprocessingPasses (
115
+ OpPassManager &passManager,
116
+ const DispatchCreationOptions &dispatchOptions) {
120
117
// 1. Do some simple elementwise op fusion. This could be skipped,
121
118
// but could reduce the surface area of ops to handle later.
122
119
FunctionLikeNest (passManager)
@@ -161,7 +158,11 @@ void addDispatchRegionCreationPreprocessingPasses(OpPassManager &passManager) {
161
158
FunctionLikeNest (passManager)
162
159
// 5. After all the reshape propagations, fuse elementwise operations
163
160
// even if the producer has multiple uses.
164
- .addPass (DispatchCreation::createFuseMultiUseElementwiseProducerPass)
161
+ .addPredicatedPass (dispatchOptions.enableFuseMultiUse ,
162
+ [&]() {
163
+ return DispatchCreation::
164
+ createFuseMultiUseElementwiseProducerPass ();
165
+ })
165
166
166
167
// 6. Some more "post elementwise fusion passes".
167
168
// a. Detensorize.
@@ -312,7 +313,8 @@ void buildDispatchCreationPassPipeline(
312
313
.addPass (IREE::Flow::createCanonicalizePass)
313
314
.addPass (mlir::createCSEPass);
314
315
315
- addDispatchRegionCreationPreprocessingPasses (passManager);
316
+ addDispatchRegionCreationPreprocessingPasses (passManager,
317
+ transformOptions.options );
316
318
addDispatchRegionCreationPasses (passManager, transformOptions.options );
317
319
318
320
FunctionLikeNest (passManager)
@@ -363,13 +365,16 @@ void registerDispatchCreationPipelines() {
363
365
buildDispatchCreationPassPipeline (passManager, transformOptions);
364
366
});
365
367
366
- PassPipelineRegistration<> dispatchCreationPreprocessingPipeline (
367
- " iree-dispatch-creation-preprocessing-pipeline" ,
368
- " Flag used to run preprocessing passes that run passes before dispatch "
369
- " region formation. Used only for testing" ,
370
- [](OpPassManager &passManager) {
371
- addDispatchRegionCreationPreprocessingPasses (passManager);
372
- });
368
+ PassPipelineRegistration<TransformOptions>
369
+ dispatchCreationPreprocessingPipeline (
370
+ " iree-dispatch-creation-preprocessing-pipeline" ,
371
+ " Flag used to run preprocessing passes that run passes before "
372
+ " dispatch region formation. Used only for testing" ,
373
+ [](OpPassManager &passManager,
374
+ const TransformOptions &transformOptions) {
375
+ addDispatchRegionCreationPreprocessingPasses (
376
+ passManager, transformOptions.options );
377
+ });
373
378
}
374
379
375
380
} // namespace mlir::iree_compiler::DispatchCreation
0 commit comments