How to disable folding for particular ops in applyPatternsAndFoldGreedily?

Skip to first unread message

Alexander Pivovarov

May 24, 2024, 1:41:58 AMMay 24
to OpenXLA Discuss
Hello Everyone

LowerComplex mhlo pass uses applyPatternsAndFoldGreedily.
The doc says
/// Also performs folding and simple dead-code elimination before attempting to
/// match any of the provided patterns.

How to disable folding for particular ops?
In particular I need to preserve mhlo.copy op

The only workaround I found so far is to patch and return {} in CopyOp::fold() instead of getOperand().

I would appreciate any help and ideas

Thank you
Reply all
Reply to author
0 new messages