[mlir] support data layout specs on ModuleOp
authorAlex Zinenko <zinenko@google.com>
Mon, 22 Mar 2021 13:57:39 +0000 (14:57 +0100)
committerAlex Zinenko <zinenko@google.com>
Wed, 24 Mar 2021 14:13:38 +0000 (15:13 +0100)
commit1916b0e098ad6ddeb746c4720099fb96bff02d31
treee67cae0723cca5f652c6d3b7bb4456724be507c6
parent7920527796eacd596d362ab5266e23189565892e
[mlir] support data layout specs on ModuleOp

ModuleOp is a natural place to provide scoped data layout information. However,
it is undesirable for ModuleOp to implement the entirety of
DataLayoutOpInterface because that would require either pushing the interface
inside the IR library instead of a separate library, or putting the default
implementation of the interface as inline functions in headers leading to
binary bloat. Instead, ModuleOp accepts an arbitrary data layout spec attribute
and has a dedicated hook to extract it, and DataLayout is modified to know
about ModuleOp particularities.

Reviewed By: herhut, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D98500
12 files changed:
mlir/docs/DataLayout.md
mlir/include/mlir/IR/BuiltinOps.h
mlir/include/mlir/IR/BuiltinOps.td
mlir/include/mlir/Interfaces/DataLayoutInterfaces.h
mlir/lib/Dialect/DLTI/DLTI.cpp
mlir/lib/IR/BuiltinDialect.cpp
mlir/lib/IR/CMakeLists.txt
mlir/lib/Interfaces/DataLayoutInterfaces.cpp
mlir/test/Dialect/DLTI/invalid.mlir
mlir/test/IR/module-op.mlir
mlir/test/Interfaces/DataLayoutInterfaces/module.mlir [new file with mode: 0644]
mlir/test/lib/Transforms/TestDataLayoutQuery.cpp