This is an archive of the discontinued LLVM Phabricator instance.

Fix MLIR Python binding for arith.constant after argument has been changed to an interface
ClosedPublic

Authored by mehdi_amini on Aug 1 2022, 1:56 AM.

Details

Summary

e1795322844c removed the Type field from attributes and
arith::ConstantOp argument is now a TypedAttrInterface which isn't
supported by the python generator.
This patch temporarily restore the functionality for arith.constant but
won't generalize: we need to work on the generator instead.

Diff Detail

Event Timeline

mehdi_amini created this revision.Aug 1 2022, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2022, 1:56 AM
mehdi_amini requested review of this revision.Aug 1 2022, 1:56 AM
ftynse added inline comments.Aug 1 2022, 2:00 AM
mlir/python/mlir/dialects/_arith_ops_ext.py
64

Nit: the code above and below seems to be fine without the builtins. namespace.

mlir/test/python/dialects/arith_dialect.py
17

Nit: it's okay to construct constants directly in the module, we don't need this extra complexity in the test.

Address comments

ftynse accepted this revision.Aug 1 2022, 2:06 AM
This revision is now accepted and ready to land.Aug 1 2022, 2:06 AM
This revision was landed with ongoing or failed builds.Aug 1 2022, 2:07 AM
This revision was automatically updated to reflect the committed changes.