67 lines · plain
1// RUN: mlir-opt %s -transform-interpreter -canonicalize -split-input-file | FileCheck %s -check-prefix=TILE-10n252 3func.func @indexed_vector(%arg0: memref<50xindex>) {4 linalg.generic {indexing_maps = [affine_map<(i) -> (i)>],5 iterator_types = ["parallel"]}6 outs(%arg0 : memref<50xindex>) {7 ^bb0(%a: index):8 %i = linalg.index 0 : index9 linalg.yield %i : index10 }11 return12}13 14module attributes {transform.with_named_sequence} {15 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {16 %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op17 %1, %loop = transform.structured.tile_using_for %0 tile_sizes [10] : (!transform.any_op) -> (!transform.any_op, !transform.any_op)18 transform.yield19 }20}21 22// TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0)[s0] -> (d0 + s0)> 23// TILE-10n25-LABEL: func @indexed_vector24// TILE-10n25: %[[C10:.*]] = arith.constant 10 : index25// TILE-10n25: scf.for %[[J:.*]] = {{.*}} step %[[C10]]26// TILE-10n25: linalg.generic27// TILE-10n25: %[[I:.*]] = linalg.index 0 : index28// TILE-10n25: %[[NEW_I:.*]] = affine.apply [[$MAP]](%[[J]])[%[[I]]]29// TILE-10n25: linalg.yield %[[NEW_I]] : index30 31// -----32 33func.func @indexed_matrix(%arg0: memref<50x50xindex>) {34 linalg.generic {indexing_maps = [affine_map<(i, j) -> (i, j)>],35 iterator_types = ["parallel", "parallel"]}36 outs(%arg0 : memref<50x50xindex>) {37 ^bb0(%a: index):38 %i = linalg.index 0 : index39 %j = linalg.index 1 : index40 %sum = arith.addi %i, %j : index41 linalg.yield %sum : index42 }43 return44}45 46module attributes {transform.with_named_sequence} {47 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {48 %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op49 %1, %loop:2 = transform.structured.tile_using_for %0 tile_sizes [10, 25] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)50 transform.yield51 }52}53 54// TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0)[s0] -> (d0 + s0)>55// TILE-10n25-LABEL: func @indexed_matrix56// TILE-10n25-DAG: %[[C25:.*]] = arith.constant 25 : index57// TILE-10n25-DAG: %[[C10:.*]] = arith.constant 10 : index58// TILE-10n25: scf.for %[[K:.*]] = {{.*}} step %[[C10]]59// TILE-10n25: scf.for %[[L:.*]] = {{.*}} step %[[C25]]60// TILE-10n25: linalg.generic61// TILE-10n25: %[[I:.*]] = linalg.index 0 : index62// TILE-10n25: %[[NEW_I:.*]] = affine.apply [[$MAP]](%[[K]])[%[[I]]]63// TILE-10n25: %[[J:.*]] = linalg.index 1 : index64// TILE-10n25: %[[NEW_J:.*]] = affine.apply [[$MAP]](%[[L]])[%[[J]]]65// TILE-10n25: %[[SUM:.*]] = arith.addi %[[NEW_I]], %[[NEW_J]] : index66// TILE-10n25: linalg.yield %[[SUM]] : index67