File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
lib/Dialect/Affine/Transforms Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -110,14 +110,21 @@ void LoopTiling::getTileSizes(ArrayRef<AffineForOp> band,
110
110
return ;
111
111
}
112
112
113
- // Use tileSizes and fill them with default tile size if it's short.
113
+ // Use supplied tile sizes and fill them with default tile size if it's short.
114
114
if (!this ->tileSizes .empty ()) {
115
115
tileSizes->assign (this ->tileSizes .begin (), this ->tileSizes .end ());
116
116
tileSizes->resize (band.size (), kDefaultTileSize );
117
117
return ;
118
118
}
119
119
tileSizes->resize (band.size ());
120
120
121
+ // If the cache size is zero, set the minimum valid tile size. No good reason
122
+ // to pick another specific size over this.
123
+ if (cacheSizeInKiB == 0 ) {
124
+ std::fill (tileSizes->begin (), tileSizes->end (), 1 );
125
+ return ;
126
+ }
127
+
121
128
// The first loop in the band.
122
129
AffineForOp rootForOp = band[0 ];
123
130
(void )rootForOp;
Original file line number Diff line number Diff line change 1
1
// RUN: mlir-opt %s -split-input-file -affine-loop-tile="tile-size=32" | FileCheck %s
2
2
// RUN: mlir-opt %s -split-input-file -affine-loop-tile="cache-size=512" | FileCheck %s --check-prefix=MODEL
3
+ // RUN: mlir-opt %s -split-input-file -affine-loop-tile="cache-size=0" | FileCheck %s --check-prefix=ZERO-CACHE
3
4
// RUN: mlir-opt %s -split-input-file -affine-loop-tile="tile-size=32 separate" | FileCheck %s --check-prefix=SEPARATE
4
5
5
- // -----
6
-
7
6
// CHECK-DAG: [[$UB:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32)>
8
7
// CHECK-DAG: [[$UB_MIN:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32, 50)>
9
8
// CHECK-DAG: [[$ID:#map[0-9]*]] = affine_map<(d0) -> (d0)>
10
9
// CHECK-DAG: [[$ID_PLUS_21:#map[0-9]*]] = affine_map<(d0) -> (d0 + 21)>
10
+ // ZERO-CACHE-DAG: affine_map<(d0) -> (d0)>
11
+ // ZERO-CACHE-DAG: affine_map<(d0) -> (d0 + 1)>
11
12
12
13
// CHECK-LABEL: func @loop_tiling()
13
14
// CHECK-NEXT: affine.for %{{.*}} = 0 to 256 step 32 {
You can’t perform that action at this time.
0 commit comments