Skip to content

Commit 709dd82

Browse files
committed
fixup! fixup! fixup! [mlir][linalg] Add support for masked vectorization of tensor.insert_slice (1/N)
Update comments
1 parent 26006e1 commit 709dd82

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ vectorizeConvolution(RewriterBase &rewriter, LinalgOp convOp,
6666
/// * inferred from the static dims in the input and output tensors.
6767
/// Bails out if:
6868
/// * vector sizes are not user-provided, and
69-
/// * at least one dim is dynamic (in both the input and output tensors),
70-
/// bails out.
69+
/// * at least one dim is dynamic (in both the input and output tensors).
7170
///
7271
/// Before:
7372
/// !t_in_type = tensor<1x2x3xf32>
@@ -1918,15 +1917,15 @@ vectorizeInsertSliceOpPrecondition(tensor::InsertSliceOp sliceOp,
19181917
return failure();
19191918

19201919
// Get the pad value.
1921-
// TransferReadOp (which is used to vectorize InsertSliceOp, requires a scalar
1922-
// padding value. Note that:
1923-
// * for in-bounds access, the value is actually irrelevant.
1924-
// There are 2 cases in which xfer.read accesses are known to be in-bounds:
1920+
// TransferReadOp (which is used to vectorize InsertSliceOp), requires a
1921+
// scalar padding value. Note that:
1922+
// * for in-bounds accesses,
1923+
// the value is actually irrelevant. There are 2 cases in which xfer.read
1924+
// accesses are known to be in-bounds:
19251925
// 1. The source shape is static (output vector sizes would be based on
19261926
// the source shape and hence all memory accesses would be in-bounds),
1927-
// 2. Masking is used (output vector sizes would be user-provided, in which
1928-
// case it is assumed that all memory accesses are in-bounds). This
1929-
// remains a TODO.
1927+
// 2. Masking is used, i.e. the output vector sizes are user-provided. In
1928+
// this case it is safe to assume that all memory accesses are in-bounds.
19301929
//
19311930
// When the value is not known and not needed, use 0. Otherwise, bail out.
19321931
Value padValue = getStaticPadVal(sliceOp);

mlir/test/Dialect/Linalg/vectorization-pad-patterns.mlir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ module attributes {transform.with_named_sequence} {
228228

229229
func.func private @make_vector() -> tensor<12x13xf32>
230230

231-
// the destination of tensor.insert_slice matches the result of tensor.pad -
231+
// The destination of tensor.insert_slice matches the result of tensor.pad -
232232
// not supported.
233233

234-
// check-label: func.func @pad_and_insert_slice_dest(
235-
// check-not: vector.transfer_read
236-
// check-not: vector.transfer_write
234+
// CHECK-LABEL: func.func @pad_and_insert_slice_dest(
235+
// CHECK-NOT: vector.transfer_read
236+
// CHECK-NOT: vector.transfer_write
237237

238238
func.func @pad_and_insert_slice_dest(
239239
%arg0: tensor<1x5x6xf32>) -> tensor<1x12x13xf32> {

0 commit comments

Comments
 (0)