Add utility to extract strides from layout map in MemRefType.
authorNicolas Vasilache <ntv@google.com>
Fri, 20 Sep 2019 16:25:52 +0000 (09:25 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 20 Sep 2019 16:26:21 +0000 (09:26 -0700)
commita00b5682776555ed378d67ae2569d12c4e9b112d
treef6dd9797e64d89b640ba044ee3fae809ef6ecf20
parent5002e98b92bbf300b41b7a7af6492d7c1bd662f4
Add utility to extract strides from layout map in MemRefType.

The RFC for unifying Linalg and Affine compilation passes into an end-to-end flow discusses the notion of a strided MemRef (https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio).

This CL adds helper functions to extract strides from the layout map which in turn will allow converting between a strided form of the type and a layout map.

For now strides are only computed on a single affine map with a single result (i.e. the closed subset of linearization maps that are compatible with striding semantics). This restriction will be reevaluated / lifted in the future based on concrete use cases.

PiperOrigin-RevId: 270284686
mlir/include/mlir/IR/StandardTypes.h
mlir/lib/IR/StandardTypes.cpp
mlir/test/AffineOps/memref-stride-calculation.mlir [new file with mode: 0644]
mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp [new file with mode: 0644]