This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Math] Support fold PowFOp with constant dense.
ClosedPublic

Authored by jacquesguan on Jul 5 2022, 1:03 AM.

Details

Summary

This patch adds a conditional binary constant folder which allow to exit when the constants not meet the fold condition. And use it for PowFOp to make it able to fold the constant dense.

Diff Detail

Event Timeline

jacquesguan created this revision.Jul 5 2022, 1:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 1:03 AM
jacquesguan requested review of this revision.Jul 5 2022, 1:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2022, 1:03 AM
Mogball requested changes to this revision.Jul 5 2022, 7:23 AM
Mogball added inline comments.
mlir/include/mlir/Dialect/CommonFolders.h
77

This duplicates a lot of code with constFoldBinaryOp. Can you change the latter to call into this function?

This revision now requires changes to proceed.Jul 5 2022, 7:23 AM

Address comment.

jacquesguan marked an inline comment as done.Jul 5 2022, 11:18 PM
jacquesguan added inline comments.
mlir/include/mlir/Dialect/CommonFolders.h
77

Done, thanks.

Mogball accepted this revision.Jul 6 2022, 8:18 AM
This revision is now accepted and ready to land.Jul 6 2022, 8:18 AM
This revision was automatically updated to reflect the committed changes.
jacquesguan marked an inline comment as done.