This is an archive of the discontinued LLVM Phabricator instance.

Remove DialectHooks and introduce a Dialect Interfaces instead
ClosedPublic

Authored by mehdi_amini on Aug 8 2020, 8:19 PM.

Details

Summary

These hooks were introduced before the Interfaces mechanism was available.

DialectExtractElementHook is unused and entirely removed. The
DialectConstantFoldHook is used a fallback in the
operation fold() method, and is replaced by a DialectInterface.
The DialectConstantDecodeHook is used for interpreting OpaqueAttribute
and should be revamped, but is replaced with an interface in 1:1 fashion
for now.

Diff Detail

Event Timeline

mehdi_amini created this revision.Aug 8 2020, 8:19 PM
Herald added a project: Restricted Project. · View Herald Transcript
mehdi_amini requested review of this revision.Aug 8 2020, 8:19 PM

Move the default implementation to the header / remove the .cpp file for the interface

Restore DecodeHook as an interface

mehdi_amini edited the summary of this revision. (Show Details)Aug 8 2020, 9:27 PM
mehdi_amini retitled this revision from Remove DialectHooks and introduce a ConstantFoldInterface for Dialects to Remove DialectHooks and introduce a Dialect Interfaces instead.

Thank you for cleaning this up!

mlir/include/mlir/Interfaces/ConstantFoldInterfaces.h
1 ↗(On Diff #284167)

This is off.

21 ↗(On Diff #284167)

Can you merge the OpFolderDialectInterface into this one, and remove all of the uses of "Constant" here. We've been using just "Fold" to refer to general folding.

mehdi_amini edited the summary of this revision. (Show Details)

Rename (drop the "Constant" from the name)

mehdi_amini marked 2 inline comments as done.
mehdi_amini added inline comments.
mlir/include/mlir/Interfaces/ConstantFoldInterfaces.h
21 ↗(On Diff #284167)

Done in the child revision: https://reviews.llvm.org/D85823

mehdi_amini marked an inline comment as done.

use lower case for the method

rriddle accepted this revision.Aug 12 2020, 2:18 PM
rriddle added inline comments.
mlir/include/mlir/Interfaces/FoldInterfaces.h
20

nit: Remove the constant from comments here and below.

This revision is now accepted and ready to land.Aug 12 2020, 2:18 PM
This revision was landed with ongoing or failed builds.Aug 12 2020, 5:41 PM
This revision was automatically updated to reflect the committed changes.
mlir/include/mlir/IR/Dialect.h