389 lines · plain
1// RUN: mlir-opt %s -transform-interpreter --split-input-file | FileCheck %s2 3func.func @tile_winograd_filter(%arg0: tensor<2x3x3x5xf32>, %arg1: tensor<6x6x5x2xf32>) -> tensor<6x6x5x2xf32> {4 %0 = linalg.winograd_filter_transform fmr(F_4_3) ins(%arg0 : tensor<2x3x3x5xf32>) outs(%arg1 : tensor<6x6x5x2xf32>) -> tensor<6x6x5x2xf32>5 return %0 : tensor<6x6x5x2xf32>6}7 8module attributes {transform.with_named_sequence} {9 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {10 %0 = transform.structured.match ops{["linalg.winograd_filter_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op11 %1, %loop1:2 = transform.structured.tile_using_for %0 tile_sizes [1, 0, 0, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)12 transform.yield13 }14}15 16// CHECK-LABEL: func.func @tile_winograd_filter(17// CHECK-SAME: %[[ARG0:.*]]: tensor<2x3x3x5xf32>, %[[ARG1:.*]]: tensor<6x6x5x2xf32>) -> tensor<6x6x5x2xf32> {18// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index19// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index20// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index21// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index22// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index23// CHECK-DAG: %[[C1_1:.*]] = arith.constant 1 : index24// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG3:.*]] = %[[ARG1]])25// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C5]] step %[[C1_1]] iter_args(%[[ARG5:.*]] = %[[ARG3]])26// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][%[[ARG2]], 0, 0, %[[ARG4]]] [1, 3, 3, 1] [1, 1, 1, 1] : tensor<2x3x3x5xf32> to tensor<1x3x3x1xf32>27// CHECK: %[[EXTRACTED_SLICE_2:.*]] = tensor.extract_slice %[[ARG5]][0, 0, %[[ARG4]], %[[ARG2]]] [6, 6, 1, 1] [1, 1, 1, 1] : tensor<6x6x5x2xf32> to tensor<6x6x1x1xf32>28// CHECK: %[[S3:.*]] = linalg.winograd_filter_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<1x3x3x1xf32>) outs(%[[EXTRACTED_SLICE_2]] : tensor<6x6x1x1xf32>) -> tensor<6x6x1x1xf32>29// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S3]] into %[[ARG5]][0, 0, %[[ARG4]], %[[ARG2]]] [6, 6, 1, 1] [1, 1, 1, 1] : tensor<6x6x1x1xf32> into tensor<6x6x5x2xf32>30 31// -----32 33func.func @tile_winograd_filter(%arg0: tensor<2x3x3x5xf32>, %arg1: tensor<6x6x5x2xf32>) -> tensor<6x6x5x2xf32> {34 %0 = linalg.winograd_filter_transform fmr(F_4_3) ins(%arg0 : tensor<2x3x3x5xf32>) outs(%arg1 : tensor<6x6x5x2xf32>) -> tensor<6x6x5x2xf32>35 return %0 : tensor<6x6x5x2xf32>36}37 38module attributes {transform.with_named_sequence} {39 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {40 %0 = transform.structured.match ops{["linalg.winograd_filter_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op41 %1, %loop1:2 = transform.structured.tile_using_for %0 tile_sizes [1, 0, 0, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)42 transform.yield43 }44}45 46// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (-d0 + 5, 2)>47// CHECK-LABEL: func.func @tile_winograd_filter(48// CHECK-SAME: %[[ARG0:.*]]: tensor<2x3x3x5xf32>, %[[ARG1:.*]]: tensor<6x6x5x2xf32>) -> tensor<6x6x5x2xf32> {49// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index50// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index51// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index52// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index53// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index54// CHECK-DAG: %[[C2_1:.*]] = arith.constant 2 : index55// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG3:.*]] = %[[ARG1]])56// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C5]] step %[[C2_1]] iter_args(%[[ARG5:.*]] = %[[ARG3]])57// CHECK: %[[C5_2:.*]] = arith.constant 5 : index58// CHECK: %[[S3:.*]] = affine.min #[[$MAP0]](%[[ARG4]])59// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][%[[ARG2]], 0, 0, %[[ARG4]]] [1, 3, 3, %[[S3]]] [1, 1, 1, 1] : tensor<2x3x3x5xf32> to tensor<1x3x3x?xf32>60// CHECK: %[[EXTRACTED_SLICE_3:.*]] = tensor.extract_slice %[[ARG5]][0, 0, %[[ARG4]], %[[ARG2]]] [6, 6, %[[S3]], 1] [1, 1, 1, 1] : tensor<6x6x5x2xf32> to tensor<6x6x?x1xf32>61// CHECK: %[[S4:.*]] = linalg.winograd_filter_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<1x3x3x?xf32>) outs(%[[EXTRACTED_SLICE_3]] : tensor<6x6x?x1xf32>) -> tensor<6x6x?x1xf32>62// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S4]] into %[[ARG5]][0, 0, %[[ARG4]], %[[ARG2]]] [6, 6, %[[S3]], 1] [1, 1, 1, 1] : tensor<6x6x?x1xf32> into tensor<6x6x5x2xf32>63// -----64 65func.func @tile_winograd_filter(%arg0: tensor<2x3x1x5xf32>, %arg1: tensor<6x1x5x2xf32>) -> tensor<6x1x5x2xf32> {66 %0 = linalg.winograd_filter_transform fmr(F_4_3) ins(%arg0 : tensor<2x3x1x5xf32>) outs(%arg1 : tensor<6x1x5x2xf32>) -> tensor<6x1x5x2xf32>67 return %0 : tensor<6x1x5x2xf32>68}69 70module attributes {transform.with_named_sequence} {71 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {72 %0 = transform.structured.match ops{["linalg.winograd_filter_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op73 %1, %loop1:2 = transform.structured.tile_using_for %0 tile_sizes [1, 0, 0, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)74 transform.yield75 }76}77 78// CHECK-LABEL: func.func @tile_winograd_filter(79// CHECK-SAME: %[[ARG0:.*]]: tensor<2x3x1x5xf32>, %[[ARG1:.*]]: tensor<6x1x5x2xf32>) -> tensor<6x1x5x2xf32> {80// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index81// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index82// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index83// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index84// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index85// CHECK-DAG: %[[C1_1:.*]] = arith.constant 1 : index86// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG3:.*]] = %[[ARG1]])87// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C5]] step %[[C1_1]] iter_args(%[[ARG5:.*]] = %[[ARG3]])88// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][%[[ARG2]], 0, 0, %[[ARG4]]] [1, 3, 1, 1] [1, 1, 1, 1] : tensor<2x3x1x5xf32> to tensor<1x3x1x1xf32>89// CHECK: %[[EXTRACTED_SLICE_2:.*]] = tensor.extract_slice %[[ARG5]][0, 0, %[[ARG4]], %[[ARG2]]] [6, 1, 1, 1] [1, 1, 1, 1] : tensor<6x1x5x2xf32> to tensor<6x1x1x1xf32>90// CHECK: %[[S3:.*]] = linalg.winograd_filter_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<1x3x1x1xf32>) outs(%[[EXTRACTED_SLICE_2]] : tensor<6x1x1x1xf32>) -> tensor<6x1x1x1xf32>91// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S3]] into %[[ARG5]][0, 0, %[[ARG4]], %[[ARG2]]] [6, 1, 1, 1] [1, 1, 1, 1] : tensor<6x1x1x1xf32> into tensor<6x1x5x2xf32>92 93// -----94 95func.func @tile_winograd_input(%arg0: tensor<2x10x10x5xf32>, %arg1: tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32> {96 %0 = linalg.winograd_input_transform fmr(F_4_3) ins(%arg0 : tensor<2x10x10x5xf32>) outs(%arg1 : tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32>97 return %0 : tensor<6x6x2x2x2x5xf32>98}99 100module attributes {transform.with_named_sequence} {101 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {102 %0 = transform.structured.match ops{["linalg.winograd_input_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op103 %1, %loop3:2 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 1, 1, 0, 0] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)104 transform.yield105 }106}107 108// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (d0 * 4)>109// CHECK: #[[$MAP1:.+]] = affine_map<() -> (6)>110// CHECK-LABEL: func.func @tile_winograd_input(111// CHECK-SAME: %[[ARG0:.*]]: tensor<2x10x10x5xf32>, %[[ARG1:.*]]: tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32> {112// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index113// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index114// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index115// CHECK-DAG: %[[C2_1:.*]] = arith.constant 2 : index116// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index117// CHECK-DAG: %[[C1_2:.*]] = arith.constant 1 : index118// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG3:.*]] = %[[ARG1]])119// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C2_1]] step %[[C1_2]] iter_args(%[[ARG5:.*]] = %[[ARG3]])120// CHECK: %[[S3:.*]] = affine.apply #[[$MAP0]](%[[ARG2]])121// CHECK: %[[S4:.*]] = affine.apply #[[$MAP0]](%[[ARG4]])122// CHECK: %[[S5:.*]] = affine.apply #[[$MAP1]]()123// CHECK: %[[S6:.*]] = affine.apply #[[$MAP1]]()124// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][0, %[[S3]], %[[S4]], 0] [2, %[[S5]], %[[S6]], 5] [1, 1, 1, 1] : tensor<2x10x10x5xf32> to tensor<2x?x?x5xf32>125// CHECK: %[[EXTRACTED_SLICE_5:.*]] = tensor.extract_slice %[[ARG5]][0, 0, %[[ARG2]], %[[ARG4]], 0, 0] [6, 6, 1, 1, 2, 5] [1, 1, 1, 1, 1, 1] : tensor<6x6x2x2x2x5xf32> to tensor<6x6x1x1x2x5xf32>126// CHECK: %[[S7:.*]] = linalg.winograd_input_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<2x?x?x5xf32>) outs(%[[EXTRACTED_SLICE_5]] : tensor<6x6x1x1x2x5xf32>) -> tensor<6x6x1x1x2x5xf32>127// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S7]] into %[[ARG5]][0, 0, %[[ARG2]], %[[ARG4]], 0, 0] [6, 6, 1, 1, 2, 5] [1, 1, 1, 1, 1, 1] : tensor<6x6x1x1x2x5xf32> into tensor<6x6x2x2x2x5xf32>128 129// -----130 131func.func @tile_winograd_input(%arg0: tensor<2x10x10x5xf32>, %arg1: tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32> {132 %0 = linalg.winograd_input_transform fmr(F_4_3) ins(%arg0 : tensor<2x10x10x5xf32>) outs(%arg1 : tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32>133 return %0 : tensor<6x6x2x2x2x5xf32>134}135 136module attributes {transform.with_named_sequence} {137 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {138 %0 = transform.structured.match ops{["linalg.winograd_input_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op139 %1, %loop3:4 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 1, 1, 1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)140 transform.yield141 }142}143 144// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (d0 * 4)>145// CHECK: #[[$MAP1:.+]] = affine_map<() -> (6)>146// CHECK-LABEL: func.func @tile_winograd_input(147// CHECK-SAME: %[[ARG0:.*]]: tensor<2x10x10x5xf32>, %[[ARG1:.*]]: tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32> {148// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index149// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index150// CHECK-DAG: %[[C0_3:.*]] = arith.constant 0 : index151// CHECK-DAG: %[[C0_6:.*]] = arith.constant 0 : index152// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index153// CHECK-DAG: %[[C2_1:.*]] = arith.constant 2 : index154// CHECK-DAG: %[[C2_4:.*]] = arith.constant 2 : index155// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index156// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index157// CHECK-DAG: %[[C1_2:.*]] = arith.constant 1 : index158// CHECK-DAG: %[[C1_5:.*]] = arith.constant 1 : index159// CHECK-DAG: %[[C1_7:.*]] = arith.constant 1 : index160// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG3:.*]] = %[[ARG1]])161// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C2_1]] step %[[C1_2]] iter_args(%[[ARG5:.*]] = %[[ARG3]])162// CHECK: %[[S3:.*]] = scf.for %[[ARG6:.*]] = %[[C0_3]] to %[[C2_4]] step %[[C1_5]] iter_args(%[[ARG7:.*]] = %[[ARG5]])163// CHECK: %[[S4:.*]] = scf.for %[[ARG8:.*]] = %[[C0_6]] to %[[C5]] step %[[C1_7]] iter_args(%[[ARG9:.*]] = %[[ARG7]])164// CHECK: %[[S5:.*]] = affine.apply #[[$MAP0]](%[[ARG2]])165// CHECK: %[[S6:.*]] = affine.apply #[[$MAP0]](%[[ARG4]])166// CHECK: %[[S7:.*]] = affine.apply #[[$MAP1]]()167// CHECK: %[[S8:.*]] = affine.apply #[[$MAP1]]()168// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][%[[ARG6]], %[[S5]], %[[S6]], %[[ARG8]]] [1, %[[S7]], %[[S8]], 1] [1, 1, 1, 1] : tensor<2x10x10x5xf32> to tensor<1x?x?x1xf32>169// CHECK: %[[EXTRACTED_SLICE_10:.*]] = tensor.extract_slice %[[ARG9]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [6, 6, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] : tensor<6x6x2x2x2x5xf32> to tensor<6x6x1x1x1x1xf32>170// CHECK: %[[S9:.*]] = linalg.winograd_input_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<1x?x?x1xf32>) outs(%[[EXTRACTED_SLICE_10]] : tensor<6x6x1x1x1x1xf32>) -> tensor<6x6x1x1x1x1xf32>171// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S9]] into %[[ARG9]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [6, 6, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] : tensor<6x6x1x1x1x1xf32> into tensor<6x6x2x2x2x5xf32>172 173// -----174 175func.func @tile_winograd_input(%arg0: tensor<2x10x10x5xf32>, %arg1: tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32> {176 %0 = linalg.winograd_input_transform fmr(F_4_3) ins(%arg0 : tensor<2x10x10x5xf32>) outs(%arg1 : tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32>177 return %0 : tensor<6x6x2x2x2x5xf32>178}179 180module attributes {transform.with_named_sequence} {181 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {182 %0 = transform.structured.match ops{["linalg.winograd_input_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op183 %1, %loop3:4 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 2, 2, 2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)184 transform.yield185 }186}187 188// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (-d0 + 5, 2)>189// CHECK: #[[$MAP1:.+]] = affine_map<(d0) -> (d0 * 4)>190// CHECK: #[[$MAP2:.+]] = affine_map<() -> (10)>191// CHECK-LABEL: func.func @tile_winograd_input(192// CHECK-SAME: %[[ARG0:.*]]: tensor<2x10x10x5xf32>, %[[ARG1:.*]]: tensor<6x6x2x2x2x5xf32>) -> tensor<6x6x2x2x2x5xf32> {193// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index194// CHECK-DAG: %[[C0_1:.*]] = arith.constant 0 : index195// CHECK-DAG: %[[C0_4:.*]] = arith.constant 0 : index196// CHECK-DAG: %[[C0_7:.*]] = arith.constant 0 : index197// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index198// CHECK-DAG: %[[C2_2:.*]] = arith.constant 2 : index199// CHECK-DAG: %[[C2_5:.*]] = arith.constant 2 : index200// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index201// CHECK-DAG: %[[C2_0:.*]] = arith.constant 2 : index202// CHECK-DAG: %[[C2_3:.*]] = arith.constant 2 : index203// CHECK-DAG: %[[C2_6:.*]] = arith.constant 2 : index204// CHECK-DAG: %[[C2_8:.*]] = arith.constant 2 : index205// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C2_0]] iter_args(%[[ARG3:.*]] = %[[ARG1]])206// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_1]] to %[[C2_2]] step %[[C2_3]] iter_args(%[[ARG5:.*]] = %[[ARG3]])207// CHECK: %[[S3:.*]] = scf.for %[[ARG6:.*]] = %[[C0_4]] to %[[C2_5]] step %[[C2_6]] iter_args(%[[ARG7:.*]] = %[[ARG5]])208// CHECK: %[[S4:.*]] = scf.for %[[ARG8:.*]] = %[[C0_7]] to %[[C5]] step %[[C2_8]] iter_args(%[[ARG9:.*]] = %[[ARG7]])209// CHECK: %[[S5:.*]] = affine.min #[[$MAP0]](%[[ARG8]])210// CHECK: %[[S6:.*]] = affine.apply #[[$MAP1]](%[[ARG2]])211// CHECK: %[[S7:.*]] = affine.apply #[[$MAP1]](%[[ARG4]])212// CHECK: %[[S8:.*]] = affine.apply #[[$MAP2]]()213// CHECK: %[[S9:.*]] = affine.apply #[[$MAP2]]()214// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][%[[ARG6]], %[[S6]], %[[S7]], %[[ARG8]]] [2, %[[S8]], %[[S9]], %[[S5]]] [1, 1, 1, 1] : tensor<2x10x10x5xf32> to tensor<2x?x?x?xf32>215// CHECK: %[[EXTRACTED_SLICE_12:.*]] = tensor.extract_slice %[[ARG9]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [6, 6, 2, 2, 2, %[[S5]]] [1, 1, 1, 1, 1, 1] : tensor<6x6x2x2x2x5xf32> to tensor<6x6x2x2x2x?xf32>216// CHECK: %[[S10:.*]] = linalg.winograd_input_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<2x?x?x?xf32>) outs(%[[EXTRACTED_SLICE_12]] : tensor<6x6x2x2x2x?xf32>) -> tensor<6x6x2x2x2x?xf32>217// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S10]] into %[[ARG9]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [6, 6, 2, 2, 2, %[[S5]]] [1, 1, 1, 1, 1, 1] : tensor<6x6x2x2x2x?xf32> into tensor<6x6x2x2x2x5xf32>218 219// -----220 221func.func @tile_winograd_input(%arg0: tensor<2x1x10x5xf32>, %arg1: tensor<1x6x1x2x2x5xf32>) -> tensor<1x6x1x2x2x5xf32> {222 %0 = linalg.winograd_input_transform fmr(F_4_3) ins(%arg0 : tensor<2x1x10x5xf32>) outs(%arg1 : tensor<1x6x1x2x2x5xf32>) -> tensor<1x6x1x2x2x5xf32>223 return %0 : tensor<1x6x1x2x2x5xf32>224}225 226module attributes {transform.with_named_sequence} {227 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {228 %0 = transform.structured.match ops{["linalg.winograd_input_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op229 %1, %loop3:4 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 1, 1, 1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)230 transform.yield231 }232}233 234// CHECK: #[[$MAP:.+]] = affine_map<(d0) -> (d0)>235// CHECK: #[[$MAP1:.+]] = affine_map<(d0) -> (d0 * 4)>236// CHECK: #[[$MAP2:.+]] = affine_map<() -> (6)>237// CHECK-LABEL: func.func @tile_winograd_input(238// CHECK-SAME: %[[ARG0:.*]]: tensor<2x1x10x5xf32>, %[[ARG1:.*]]: tensor<1x6x1x2x2x5xf32>) -> tensor<1x6x1x2x2x5xf32> {239// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index240// CHECK-DAG: %[[C0_1:.*]] = arith.constant 0 : index241// CHECK-DAG: %[[C0_3:.*]] = arith.constant 0 : index242// CHECK-DAG: %[[C0_6:.*]] = arith.constant 0 : index243// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index244// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index245// CHECK-DAG: %[[C2_4:.*]] = arith.constant 2 : index246// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index247// CHECK-DAG: %[[C1_0:.*]] = arith.constant 1 : index248// CHECK-DAG: %[[C1_2:.*]] = arith.constant 1 : index249// CHECK-DAG: %[[C1_5:.*]] = arith.constant 1 : index250// CHECK-DAG: %[[C1_7:.*]] = arith.constant 1 : index251// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C1]] step %[[C1_0]] iter_args(%[[ARG3:.*]] = %[[ARG1]])252// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_1]] to %[[C2]] step %[[C1_2]] iter_args(%[[ARG5:.*]] = %[[ARG3]])253// CHECK: %[[S3:.*]] = scf.for %[[ARG6:.*]] = %[[C0_3]] to %[[C2_4]] step %[[C1_5]] iter_args(%[[ARG7:.*]] = %[[ARG5]])254// CHECK: %[[S4:.*]] = scf.for %[[ARG8:.*]] = %[[C0_6]] to %[[C5]] step %[[C1_7]] iter_args(%[[ARG9:.*]] = %[[ARG7]])255// CHECK: %[[S5:.*]] = affine.apply #[[$MAP]](%[[ARG2]])256// CHECK: %[[S6:.*]] = affine.apply #[[$MAP1]](%[[ARG4]])257// CHECK: %[[S7:.*]] = affine.apply #[[$MAP2]]()258// CHECK: %[[S8:.*]] = affine.apply #[[$MAP2]]()259// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][%[[ARG6]], %[[S5]], %[[S6]], %[[ARG8]]] [1, 1, %[[S8]], 1] [1, 1, 1, 1] : tensor<2x1x10x5xf32> to tensor<1x1x?x1xf32>260// CHECK: %[[EXTRACTED_SLICE_10:.*]] = tensor.extract_slice %[[ARG9]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [1, 6, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] : tensor<1x6x1x2x2x5xf32> to tensor<1x6x1x1x1x1xf32>261// CHECK: %[[S9:.*]] = linalg.winograd_input_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<1x1x?x1xf32>) outs(%[[EXTRACTED_SLICE_10]] : tensor<1x6x1x1x1x1xf32>) -> tensor<1x6x1x1x1x1xf32>262// CHECK: %[[INSERTED_SLICE:.*]] = tensor.insert_slice %[[S9]] into %[[ARG9]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [1, 6, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] : tensor<1x6x1x1x1x1xf32> into tensor<1x6x1x2x2x5xf32>263 264// -----265 266func.func @tile_winograd_output(%arg0 : tensor<6x6x2x2x2x2xf32>, %arg1: tensor<2x8x8x2xf32>) -> tensor<2x8x8x2xf32> {267 %0 = linalg.winograd_output_transform fmr(F_4_3) ins(%arg0 : tensor<6x6x2x2x2x2xf32>) outs(%arg1 : tensor<2x8x8x2xf32>) -> tensor<2x8x8x2xf32>268 return %0 : tensor<2x8x8x2xf32>269}270 271module attributes {transform.with_named_sequence} {272 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {273 %0 = transform.structured.match ops{["linalg.winograd_output_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op274 %1, %loop1:2 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 1, 1, 0, 0] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)275 transform.yield276 }277}278 279// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (d0 * 4)>280// CHECK: #[[$MAP1:.+]] = affine_map<() -> (4)>281// CHECK-LABEL: func.func @tile_winograd_output(282// CHECK-SAME: %[[ARG0:.*]]: tensor<6x6x2x2x2x2xf32>, %[[ARG1:.*]]: tensor<2x8x8x2xf32>) -> tensor<2x8x8x2xf32> {283// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index284// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index285// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index286// CHECK-DAG: %[[C2_1:.*]] = arith.constant 2 : index287// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index288// CHECK-DAG: %[[C1_2:.*]] = arith.constant 1 : index289// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG5:.*]] = %[[ARG1]]) -> (tensor<2x8x8x2xf32>)290// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C2_1]] step %[[C1_2]] iter_args(%[[ARG6:.*]] = %[[ARG5]]) -> (tensor<2x8x8x2xf32>)291// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][0, 0, %[[ARG2]], %[[ARG4]], 0, 0] [6, 6, 1, 1, 2, 2] [1, 1, 1, 1, 1, 1] : tensor<6x6x2x2x2x2xf32> to tensor<6x6x1x1x2x2xf32>292// CHECK: %[[S3:.*]] = affine.apply #[[$MAP0]](%[[ARG2]])293// CHECK: %[[S4:.*]] = affine.apply #[[$MAP0]](%[[ARG4]])294// CHECK: %[[S5:.*]] = affine.apply #[[$MAP1]]()295// CHECK: %[[S6:.*]] = affine.apply #[[$MAP1]]()296// CHECK: %[[EXTRACTED_SLICE_5:.*]] = tensor.extract_slice %[[ARG6]][0, %[[S3]], %[[S4]], 0] [2, %[[S5]], %[[S6]], 2] [1, 1, 1, 1] : tensor<2x8x8x2xf32> to tensor<2x?x?x2xf32>297 298// -----299 300func.func @tile_winograd_output(%arg0 : tensor<6x6x2x2x3x5xf32>, %arg1: tensor<3x8x8x5xf32>) -> tensor<3x8x8x5xf32> {301 %0 = linalg.winograd_output_transform fmr(F_4_3) ins(%arg0 : tensor<6x6x2x2x3x5xf32>) outs(%arg1 : tensor<3x8x8x5xf32>) -> tensor<3x8x8x5xf32>302 return %0 : tensor<3x8x8x5xf32>303}304 305module attributes {transform.with_named_sequence} {306 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {307 %0 = transform.structured.match ops{["linalg.winograd_output_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op308 %1, %loop1:4 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 2, 2, 2, 2] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)309 transform.yield310 }311}312 313// CHECK: #[[$MAP0:.+]] = affine_map<(d0) -> (-d0 + 3, 2)>314// CHECK: #[[$MAP1:.+]] = affine_map<(d0) -> (-d0 + 5, 2)>315// CHECK: #[[$MAP2:.+]] = affine_map<(d0) -> (d0 * 4)>316// CHECK: #[[$MAP3:.+]] = affine_map<() -> (8)>317// CHECK-LABEL: func.func @tile_winograd_output(318// CHECK-SAME: %[[ARG0:.*]]: tensor<6x6x2x2x3x5xf32>, %[[ARG1:.*]]: tensor<3x8x8x5xf32>) -> tensor<3x8x8x5xf32> {319// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index320// CHECK-DAG: %[[C0_1:.*]] = arith.constant 0 : index321// CHECK-DAG: %[[C0_4:.*]] = arith.constant 0 : index322// CHECK-DAG: %[[C0_6:.*]] = arith.constant 0 : index323// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index324// CHECK-DAG: %[[C2_2:.*]] = arith.constant 2 : index325// CHECK-DAG: %[[C3:.*]] = arith.constant 3 : index326// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index327// CHECK-DAG: %[[C2_0:.*]] = arith.constant 2 : index328// CHECK-DAG: %[[C2_3:.*]] = arith.constant 2 : index329// CHECK-DAG: %[[C2_5:.*]] = arith.constant 2 : index330// CHECK-DAG: %[[C2_7:.*]] = arith.constant 2 : index331// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C2_0]] iter_args(%[[ARG9:.*]] = %[[ARG1]]) -> (tensor<3x8x8x5xf32>)332// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_1]] to %[[C2_2]] step %[[C2_3]] iter_args(%[[ARG10:.*]] = %[[ARG9]]) -> (tensor<3x8x8x5xf32>)333// CHECK: %[[S3:.*]] = scf.for %[[ARG6:.*]] = %[[C0_4]] to %[[C3]] step %[[C2_5]] iter_args(%[[ARG11:.*]] = %[[ARG10]])334// CHECK: %[[S4:.*]] = scf.for %[[ARG8:.*]] = %[[C0_6]] to %[[C5]] step %[[C2_7]] iter_args(%[[ARG12:.*]] = %[[ARG11]])335// CHECK: %[[C3_8:.*]] = arith.constant 3 : index336// CHECK: %[[S5:.*]] = affine.min #[[$MAP0]](%[[ARG6]])337// CHECK: %[[C5_9:.*]] = arith.constant 5 : index338// CHECK: %[[S6:.*]] = affine.min #[[$MAP1]](%[[ARG8]])339// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [6, 6, 2, 2, %[[S5]], %[[S6]]] [1, 1, 1, 1, 1, 1] : tensor<6x6x2x2x3x5xf32> to tensor<6x6x2x2x?x?xf32>340// CHECK: %[[S7:.*]] = affine.apply #[[$MAP2]](%[[ARG2]])341// CHECK: %[[S8:.*]] = affine.apply #[[$MAP2]](%[[ARG4]])342// CHECK: %[[S9:.*]] = affine.apply #[[$MAP3]]()343// CHECK: %[[S10:.*]] = affine.apply #[[$MAP3]]()344// CHECK: %[[EXTRACTED_SLICE_12:.*]] = tensor.extract_slice %[[ARG12]][%[[ARG6]], %[[S7]], %[[S8]], %[[ARG8]]] [%[[S5]], %[[S9]], %[[S10]], %[[S6]]] [1, 1, 1, 1] : tensor<3x8x8x5xf32> to tensor<?x?x?x?xf32>345 346// -----347 348func.func @tile_winograd_output(%arg0 : tensor<6x1x2x1x3x5xf32>, %arg1: tensor<3x8x1x5xf32>) -> tensor<3x8x1x5xf32> {349 %0 = linalg.winograd_output_transform fmr(F_4_3) ins(%arg0 : tensor<6x1x2x1x3x5xf32>) outs(%arg1 : tensor<3x8x1x5xf32>) -> tensor<3x8x1x5xf32>350 return %0 : tensor<3x8x1x5xf32>351}352 353module attributes {transform.with_named_sequence} {354 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {355 %0 = transform.structured.match ops{["linalg.winograd_output_transform"]} in %arg1 : (!transform.any_op) -> !transform.any_op356 %1, %loop1:4 = transform.structured.tile_using_for %0 tile_sizes [0, 0, 1, 1, 1, 1] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op)357 transform.yield358 }359}360 361// CHECK: #[[$MAP:.+]] = affine_map<(d0) -> (d0 * 4)>362// CHECK: #[[$MAP1:.+]] = affine_map<(d0) -> (d0)>363// CHECK: #[[$MAP2:.+]] = affine_map<() -> (4)>364// CHECK-LABEL: func.func @tile_winograd_output(365// CHECK-SAME: %[[ARG0:.*]]: tensor<6x1x2x1x3x5xf32>, %[[ARG1:.*]]: tensor<3x8x1x5xf32>) -> tensor<3x8x1x5xf32> {366// CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index367// CHECK-DAG: %[[C0_0:.*]] = arith.constant 0 : index368// CHECK-DAG: %[[C0_3:.*]] = arith.constant 0 : index369// CHECK-DAG: %[[C0_5:.*]] = arith.constant 0 : index370// CHECK-DAG: %[[C2:.*]] = arith.constant 2 : index371// CHECK-DAG: %[[C1_1:.*]] = arith.constant 1 : index372// CHECK-DAG: %[[C3:.*]] = arith.constant 3 : index373// CHECK-DAG: %[[C5:.*]] = arith.constant 5 : index374// CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index375// CHECK-DAG: %[[C1_2:.*]] = arith.constant 1 : index376// CHECK-DAG: %[[C1_4:.*]] = arith.constant 1 : index377// CHECK-DAG: %[[C1_6:.*]] = arith.constant 1 : index378// CHECK: %[[S1:.*]] = scf.for %[[ARG2:.*]] = %[[C0]] to %[[C2]] step %[[C1]] iter_args(%[[ARG9:.*]] = %[[ARG1]]) -> (tensor<3x8x1x5xf32>)379// CHECK: %[[S2:.*]] = scf.for %[[ARG4:.*]] = %[[C0_0]] to %[[C1_1]] step %[[C1_2]] iter_args(%[[ARG10:.*]] = %[[ARG9]]) -> (tensor<3x8x1x5xf32>)380// CHECK: %[[S3:.*]] = scf.for %[[ARG6:.*]] = %[[C0_3]] to %[[C3]] step %[[C1_4]] iter_args(%[[ARG11:.*]] = %[[ARG10]]) -> (tensor<3x8x1x5xf32>)381// CHECK: %[[S4:.*]] = scf.for %[[ARG8:.*]] = %[[C0_5]] to %[[C5]] step %[[C1_6]] iter_args(%[[ARG12:.*]] = %[[ARG11]]) -> (tensor<3x8x1x5xf32>)382// CHECK: %[[EXTRACTED_SLICE:.*]] = tensor.extract_slice %[[ARG0]][0, 0, %[[ARG2]], %[[ARG4]], %[[ARG6]], %[[ARG8]]] [6, 1, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] : tensor<6x1x2x1x3x5xf32> to tensor<6x1x1x1x1x1xf32>383// CHECK: %[[S5:.*]] = affine.apply #[[$MAP]](%[[ARG2]])384// CHECK: %[[S6:.*]] = affine.apply #[[$MAP1]](%[[ARG4]])385// CHECK: %[[S7:.*]] = affine.apply #[[$MAP2]]()386// CHECK: %[[S8:.*]] = affine.apply #[[$MAP2]]()387// CHECK: %[[EXTRACTED_SLICE_9:.*]] = tensor.extract_slice %[[ARG12]][%[[ARG6]], %[[S5]], %[[S6]], %[[ARG8]]] [1, %[[S7]], 1, 1] [1, 1, 1, 1] : tensor<3x8x1x5xf32> to tensor<1x?x1x1xf32>388// CHECK: %[[S9:.*]] = linalg.winograd_output_transform fmr(F_4_3) ins(%[[EXTRACTED_SLICE]] : tensor<6x1x1x1x1x1xf32>) outs(%[[EXTRACTED_SLICE_9]] : tensor<1x?x1x1xf32>) -> tensor<1x?x1x1xf32>389