Skip to content

Commit

Permalink
Fix to use OpOperand* in ControlPropagationFn
Browse files Browse the repository at this point in the history
Signed-off-by: yzhang93 <zhyuhang88@gmail.com>
  • Loading branch information
yzhang93 committed Jul 9, 2024
1 parent eab50ac commit a99394c
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 95 deletions.
6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/iree.iml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/vcs.xml

This file was deleted.

42 changes: 0 additions & 42 deletions .idea/workspace.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void transform_dialect::ApplyBubbleExpandPatternsOp::populatePatterns(
void transform_dialect::ApplyBubblePackUnpackPatternsOp::populatePatterns(
RewritePatternSet &patterns) {
linalg::populateDataLayoutPropagationPatterns(
patterns, [](Operation *op) { return true; });
patterns, [](OpOperand *opOperand) { return true; });
}

void transform_dialect::ApplyFoldReshapeIntoTensorHalInterfacePatternsOp::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void PackToIntrinsicsPass::runOnOperation() {

// Run layout propagation patterns to pull in adjacent un-configured ops.
RewritePatternSet patterns(context);
linalg::ControlPropagationFn control = [](Operation *op) -> bool {
return !getLoweringConfig(op);
linalg::ControlPropagationFn control = [](OpOperand *opOperand) -> bool {
return !getLoweringConfig(opOperand->getOwner());
};

linalg::populateDataLayoutPropagationPatterns(patterns, control);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ struct DataLayoutPropagationPass
FunctionOpInterface funcOp = getOperation();

RewritePatternSet patterns(context);
linalg::populateDataLayoutPropagationPatterns(patterns, [](Operation *op) {
// Currently only bubble up/push down pack/unpack through collapse/expand
// shape ops.
// TODO(#17734): The propagation through expand_shape ops is broken.
// Enable the propagation once we find it useful and the upstream issue is
// fixed.
return isa<tensor::CollapseShapeOp>(op);
});
linalg::populateDataLayoutPropagationPatterns(
patterns, [](OpOperand *opOperand) {
// Currently only bubble up/push down pack/unpack through
// collapse/expand shape ops.
// TODO(#17734): The propagation through expand_shape ops is broken.
// Enable the propagation once we find it useful and the upstream
// issue is fixed.
return isa<tensor::CollapseShapeOp>(opOperand->get().getDefiningOp());
});
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
funcOp.emitOpError("folding patterns failed");
return signalPassFailure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void GeneralizeLinalgNamedOpsPass::runOnOperation() {
linalg::DivUnsignedOp, linalg::ElemwiseBinaryOp,
linalg::ElemwiseUnaryOp, linalg::ExpOp, linalg::FloorOp,
linalg::LogOp, linalg::MapOp, linalg::MaxOp,
linalg::MulOp, linalg::NegfOp, linalg::ReduceOp,
linalg::MulOp, linalg::NegFOp, linalg::ReduceOp,
linalg::SubOp, linalg::TransposeOp>(
linalgOp.getOperation())) {
namedOpCandidates.push_back(linalgOp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ class ConvertConvToChannelsLastPass
GreedyRewriteConfig config;
config.maxIterations = GreedyRewriteConfig::kNoLimit;
linalg::populateDataLayoutPropagationPatterns(
patterns, [](Operation *op) { return true; });
patterns, [](OpOperand *opOperand) { return true; });
if (failed(
applyPatternsAndFoldGreedily(op, std::move(patterns), config))) {
return signalPassFailure();
Expand Down

0 comments on commit a99394c

Please sign in to comment.