Skip to content

Commit

Permalink
[NFC] Clarify comments in BubbleUpExpand shapes pass. (#19837)
Browse files Browse the repository at this point in the history
The comments were written in terms of "fusion", but this pass is not
fusing, it is moving reshapes. Make that clear from comments.

Signed-off-by: MaheshRavishankar <[email protected]>
  • Loading branch information
MaheshRavishankar authored Jan 28, 2025
1 parent 9870a6d commit 2f91d11
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,28 @@ void BubbleUpExpandShapesPass::runOnOperation() {
return false;
}

// Do not fuse by expand if consumer is dequant.
// Do not push down collapse shape across consumer if it is a bit-extend
// op. The bit-extend ops get cloned into producer dispatches, and the
// `collapse_shape` op going past dequant, prevents this clong.
if (IREE::LinalgExt::isBitExtendOp(consumer)) {
return false;
}

// Do not fuse producer generic op if it has more than one user
// or any reduction iterators.
// If producer generic op is elementwise op, bubble up the expand shape
// past this operation.
if (auto producerGenericOp = dyn_cast<linalg::GenericOp>(producer)) {
return llvm::all_of(producerGenericOp.getIteratorTypesArray(),
linalg::isParallelIterator);
}

// Do not fuse with any producer linalg named ops for now.
// Do not bubble up expand shapes across named ops for now.
if (isa<linalg::LinalgOp>(producer)) {
return false;
}

// Do not fuse with consumer linalg named ops or reductions.
// Do not push expand shapes down across operations with reduction
// iterator types.
// TODO: This condition should be removed.
if (auto consumerLinalgOp = dyn_cast<linalg::LinalgOp>(consumer)) {
return isa<linalg::GenericOp>(consumerLinalgOp) &&
llvm::all_of(consumerLinalgOp.getIteratorTypesArray(),
Expand Down

0 comments on commit 2f91d11

Please sign in to comment.