This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Provide some methods and properties for API completeness
ClosedPublic

Authored by ftynse on Oct 11 2021, 9:25 AM.

Details

Summary

When writing the user-facing documentation, I noticed several inconsistencies
and asymmetries in the Python API we provide. Fix them by adding:

  • the owner property to regions, similarly to blocks;
  • the isinstance method to any class derived from PyConcreteAttr, PyConcreteValue and PyConreteAffineExpr, similar to PyConcreteType to enable isa-like calls without having to handle exceptions;
  • a mechanism to create the first block in the region as we could only create blocks relative to other blocks, with is impossible in an empty region.

Diff Detail

Event Timeline

ftynse created this revision.Oct 11 2021, 9:25 AM
ftynse requested review of this revision.Oct 11 2021, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2021, 9:25 AM
gysit accepted this revision.Oct 11 2021, 10:31 AM

LGTM!

mlir/lib/Bindings/Python/IRAffine.cpp
102–104

is this working similar to attributes, i.e. one can distinguish const / dim expressions etc? then a small test could make sense as well?

This revision is now accepted and ready to land.Oct 11 2021, 10:31 AM
This revision was automatically updated to reflect the committed changes.
ftynse marked an inline comment as done.