Page MenuHomePhabricator

[mlir][CAPI] Add CAPI bindings for the sparse_tensor dialect.

Authored by stellaraccident on May 9 2021, 4:17 PM.


  • Adds dialect registration, hand coded 'encoding' attribute and test.
  • An MLIR CAPI tablegen backend for attributes does not exist, and this is a relatively complicated case. I opted to hand code it in a canonical way for now, which will provide a reasonable blueprint for building out the tablegen version in the future.
  • Also added a (local) CMake function for declaring new CAPI tests, since it was getting repetitive/buggy.

Diff Detail

Event Timeline

stellaraccident created this revision.May 9 2021, 4:17 PM
stellaraccident requested review of this revision.May 9 2021, 4:17 PM

Also adding Alex for a look, since I think this is the first such case (dialect attribute) we have in tree.

ftynse accepted this revision.May 10 2021, 6:26 AM
ftynse added inline comments.

Nit: can this use a raw literal or be wrapper in // clang-format off / // clang-format on to avoid awkward string reformatting?

This revision is now accepted and ready to land.May 10 2021, 6:26 AM

It's C, so opted for the clang-format option and reflowed.

This revision was landed with ongoing or failed builds.May 10 2021, 9:55 AM
This revision was automatically updated to reflect the committed changes.

This broke the windows build bot, and I missed it. Rolling forward fix in: