This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Provide more convenient constructors for std.CallOp
ClosedPublic

Authored by ftynse on Oct 1 2021, 9:33 AM.

Details

Summary

The new constructor relies on type-based dynamic dispatch and allows one to
construct call operations given an object representing a FuncOp or its name as
a string, as opposed to requiring an explicitly constructed attribute.

Depends On D110947

Diff Detail

Event Timeline

ftynse created this revision.Oct 1 2021, 9:33 AM
ftynse requested review of this revision.Oct 1 2021, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2021, 9:33 AM
stellaraccident accepted this revision.Oct 1 2021, 10:32 AM
stellaraccident added inline comments.
mlir/python/mlir/dialects/_builtin_ops_ext.py
84–85

As I've been looking at docs and using intellisense more, I've come to see all of the typing debt we have. Wdyt about, when touching these things, adding return type annotations?

mlir/python/mlir/dialects/_std_ops_ext.py
104

Nit: agreed on having a more general overload mechanism. Not sure metaclasses are the answer (anything Pybind rooted requires its own metaclass).

This revision is now accepted and ready to land.Oct 1 2021, 10:32 AM
ftynse updated this revision to Diff 376834.Oct 4 2021, 2:39 AM
ftynse marked 2 inline comments as done.

Address review.

ftynse added inline comments.Oct 4 2021, 2:39 AM
mlir/python/mlir/dialects/_builtin_ops_ext.py
84–85

Absolutely! At the moment, autocomplete is so broken for me that I don't even try turning it on...

mlir/python/mlir/dialects/_std_ops_ext.py
104

I am secretly hoping to reuse Pybind's metaclass that, AFAIU, provides the overloading mechanism for functions defined in C++.

stellaraccident added inline comments.Oct 4 2021, 6:03 AM
mlir/python/mlir/dialects/_std_ops_ext.py
104

I am secretly hoping to reuse Pybind's metaclass that, AFAIU, provides the overloading mechanism for functions defined in C++.

I applaud your optimism. I think I'm going to watch this experiment... From way over here :)