Skip to content

Commit db9a16e

Browse files
authored
[mlir][nfc] Update comments in the Linalg vectoriser (#76797)
1 parent 2cbf652 commit db9a16e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,10 +894,16 @@ static bool isContiguousLoadIdx(LinalgOp &linalgOp, Value &val,
894894
return result;
895895
}
896896

897-
/// Check whether \p extractOp would be a gather or a contiguous load Op after
898-
/// vectorising \p linalgOp. Note that it is always safe to use gather load
899-
/// operations for contiguous loads (albeit slow), but not vice-versa. When in
900-
/// doubt, bail out and assume that \p extractOp is a gather load.
897+
/// Infer the memory access pattern for the input ExtractOp
898+
///
899+
/// Based on the operation shapes and indices (usually based on the iteration
900+
/// space of the parent `linalgOp` operation), decides whether the input
901+
/// ExtractOp is a contiguous load (including a broadcast of a scalar) or a
902+
/// gather load.
903+
///
904+
/// Note that it is always safe to use gather load operations for contiguous
905+
/// loads (albeit slow), but not vice-versa. When in doubt, bail out and assume
906+
/// that `extractOp` is a gather load.
901907
static VectorMemoryAccessKind
902908
getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
903909
LinalgOp &linalgOp) {
@@ -916,8 +922,8 @@ getTensorExtractMemoryAccessPattern(tensor::ExtractOp extractOp,
916922
return VectorMemoryAccessKind::Gather;
917923

918924
// 1. Assume that it's a gather load when reading _into_:
919-
// * an n-D vector, like`tensor<1x2x4xi32` or`tensor<2x1x4xi32>`, or
920-
// * a 1-D vector with the trailing dim equal 1, e.g. `tensor<1x4x1xi32`.
925+
// * an n-D "vector", like `tensor<1x2x4xi32` or `tensor<2x1x4xi32>`, or
926+
// * a 1-D "vector" with the trailing dim equal 1, e.g. `tensor<1x4x1xi32`.
921927
// TODO: Relax these conditions.
922928
// FIXME: This condition assumes non-dynamic sizes.
923929
if ((llvm::count_if(targetShape,

0 commit comments

Comments
 (0)