[Linalg] Add a primitive tiling pass
authorNicolas Vasilache <ntv@google.com>
Wed, 1 May 2019 13:47:32 +0000 (06:47 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 6 May 2019 15:23:43 +0000 (08:23 -0700)
commit21d9dc4f299a2fc6a28fc41e293062af54a0af57
tree7d4c05ec96c1cc3566f9c510f3c594b3297d61e7
parent007a4acece71e8fe449984c215d61fcf00007c1c
[Linalg] Add a primitive tiling pass

    This CL adds a primitive tiling pass for Linalg.
    The tiling pass uses the loopToOperandRangesMaps property which should be ideally Tablegen'd and in-class.

    The tiling specification uses 0 as a convention to skip loops that should not be tiled.

    Tiling proceeds in 3 steps, for each op:
    1. Pad tile sizes with 0 to match the number of loops, this simplifies the implementation and avoids affine map manipulations to align dimensions.
    2. Create loop ranges that represent the min/max/step by which to iterate. This should be later complemented by a range intersection to avoid the out-of-bounds case.
    3. Map the loop ranges to view ranges in order to create subviews on which the op can be called.

    Relevant utility and helper functions are added separately that support writing the transformation in a declarative fashion.
    Simplifying assumptions are made for now on the views and the ranges that are constructed
    in the function and are not passed as function arguments. This restriction will be lifted
    in the future.

--

PiperOrigin-RevId: 246124419
17 files changed:
mlir/include/mlir/IR/AffineMap.h
mlir/include/mlir/Linalg/CMakeLists.txt
mlir/include/mlir/Linalg/IR/CMakeLists.txt [new file with mode: 0644]
mlir/include/mlir/Linalg/IR/LinalgOps.h [moved from mlir/include/mlir/Linalg/LinalgOps.h with 92% similarity]
mlir/include/mlir/Linalg/IR/LinalgOps.td [moved from mlir/include/mlir/Linalg/LinalgOps.td with 86% similarity]
mlir/include/mlir/Linalg/IR/LinalgTraits.h [moved from mlir/include/mlir/Linalg/LinalgTraits.h with 99% similarity]
mlir/include/mlir/Linalg/IR/LinalgTypes.h [moved from mlir/include/mlir/Linalg/LinalgTypes.h with 100% similarity]
mlir/include/mlir/Linalg/Passes.h [new file with mode: 0644]
mlir/include/mlir/Linalg/Utils/Utils.h [new file with mode: 0644]
mlir/lib/IR/AffineMap.cpp
mlir/lib/Linalg/CMakeLists.txt
mlir/lib/Linalg/IR/LinalgOps.cpp [moved from mlir/lib/Linalg/LinalgOps.cpp with 88% similarity]
mlir/lib/Linalg/IR/LinalgTypes.cpp [moved from mlir/lib/Linalg/LinalgTypes.cpp with 97% similarity]
mlir/lib/Linalg/LinalgRegistration.cpp
mlir/lib/Linalg/Transforms/Tiling.cpp [new file with mode: 0644]
mlir/lib/Linalg/Utils/Utils.cpp [new file with mode: 0644]
mlir/test/Linalg/tile.mlir [new file with mode: 0644]