How to disable folding for particular ops in applyPatternsAndFoldGreedily?

29 views
Skip to first unread message

Alexander Pivovarov

unread,
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 hlo_ops.cc and return {} in CopyOp::fold() instead of getOperand().

I would appreciate any help and ideas

Thank you
Alex
Reply all
Reply to author
Forward
0 new messages