This is an archive of the discontinued LLVM Phabricator instance.

[mlir] More Python bindings for AffineMap
ClosedPublic

Authored by ftynse on Jan 8 2021, 5:21 AM.

Details

Summary

Now that the bindings for AffineExpr have been added, add more bindings for
constructing and inspecting AffineMap that consists of AffineExprs.

Depends On D94225

Diff Detail

Event Timeline

ftynse created this revision.Jan 8 2021, 5:21 AM
ftynse requested review of this revision.Jan 8 2021, 5:21 AM
ftynse added inline comments.Jan 8 2021, 5:24 AM
mlir/lib/Bindings/Python/IRModules.cpp
3887–3904

These are instance methods that derive a new map from the given map in C++ so I kept them as such. An alternative approach is to make them static similarly to other get methods and take the map map as an explicit first argument.

mehdi_amini added inline comments.Jan 8 2021, 4:34 PM
mlir/lib/Bindings/Python/IRModules.cpp
3811

Can you spell the type here?

3875

Can't you take a vector of unsigned here? Pybind wouldn't be happy with it? It'll avoid the manual conversion.

3890

Seems like this would crash without more sanity checking here that none of the indices in resultPos overflow the AffineMap size.

I suspect other places have the same issue in sibling methods.

ftynse updated this revision to Diff 315778.Jan 11 2021, 5:54 AM
ftynse marked 3 inline comments as done.

Address review

mehdi_amini accepted this revision.Jan 11 2021, 10:01 AM
This revision is now accepted and ready to land.Jan 11 2021, 10:01 AM
This revision was landed with ongoing or failed builds.Jan 11 2021, 10:57 AM
This revision was automatically updated to reflect the committed changes.