Skip to content

Commit

Permalink
Propagate reshapes through generics with reduction iterators
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
  • Loading branch information
IanWood1 committed Oct 21, 2024
1 parent 114a142 commit a39d2e4
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ void BubbleUpExpandShapesPass::runOnOperation() {
// Do not fuse producer generic op if it has more than one user
// or any reduction iterators.
if (auto producerGenericOp = dyn_cast<linalg::GenericOp>(producer)) {
return producerGenericOp->hasOneUse() &&
llvm::all_of(producerGenericOp.getIteratorTypesArray(),
linalg::isParallelIterator);
return producerGenericOp->hasOneUse();
}

// Do not fuse with any producer linalg named ops for now.
Expand All @@ -72,9 +70,7 @@ void BubbleUpExpandShapesPass::runOnOperation() {

// Do not fuse with consumer linalg named ops or reductions.
if (auto consumerLinalgOp = dyn_cast<linalg::LinalgOp>(consumer)) {
return isa<linalg::GenericOp>(consumerLinalgOp) &&
llvm::all_of(consumerLinalgOp.getIteratorTypesArray(),
linalg::isParallelIterator);
return isa<linalg::GenericOp>(consumerLinalgOp);
}
// Fuse in all other cases.
return true;
Expand Down

0 comments on commit a39d2e4

Please sign in to comment.