HomePhabricator

[mlir] Add shaped container component type interface

Authored by jpienaar on Jan 8 2020, 6:48 PM.

Description

[mlir] Add shaped container component type interface

Summary:

  • Add shaped container type interface which allows infering the shape, element type and attribute of shaped container type separately. Show usage by way of tensor type inference trait which combines the shape & element type in infering a tensor type;
    • All components need not be specified;
    • Attribute is added to allow for layout attribute that was previously discussed;
  • Expand the test driver to make it easier to test new creation instances (adding new operands or ops with attributes or regions would trigger build functions/type inference methods);
    • The verification part will be moved out of the test and to verify method instead of ops implementing the type inference interface in a follow up;
  • Add MLIRContext as arg to possible to create type for ops without arguments, region or location;
  • Also move out the section in OpDefinitions doc to separate ShapeInference doc where the shape function requirements can be captured;
    • Part of this would move to the shape dialect and/or shape dialect ops be included as subsection of this doc;
  • Update ODS's variable usage to match camelBack format for builder, state and arg variables;
    • I could have split this out, but I had to make some changes around these and the inconsistency bugged me :)

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