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,
110110 return ;
111111 }
112112
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.
114114 if (!this ->tileSizes .empty ()) {
115115 tileSizes->assign (this ->tileSizes .begin (), this ->tileSizes .end ());
116116 tileSizes->resize (band.size (), kDefaultTileSize );
117117 return ;
118118 }
119119 tileSizes->resize (band.size ());
120120
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+
121128 // The first loop in the band.
122129 AffineForOp rootForOp = band[0 ];
123130 (void )rootForOp;
Original file line number Diff line number Diff line change 11// RUN: mlir-opt %s -split-input-file -affine-loop-tile="tile-size=32" | FileCheck %s
22// 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
34// RUN: mlir-opt %s -split-input-file -affine-loop-tile="tile-size=32 separate" | FileCheck %s --check-prefix=SEPARATE
45
5- // -----
6-
76// CHECK-DAG: [[$UB:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32)>
87// CHECK-DAG: [[$UB_MIN:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32, 50)>
98// CHECK-DAG: [[$ID:#map[0-9]*]] = affine_map<(d0) -> (d0)>
109// 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)>
1112
1213// CHECK-LABEL: func @loop_tiling()
1314// CHECK-NEXT: affine.for %{{.*}} = 0 to 256 step 32 {
You can’t perform that action at this time.
0 commit comments