Page MenuHomePhabricator

[mlir] More Python bindings for AffineMap

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



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

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

Can you spell the type here?


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


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.