[mlir] Make MemRef element type extensible
authorAlex Zinenko <zinenko@google.com>
Mon, 7 Jun 2021 16:33:29 +0000 (18:33 +0200)
committerAlex Zinenko <zinenko@google.com>
Tue, 8 Jun 2021 09:11:30 +0000 (11:11 +0200)
commitada9aa5a228200cb71269c371308e82c42fd4abc
tree712cb105b245f19abf1bf9d23b7df02e06e9f9ee
parent3c70a82e2891949801bd5da68159cd8156659f6f
[mlir] Make MemRef element type extensible

Historically, MemRef only supported a restricted list of element types that
were known to be storable in memory. This is unnecessarily restrictive given
the open nature of MLIR's type system. Allow types to opt into being used as
MemRef elements by implementing a type interface. For now, the interface is
merely a declaration with no methods. Later, methods to query, e.g., the type
size or whether a type can alias elements of another type may be added.

Harden the "standard"-to-LLVM conversion against memrefs with non-builtin
types.

See https://llvm.discourse.group/t/rfc-memref-of-custom-types/3558.

Depends On D103826

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D103827
mlir/docs/Dialects/Builtin.md
mlir/include/mlir/IR/BuiltinTypes.h
mlir/include/mlir/IR/BuiltinTypes.td
mlir/include/mlir/IR/CMakeLists.txt
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/IR/BuiltinTypes.cpp
mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
mlir/test/Conversion/StandardToLLVM/invalid.mlir
mlir/test/IR/parser.mlir
mlir/test/lib/Dialect/Test/CMakeLists.txt
mlir/test/lib/Dialect/Test/TestTypeDefs.td