Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions shardy/dialect/sdy/transforms/export/export_pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ void runShardyPartitioner(OpPassManager& pm, int& dumpIndex,
pm.addPass(mlir::sdy::createSaveModuleOpPass(
options.dumpDirectory, "after_explicit_reshards", dumpIndex++));
addCanonicalizerPass(pm, kReshardLabel);
pm.addPass(createExportNamedComputationsPass());
pm.addNestedPass<func::FuncOp>(createReshardToCollectivesPass());
// NOTE: ReshardToCollectives pass above generates all-slice collectives,
// which during the canonicalizer below may be converted to reduce scatters
// by potentially fusing with preceeding all-reduces, which are inserted
// during InsertExplicitReshards pass.
} else {
pm.addPass(createExportNamedComputationsPass());
}
addCanonicalizerPass(pm, kCollectiveLabel);
if (options.enableInsertExplicitCollectives &&
Expand Down Expand Up @@ -98,12 +101,12 @@ void addExportPipeline(OpPassManager& pm, int& dumpIndex,
// reshards/collectives.
if (!options.avoidExportForPartitioning) {
runShardyPartitioner(pm, dumpIndex, options);
} else {
pm.addPass(createExportNamedComputationsPass());
}

if (options.dumpPropagationEdges || options.dumpShardingOrigins) {
pm.addPass(createRemovePropagationDebugInfoPass());
}
pm.addPass(createExportNamedComputationsPass());
if (!options.keepShardingRules) {
pm.addNestedPass<func::FuncOp>(createDropShardingRulesPass());
}
Expand Down
Loading