@@ -6,11 +6,7 @@ func.func @matmul_tensors(
66 -> tensor <8 x32 xf32 > {
77// CHECK-NOT: linalg
88// 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>
1410 %0 = linalg.matmul ins (%arg0 , %arg1: tensor <8 x16 xf32 >, tensor <16 x32 xf32 >)
1511 outs (%arg2: tensor <8 x32 xf32 >)
1612 -> tensor <8 x32 xf32 >
@@ -24,16 +20,16 @@ module attributes {transform.with_named_sequence} {
2420 : (!transform.any_op ) -> (!transform.any_op , !transform.any_op , !transform.any_op , !transform.any_op )
2521 %2 = transform.get_parent_op %1 {isolated_from_above } : (!transform.any_op ) -> !transform.any_op
2622 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
2727
28- %f = transform.structured.match ops {[" func.func" ]} in %module_op
28+ %f = transform.structured.match ops {[" func.func" ]} in %b
2929 : (!transform.any_op ) -> !transform.any_op
3030
3131 // TODO: group these lower-level controls into various properly named vector
3232 // lowering TD macros.
33- transform.apply_patterns to %f {
34- transform.apply_patterns.vector.lower_masked_transfers
35- } : !transform.any_op
36-
3733 transform.apply_patterns to %f {
3834 transform.apply_patterns.vector.lower_contraction lowering_strategy = " outerproduct"
3935 } : !transform.any_op
@@ -50,37 +46,21 @@ module attributes {transform.with_named_sequence} {
5046 transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = " linalg-copy"
5147 } : !transform.any_op
5248
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 {
6850 transform.apply_patterns.vector.transfer_to_scf max_transfer_rank = 1 full_unroll = true
6951 } : !transform.any_op
7052
71- transform.apply_patterns to %fb {
53+ transform.apply_patterns to %f {
7254 transform.apply_patterns.vector.lower_transfer max_transfer_rank = 1
7355 } : !transform.any_op
7456
75- transform.apply_patterns to %fb {
57+ transform.apply_patterns to %f {
7658 transform.apply_patterns.vector.lower_shape_cast
7759 } : !transform.any_op
7860
79- transform.apply_patterns to %fb {
61+ transform.apply_patterns to %f {
8062 transform.apply_patterns.vector.lower_transpose lowering_strategy = " shuffle_1d"
8163 } : !transform.any_op
82-
83-
8464 transform.yield
8565 }
8666}
0 commit comments