@@ -116,6 +116,47 @@ module attributes {transform.with_named_sequence} {
116
116
117
117
// -----
118
118
119
+ // CHECK-LABEL: func @fuse_static_pad_tensor_3_4(
120
+ // CHECK-SAME: %[[IN:.*]]: tensor<7x9xf32>
121
+ // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
122
+ // CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index
123
+ // CHECK-DAG: %[[C3:.*]] = arith.constant 3 : index
124
+ // CHECK-DAG: %[[C15:.*]] = arith.constant 15 : index
125
+ // CHECK-DAG: %[[C16:.*]] = arith.constant 16 : index
126
+ // CHECK: %[[RESULT:.*]] = scf.for {{.*}} = %[[C0]] to %[[C15]] step %[[C2]]
127
+ // CHECK: scf.for {{.*}} = %[[C0]] to %[[C16]] step %[[C3]] iter_args(%[[INNER_OUT:.*]] =
128
+ // CHECK: %[[SWAP_RESULT:.*]] = scf.if
129
+ // CHECK: tensor.generate
130
+ // CHECK: else
131
+ // CHECK: %[[SLICE:.*]] = tensor.extract_slice %[[IN]][{{.*}}, {{.*}}] [{{.*}}, {{.*}}] [1, 1]
132
+ // CHECK: %[[PAD:.*]] = tensor.pad %[[SLICE]]
133
+ // CHECK: %[[COPY:.*]] = linalg.copy ins(%[[SWAP_RESULT:.*]]
134
+ // CHECK: tensor.insert_slice %[[COPY]] into %[[INNER_OUT]][{{.*}}, {{.*}}] [{{.*}}, {{.*}}] [1, 1]
135
+ // CHECK: return %[[RESULT]]
136
+
137
+ func.func @fuse_static_pad_tensor_3_4 (%input_tensor: tensor <7 x9 xf32 >,
138
+ %pad_value: f32 ) -> tensor <15 x16 xf32 > {
139
+ %0 = tensor.pad %input_tensor low [3 , 4 ] high [5 , 3 ] {
140
+ ^bb0 (%arg1: index , %arg2: index ):
141
+ tensor.yield %pad_value : f32
142
+ } : tensor <7 x9 xf32 > to tensor <15 x16 xf32 >
143
+ %empty = tensor.empty () : tensor <15 x16 xf32 >
144
+ %1 = linalg.copy ins (%0 : tensor <15 x16 xf32 >) outs (%empty : tensor <15 x16 xf32 >) -> tensor <15 x16 xf32 >
145
+ return %1 : tensor <15 x16 xf32 >
146
+ }
147
+
148
+ module attributes {transform.with_named_sequence } {
149
+ transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
150
+ %copy = transform.structured.match ops {[" linalg.copy" ]} in %arg1
151
+ : (!transform.any_op ) -> !transform.any_op
152
+ %a , %b , %c = transform.structured.fuse %copy [2 , 3 ]
153
+ : (!transform.any_op ) -> (!transform.any_op , !transform.any_op , !transform.any_op )
154
+ transform.yield
155
+ }
156
+ }
157
+
158
+ // -----
159
+
119
160
// CHECK-LABEL: func @static_pad_tensor_0_3(
120
161
// CHECK-SAME: %[[IN:.*]]: tensor<7x9xf32>
121
162
// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
0 commit comments