MLIR  21.0.0git
TilingInterface.h
Go to the documentation of this file.
1 //===- TilingInterface.h - Interface for tiling operations ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the definitions of the TilingInterface defined in
10 // `TilingInterface.td`.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_INTERFACES_TILINGINTERFACE_H_
15 #define MLIR_INTERFACES_TILINGINTERFACE_H_
16 
18 #include "mlir/IR/Builders.h"
19 #include "mlir/IR/BuiltinTypes.h"
20 #include "mlir/IR/Operation.h"
22 #include "mlir/Support/LLVM.h"
23 
24 namespace mlir {
25 
26 /// Container for result values of tiling.
27 /// - `tiledOps` contains operations created by the tiling implementation that
28 /// are returned to the caller for further transformations.
29 /// - `tiledValues` contains the tiled value corresponding to the result of the
30 /// untiled operation.
31 /// - `generatedSlices` contains the list of slices that are generated during
32 /// tiling. These slices can be used for fusing producers.
33 struct TilingResult {
37 };
38 
39 /// Tiling can be thought of as splitting a dimension into 2 and
40 /// materializing the outer dimension as a loop:
41 ///
42 /// op[original] -> op[original / x, x] -> loop[original] { op[x] }
43 ///
44 /// For parallel dimensions, the split can only happen in one way, with both
45 /// dimensions being parallel. For reduction dimensions however, there is a
46 /// choice in how we split the reduction dimension. This enum exposes this
47 /// choice.
49  // [reduction] -> [reduction1, reduction2]
50  // -> loop[reduction1] { [reduction2] }
52  // [reduction] -> [reduction1, parallel2]
53  // -> loop[reduction1] { [parallel2] }; merge[reduction1]
55  // [reduction] -> [parallel1, reduction2]
56  // -> loop[parallel1] { [reduction2] }; merge[parallel1]
58 };
59 
60 /// Container for the result of merge operation of tiling.
61 /// - `mergeOps` contains operations created during the merge.
62 /// - `replacements` contains the values that represents the result of the
63 /// merge. These are used as replacements for the original tiled operation.
64 struct MergeResult {
67 };
68 
69 } // namespace mlir
70 
71 /// Include the ODS generated interface header files.
72 #include "mlir/Interfaces/TilingInterface.h.inc"
73 
74 #endif // MLIR_INTERFACES_TILINGINTERFACE_H_
Include the generated interface declarations.
ReductionTilingStrategy
Tiling can be thought of as splitting a dimension into 2 and materializing the outer dimension as a l...
Container for the result of merge operation of tiling.
SmallVector< Value > replacements
SmallVector< Operation * > mergeOps
Container for result values of tiling.
SmallVector< Value > tiledValues
SmallVector< Operation * > tiledOps
SmallVector< Operation * > generatedSlices