HomePhabricator

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

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

Description

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

  • 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.

Differential Revision: https://reviews.llvm.org/D102141