Page MenuHomePhabricator

[mlir-c] Add binding to enable populating default attributes on create
AcceptedPublic

Authored by jpienaar on Jul 8 2022, 1:14 PM.

Details

Reviewers
rriddle
jfurtek
Summary

Follow the approach set by infer return types attributes setting during
construction and add call to populate default attributes. This method
returns no error state and treating the absence of registered op merely
as warning as it doesn't invalidate the validity of the op being
constructed (contrary to return type inference case).

Previously I also had C binding that invokes it on the op (it matches
the C++ side) but its not the preferred way of invoking the populating,
so not exposing C API side.

Showed usage Python side but intention is for that to be follow up and
will remove before submitting.

Diff Detail

Event Timeline

jpienaar created this revision.Jul 8 2022, 1:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2022, 1:14 PM
jpienaar requested review of this revision.Jul 8 2022, 1:14 PM
rriddle accepted this revision.Jul 8 2022, 1:22 PM
rriddle added inline comments.
mlir/lib/Bindings/Python/IRCore.cpp
1215–1216

Can you file an issue to detail and track this? Would be good to have more context on the desired state.

This revision is now accepted and ready to land.Jul 8 2022, 1:22 PM

Is there any chance someone with commit privileges can land this? It was approved a month ago.

fastmath support in the arithmetic dialect needs this diff (or something like it) for a default value. There are many Python tests that create arithmetic operations without providing a value for fastmath (because it doesn't exist yet), and I think this will help.

Is there any chance someone with commit privileges can land this? It was approved a month ago.

fastmath support in the arithmetic dialect needs this diff (or something like it) for a default value. There are many Python tests that create arithmetic operations without providing a value for fastmath (because it doesn't exist yet), and I think this will help.

I think @jpienaar has commit privileges, but I can commit this after removing the FIXME code in mlir/lib/Bindings/Python/IRCore.cpp. @jpienaar, @rriddle, would you be okay with this?

This should now be default behavior in all cases (C++ build, C, Python). Sorry I didn't get notification here and I was blocked on some procedural parts of landing previous one until last week. Let me know if that change worked.