This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Allow specifying block arg locations
ClosedPublic

Authored by rkayaith on May 7 2023, 9:16 PM.

Details

Summary

Currently blocks are always created with UnknownLoc's for their arguments. This
adds an arg_locs argument to all block creation APIs, which takes an optional
sequence of locations to use, one per block argument. If no locations are
supplied, the current Location context is used.

Diff Detail

Event Timeline

rkayaith created this revision.May 7 2023, 9:16 PM
Herald added a project: Restricted Project. · View Herald Transcript
rkayaith published this revision for review.May 8 2023, 10:56 AM
ftynse accepted this revision.May 9 2023, 3:17 AM
ftynse added inline comments.
mlir/lib/Bindings/Python/IRCore.cpp
196

Nit: let's not specify the number of stack elements unless there is a good reason to.

This revision is now accepted and ready to land.May 9 2023, 3:17 AM
This revision was automatically updated to reflect the committed changes.
rkayaith marked an inline comment as done.
rkayaith added inline comments.
mlir/lib/Bindings/Python/IRCore.cpp
3002–3004

Support for arguments after py::args like this was only added in pybind 2.9.0 (see changelog, https://github.com/pybind/pybind11/pull/3402), but the minimum version we set is 2.8.0. I can probably work around this, but any objections to just raising the min version to 2.9.0? It was released on December 28, 2021 @ftynse @stellaraccident

The mlir-nvidia buildbot is using 2.8, I'm not sure what the process for updating it would be.

stellaraccident added inline comments.May 9 2023, 3:29 PM
mlir/lib/Bindings/Python/IRCore.cpp
3002–3004

I'm fine with upgrading. How to upgrade though has rolled off of my working memory.

rkayaith reopened this revision.May 16 2023, 8:56 AM

reopening so I remember to land this again once the bot is updated

This revision is now accepted and ready to land.May 16 2023, 8:56 AM
This revision was automatically updated to reflect the committed changes.