Page MenuHomePhabricator

[mlir] expose standard types to C API

Authored by ftynse on Aug 17 2020, 10:58 AM.



Provide C API for MLIR standard types. Since standard types live under lib/IR
in core MLIR, place the C APIs in the IR library as well (standard ops will go
into a separate library). This also defines a placeholder for affine maps that
are necessary to construct a memref, but are not yet exposed to the C API.

Diff Detail

Event Timeline

ftynse created this revision.Aug 17 2020, 10:58 AM
Herald added a project: Restricted Project. · View Herald Transcript
ftynse requested review of this revision.Aug 17 2020, 10:58 AM
ftynse added inline comments.Aug 17 2020, 11:00 AM

@stellaraccident rank and shape are int64_tin C++ (not unsigned as usual), do we want to keep them as is or use intptr_t instead?


Apparently there is a problem with printing unranked memrefs in non-default memory space.

ftynse added inline comments.Aug 17 2020, 11:27 AM
stellaraccident accepted this revision.Aug 17 2020, 9:47 PM
stellaraccident added inline comments.

I think these should be int64_t since that is the natural range of the value, regardless of platform. I would apply this rule: the compiler should be able to represent the same program IR regardless of whether it is built with a 32 or 64bit pointer size (within the limit of not being able to express programs that exceed internal limits of data structure sizes).


I think this is fine as an intptr_t: these relate to the sizes of ir internal data structures.


Shouldn't this be size_t (and I'm the function)

This revision is now accepted and ready to land.Aug 17 2020, 9:47 PM
ftynse updated this revision to Diff 286211.Aug 18 2020, 12:53 AM
ftynse marked 5 inline comments as done.

Rebase on top of a bugfix and address review.

ftynse updated this revision to Diff 286215.Aug 18 2020, 1:29 AM

Rebase once more

This revision was landed with ongoing or failed builds.Aug 18 2020, 4:11 AM
This revision was automatically updated to reflect the committed changes.