Skip to content

Commit 0720f87

Browse files
[fixup] Update a member functon name and fix a test failure
1 parent 36a6926 commit 0720f87

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

mlir/lib/Dialect/Vector/Transforms/VectorTransferOpTransforms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class FlattenContiguousRowMajorTransferReadPattern
642642
// Determinine the first memref dimension to collapse
643643
int64_t firstDimToCollapse = std::max(
644644
lastDynIndex(sourceType.getShape()),
645-
sourceType.getRank() - sourceType.getMaxCollapsableTrailingDims());
645+
sourceType.getRank() - sourceType.getMaxContiguousTrailingDims());
646646

647647
// 1. Collapse the source memref
648648
Value collapsedSource =
@@ -737,7 +737,7 @@ class FlattenContiguousRowMajorTransferWritePattern
737737
// Determinine the first memref dimension to collapse
738738
int64_t firstDimToCollapse = std::max(
739739
lastDynIndex(sourceType.getShape()),
740-
sourceType.getRank() - sourceType.getMaxCollapsableTrailingDims());
740+
sourceType.getRank() - sourceType.getMaxContiguousTrailingDims());
741741

742742
// 1. Collapse the source memref
743743
Value collapsedSource =

mlir/test/Dialect/Vector/vector-transfer-flatten.mlir

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ func.func @transfer_read_dims_mismatch_non_zero_indices(
113113
// CHECK: #[[$ATTR_0:.+]] = affine_map<()[s0, s1] -> (s0 * 24 + s1 * 6)>
114114

115115
// CHECK-LABEL: func.func @transfer_read_dims_mismatch_non_zero_indices(
116-
// CHECK-SAME: %[[IDX_1:.*]]: index, %[[IDX_2:.*]]: index,
117-
// CHECK-SAME: %[[MEM:.*]]: memref<1x43x4x6xi32>
118-
// CHECK: %[[C_0:.*]] = arith.constant 0 : i32
119-
// CHECK: %[[COLLAPSED_IN:.*]] = memref.collapse_shape %[[MEM]]
116+
// CHECK-SAME: %[[IDX_1:.+]]: index, %[[IDX_2:.+]]: index,
117+
// CHECK-SAME: %[[MEM:.+]]: memref<1x43x4x6xi32>
118+
// CHECK: %[[C_0:.+]] = arith.constant 0 : i32
119+
// CHECK: %[[COLLAPSED_IN:.+]] = memref.collapse_shape %[[MEM]]
120120
// CHECK-SAME{LITERAL}: [[0, 1, 2, 3]]
121121
// CHECK-SAME: : memref<1x43x4x6xi32> into memref<1032xi32>
122-
// CHECK: %[[COLLAPSED_IDX:.*]] = affine.apply #[[$ATTR_0]]()[%[[IDX_1]], %[[IDX_2]]]
123-
// CHECK: %[[READ:.*]] = vector.transfer_read %[[COLLAPSED_IN]][%[[COLLAPSED_IDX]]], %[[C_0]] {in_bounds = [true]} : memref<1032xi32>, vector<12xi32>
122+
// CHECK: %[[COLLAPSED_IDX:.+]] = affine.apply #[[$ATTR_0]]()[%[[IDX_1]], %[[IDX_2]]]
123+
// CHECK: %[[READ:.+]] = vector.transfer_read %[[COLLAPSED_IN]][%[[COLLAPSED_IDX]]], %[[C_0]] {in_bounds = [true]} : memref<1032xi32>, vector<12xi32>
124124

125125
// CHECK-128B-LABEL: func @transfer_read_dims_mismatch_non_zero_indices(
126126
// CHECK-128B-NOT: memref.collapse_shape
@@ -232,20 +232,21 @@ func.func @transfer_read_dynamic_dim_to_flatten(
232232
return %res : vector<1x2x6xi32>
233233
}
234234

235-
// CHECK: #[[$MAP:.*]] = affine_map<()[s0, s1] -> (s0 * 24 + s1 * 6)>
235+
// CHECK: #[[$MAP:.+]] = affine_map<()[s0, s1] -> (s0 * 24 + s1 * 6)>
236236

237237
// CHECK-LABEL: func.func @transfer_read_dynamic_dim_to_flatten
238238
// CHECK-SAME: %[[IDX_1:arg0]]
239239
// CHECK-SAME: %[[IDX_2:arg1]]
240240
// CHECK-SAME: %[[MEM:arg2]]
241-
// CHECK: %[[C0_I32:.*]] = arith.constant 0 : i32
242-
// CHECK: %[[COLLAPSED:.*]] = memref.collapse_shape %[[MEM]]
243-
// CHECK-SAME{LITERAL}: [[0, 1, 2, 3]]
244-
// CHECK-SAME: memref<1x?x4x6xi32> into memref<?xi32>
245-
// CHECK: %[[COLLAPSED_IDX:.*]] = affine.apply #[[$MAP]]()[%[[IDX_1]], %[[IDX_2]]]
246-
// CHECK: %[[VEC_1D:.*]] = vector.transfer_read %[[COLLAPSED]][%[[COLLAPSED_IDX]]],
247-
// CHECK-SAME: %[[C0_I32]] {in_bounds = [true]} : memref<?xi32>, vector<12xi32>
248-
// CHECK: %[[RESULT:.*]] = vector.shape_cast %[[VEC_1D]] : vector<12xi32> to vector<1x2x6xi32>
241+
// CHECK: %[[C0_I32:.+]] = arith.constant 0 : i32
242+
// CHECK: %[[C0:.+]] = arith.constant 0 : index
243+
// CHECK: %[[COLLAPSED:.+]] = memref.collapse_shape %[[MEM]]
244+
// CHECK-SAME{LITERAL}: [[0], [1, 2, 3]]
245+
// CHECK-SAME: memref<1x?x4x6xi32> into memref<1x?xi32>
246+
// CHECK: %[[COLLAPSED_IDX:.+]] = affine.apply #[[$MAP]]()[%[[IDX_1]], %[[IDX_2]]]
247+
// CHECK: %[[VEC_1D:.+]] = vector.transfer_read %[[COLLAPSED]][%[[C0]], %[[COLLAPSED_IDX]]],
248+
// CHECK-SAME: %[[C0_I32]] {in_bounds = [true]} : memref<1x?xi32>, vector<12xi32>
249+
// CHECK: %[[RESULT:.+]] = vector.shape_cast %[[VEC_1D]] : vector<12xi32> to vector<1x2x6xi32>
249250
// CHECK: return %[[RESULT]] : vector<1x2x6xi32>
250251

251252

@@ -531,21 +532,21 @@ func.func @transfer_write_dynamic_dim_to_flatten(
531532
return
532533
}
533534

534-
// CHECK: #[[$MAP:.*]] = affine_map<()[s0, s1] -> (s0 * 24 + s1 * 6)>
535+
// CHECK: #[[$MAP:.+]] = affine_map<()[s0, s1] -> (s0 * 24 + s1 * 6)>
535536

536537
// CHECK-LABEL: func.func @transfer_write_dynamic_dim_to_flatten
537538
// CHECK-SAME: %[[IDX_1:arg0]]: index
538539
// CHECK-SAME: %[[IDX_2:arg1]]: index
539540
// CHECK-SAME: %[[VEC:arg2]]: vector<1x2x6xi32>
540541
// CHECK-SAME: %[[MEM:arg3]]: memref<1x?x4x6xi32>
541-
542-
// CHECK: %[[COLLAPSED_MEM:.*]] = memref.collapse_shape %[[MEM]]
543-
// CHECK-SAME{LITERAL}: [[0, 1, 2, 3]]
544-
// CHECK-SAME: : memref<1x?x4x6xi32> into memref<?xi32>
545-
// CHECK: %[[COLLAPSED_IDX:.*]] = affine.apply #[[$MAP]]()[%[[IDX_1]], %[[IDX_2]]]
546-
// CHECK: %[[VEC_1D:.*]] = vector.shape_cast %[[VEC]] : vector<1x2x6xi32> to vector<12xi32>
547-
// CHECK: vector.transfer_write %[[VEC_1D]], %[[COLLAPSED_MEM]][%[[COLLAPSED_IDX]]]
548-
// CHECK-SAME: {in_bounds = [true]} : vector<12xi32>, memref<?xi32>
542+
// CHECK: %[[C0:.+]] = arith.constant 0 : index
543+
// CHECK: %[[COLLAPSED_MEM:.+]] = memref.collapse_shape %[[MEM]]
544+
// CHECK-SAME{LITERAL}: [[0], [1, 2, 3]]
545+
// CHECK-SAME: : memref<1x?x4x6xi32> into memref<1x?xi32>
546+
// CHECK: %[[COLLAPSED_IDX:.+]] = affine.apply #[[$MAP]]()[%[[IDX_1]], %[[IDX_2]]]
547+
// CHECK: %[[VEC_1D:.+]] = vector.shape_cast %[[VEC]] : vector<1x2x6xi32> to vector<12xi32>
548+
// CHECK: vector.transfer_write %[[VEC_1D]], %[[COLLAPSED_MEM]][%[[C0]], %[[COLLAPSED_IDX]]]
549+
// CHECK-SAME: {in_bounds = [true]} : vector<12xi32>, memref<1x?xi32>
549550

550551
// CHECK-128B-LABEL: func @transfer_write_dynamic_dim_to_flatten
551552
// CHECK-128B-NOT: memref.collapse_shape

0 commit comments

Comments
 (0)