[mlir] support memref of memref in standard-to-llvm conversion
authorAlex Zinenko <zinenko@google.com>
Mon, 7 Jun 2021 16:33:42 +0000 (18:33 +0200)
committerAlex Zinenko <zinenko@google.com>
Tue, 8 Jun 2021 09:11:31 +0000 (11:11 +0200)
commitc59ce1f6257c88330c1f1757c36d59d34fe29248
tree4156b4848877b71caa61ec88379398136db1a37c
parentada9aa5a228200cb71269c371308e82c42fd4abc
[mlir] support memref of memref in standard-to-llvm conversion

Now that memref supports arbitrary element types, add support for memref of
memref and make sure it is properly converted to the LLVM dialect. The type
support itself avoids adding the interface to the memref type itself similarly
to other built-in types. This allows the shape, and therefore byte size, of the
memref descriptor to remain a lowering aspect that is easier to customize and
evolve as opposed to sanctifying it in the data layout specification for the
memref type itself.

Factor out the code previously in a testing pass to live in a dedicated data
layout analysis and use that analysis in the conversion to compute the
allocation size for memref of memref. Other conversions will be ported
separately.

Depends On D103827

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D103828
13 files changed:
mlir/include/mlir/Analysis/DataLayoutAnalysis.h [new file with mode: 0644]
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
mlir/include/mlir/IR/BuiltinTypes.h
mlir/include/mlir/IR/BuiltinTypes.td
mlir/lib/Analysis/CMakeLists.txt
mlir/lib/Analysis/DataLayoutAnalysis.cpp [new file with mode: 0644]
mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/test/Conversion/StandardToLLVM/convert-dynamic-memref-ops.mlir
mlir/test/Conversion/StandardToLLVM/convert-static-memref-ops.mlir
mlir/test/IR/parser.mlir
mlir/test/lib/Dialect/DLTI/TestDataLayoutQuery.cpp