@@ -6,11 +6,7 @@ func.func @matmul_tensors(
6
6
-> tensor <8 x32 xf32 > {
7
7
// CHECK-NOT: linalg
8
8
// CHECK: vector.extract {{.*}} : vector<4xf32> from vector<8x4xf32>
9
- // TODO: `vector.maskedstore` below could safely be replaced with
10
- // `vector.store`. It's present due to the vectorization logic for
11
- // `tensor.insert_slice` conservatively applying masks. However, it this case,
12
- // we should be able to remove it via value-bounds checks.
13
- // CHECK: vector.maskedstore {{.*}} : memref<8x32xf32>, vector<4xi1>, vector<4xf32>
9
+ // CHECK: vector.store {{.*}} : memref<8x32xf32>, vector<4xf32>
14
10
%0 = linalg.matmul ins (%arg0 , %arg1: tensor <8 x16 xf32 >, tensor <16 x32 xf32 >)
15
11
outs (%arg2: tensor <8 x32 xf32 >)
16
12
-> tensor <8 x32 xf32 >
@@ -24,16 +20,16 @@ module attributes {transform.with_named_sequence} {
24
20
: (!transform.any_op ) -> (!transform.any_op , !transform.any_op , !transform.any_op , !transform.any_op )
25
21
%2 = transform.get_parent_op %1 {isolated_from_above } : (!transform.any_op ) -> !transform.any_op
26
22
transform.structured.vectorize_children_and_apply_patterns %2 : (!transform.any_op ) -> !transform.any_op
23
+ %b = transform.bufferization.one_shot_bufferize
24
+ layout {IdentityLayoutMap } %module_op
25
+ {bufferize_function_boundaries = true , allow_return_allocs = true }
26
+ : (!transform.any_op ) -> !transform.any_op
27
27
28
- %f = transform.structured.match ops {[" func.func" ]} in %module_op
28
+ %f = transform.structured.match ops {[" func.func" ]} in %b
29
29
: (!transform.any_op ) -> !transform.any_op
30
30
31
31
// TODO: group these lower-level controls into various properly named vector
32
32
// lowering TD macros.
33
- transform.apply_patterns to %f {
34
- transform.apply_patterns.vector.lower_masked_transfers
35
- } : !transform.any_op
36
-
37
33
transform.apply_patterns to %f {
38
34
transform.apply_patterns.vector.lower_contraction lowering_strategy = " outerproduct"
39
35
} : !transform.any_op
@@ -50,37 +46,21 @@ module attributes {transform.with_named_sequence} {
50
46
transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = " linalg-copy"
51
47
} : !transform.any_op
52
48
53
- // By default, UnrollTransferWriteConversion (applied below via
54
- // `transfer_to_scf`) will only work on MemRef(s). While there's an option
55
- // to relax that, it's currently not wired-up with the TD logic. Bufferize
56
- // here as otherwise unrolling will not work.
57
- // TODO: Extend `transform.apply_patterns.vector.transfer_to_scf` to allow
58
- // unrolling xfer Ops on tensors and move bufferization all the way down.
59
- %b = transform.bufferization.one_shot_bufferize
60
- layout {IdentityLayoutMap } %module_op
61
- {bufferize_function_boundaries = true , allow_return_allocs = true }
62
- : (!transform.any_op ) -> !transform.any_op
63
-
64
- %fb = transform.structured.match ops {[" func.func" ]} in %b
65
- : (!transform.any_op ) -> !transform.any_op
66
-
67
- transform.apply_patterns to %fb {
49
+ transform.apply_patterns to %f {
68
50
transform.apply_patterns.vector.transfer_to_scf max_transfer_rank = 1 full_unroll = true
69
51
} : !transform.any_op
70
52
71
- transform.apply_patterns to %fb {
53
+ transform.apply_patterns to %f {
72
54
transform.apply_patterns.vector.lower_transfer max_transfer_rank = 1
73
55
} : !transform.any_op
74
56
75
- transform.apply_patterns to %fb {
57
+ transform.apply_patterns to %f {
76
58
transform.apply_patterns.vector.lower_shape_cast
77
59
} : !transform.any_op
78
60
79
- transform.apply_patterns to %fb {
61
+ transform.apply_patterns to %f {
80
62
transform.apply_patterns.vector.lower_transpose lowering_strategy = " shuffle_1d"
81
63
} : !transform.any_op
82
-
83
-
84
64
transform.yield
85
65
}
86
66
}
0 commit comments