[mlir] Normalize dynamic memrefs with a map of tiled-layout.

Authored by imaihal on May 23 2021, 8:04 PM.


[mlir] Normalize dynamic memrefs with a map of tiled-layout.

Steps for normalizing dynamic memrefs for tiled layout map

  1. Check if original map is tiled layout. Only tiled layout is supported.
  2. Create normalized memrefType. Dimensions that include dynamic dimensions in the map output will be dynamic dimensions.
  3. Create new maps to calculate each dimension size of new memref. In tiled layout, the dimension size can be calculated by replacing "floordiv <tile size>" with "ceildiv <tile size>" and "mod <tile size>" with "<tile size>".
  4. Create AffineApplyOp to apply the new maps. The output of AffineApplyOp is dynamicSizes for new AllocOp.
  5. Add the new dynamic sizes in new AllocOp.

This patch also set MemRefsNormalizable trant in CastOp and DimOp since
they used with dynamic memrefs.

Reviewed By: bondhugula

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