Skip to content

Commit dcda8f4

Browse files
committed
fix comment
1 parent 2ce971f commit dcda8f4

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

include/gc/Transforms/Passes.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def IterativeTilingAndFusion : Pass<"iterative-tiling-and-fusion",
6060
let description = [{
6161
The pass tries to fuse any MLIR operation which can be tiled. Moreover, this pass aims to support:
6262
1. Matmul fusion with element-wise/reduce/broadcast ops.
63-
2. Pre-op and post-op fusion.
64-
3. Multi-consumer and multi-producer support.
65-
4. Multiple level of nest loops and candidates.
63+
2. Producer and consumer fusion.
64+
3. Arbitrary topology, including residual pattern with multiple consumers .
65+
4. Nest loops structure with multiple level candidates.
6666
5. Flexible option to control the boundary of iterative process.
6767
6. Default tiling when no op is tiled before fusion.
6868
7. Cost-model to determine whether to fuse or not.
@@ -74,9 +74,9 @@ def IterativeTilingAndFusion : Pass<"iterative-tiling-and-fusion",
7474
Option<"useCostModel", "use-cost-model", "bool",
7575
/*default=*/"false",
7676
"Decide if enable cost model to control iterative fusion.">,
77-
Option<"defaultNDTile", "default-nd-tile", "int",
77+
Option<"defaultNDTile", "default-nd-tile", "unsigned",
7878
/*default=*/"2",
79-
"Set default ND-Tile size, such as 2[default] or 3.">,
79+
"Set default amount of non-one dimensions in TileSize, such as 1, 2[default, a.k.a. 2D-Tile], etc.">,
8080
ListOption<"defaultTileSize", "default-tile-size", "std::string",
8181
"Set default TileSize for the certain type of op, saying `matmul:{32,32}`.">,
8282
];

lib/gc/Transforms/IterativeTilingAndFusion.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ tileAndFuseProducerOfOpOperand(RewriterBase &rewriter, OpOperand &operand,
479479
return std::nullopt;
480480

481481
// c. Check the producer of root source if is tilable.
482-
Operation *producer = realProducer->getDefiningOp<TilingInterface>();
483-
if (!producer)
482+
Operation *producerOp = realProducer->getDefiningOp<TilingInterface>();
483+
if (!producerOp)
484484
return std::nullopt;
485485

486486
CandidateDefOrUse defOrUse{*realProducer};
@@ -537,8 +537,8 @@ tileAndFuseConsumerOfOpResult(RewriterBase &rewriter, OpResult result,
537537
SmallVector<scf::SCFFuseConsumerOfSliceResult> fusedResultList;
538538
for (auto useOperand : *realConsumers) {
539539
// c. Check the consumer of top level result if is tilable.
540-
Operation *consumer = dyn_cast<TilingInterface>(useOperand->getOwner());
541-
if (!consumer)
540+
Operation *consumerOp = dyn_cast<TilingInterface>(useOperand->getOwner());
541+
if (!consumerOp)
542542
continue;
543543

544544
CandidateDefOrUse defOrUse{useOperand};
@@ -560,7 +560,7 @@ tileAndFuseConsumerOfOpResult(RewriterBase &rewriter, OpResult result,
560560
// f. Manually run cse on region which contains original consumer op in
561561
// avoid of conflict with subsequent `tileAndFuseConsumerOfSlice` get nest
562562
// loops between next candidate sliceOp and tiled producer.
563-
(void)mlir::simplifyRegions(rewriter, {*consumer->getParentRegion()});
563+
(void)mlir::simplifyRegions(rewriter, {*consumerOp->getParentRegion()});
564564
}
565565
}
566566
if (fusedResultList.empty())
@@ -652,7 +652,7 @@ struct defaultTileConfig {
652652
// OpTy-to-TileSize mapping
653653
OpTileSizeMap tsMap;
654654
// ND-tile size
655-
int ndTile;
655+
unsigned ndTile;
656656
};
657657

658658
/// Default Tiling function only effective for certain `OpTy` operation
@@ -690,7 +690,7 @@ defaultTilingOfType(RewriterBase &rewriter, Operation *op,
690690
SmallVector<int64_t> tsOrder = {32, 16};
691691
// Record how many dims have been tiled, including fully tiled, i.e.
692692
// tileSize == dimSize.
693-
int nonOneTileDims =
693+
unsigned nonOneTileDims =
694694
(isa<mlir::linalg::LinalgOp>(op) && !linalgx::isMatmulOp(op))
695695
? cast<mlir::linalg::LinalgOp>(op).getNumReductionLoops()
696696
: 0;

test/mlir/test/gc/Transforms/iterative-tiling-and-fusion.mlir

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ module {
366366
/// CHECK: linalg.add
367367
%add = linalg.add ins(%arg0, %arg1 : tensor<1x32x4096xbf16>, tensor<1x32x4096xbf16>) outs(%dest0 : tensor<1x32x4096xbf16>) -> tensor<1x32x4096xbf16>
368368
%dest1 = tensor.empty() : tensor<1x1x128x32x32xbf16>
369-
/// CHECK: tensor.pack
369+
/// CHECK-NEXT: affine.apply
370+
/// CHECK-NEXT: tensor.extract_slice
371+
/// CHECK-NEXT: tensor.pack
370372
%pack = tensor.pack %add outer_dims_perm = [0, 1, 2] inner_dims_pos = [1, 2] inner_tiles = [32, 32] into %dest1 : tensor<1x32x4096xbf16> -> tensor<1x1x128x32x32xbf16>
371373
/// CHECK: scf.forall.in_parallel
372374
/// CHECK: tensor.parallel_insert_slice

0 commit comments

Comments
 (0)