brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 02fa7ac Raw
45 lines · plain
1// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(linalg-detensorize{aggressive-mode}))" | FileCheck %s -check-prefix=DET-ALL2// RUN: mlir-opt %s -pass-pipeline="builtin.module(func.func(linalg-detensorize))" | FileCheck %s -check-prefix=DET-CF3 4 5#map0 = affine_map<() -> ()>6 7#attrs = {8  indexing_maps = [#map0, #map0, #map0],9  iterator_types = []10}11 12func.func @main(%farg0 : tensor<i32>) -> (tensor<i1>) attributes {} {13  %c10 = arith.constant 10 : i3214  %1 = tensor.from_elements %c10 : tensor<i32>15  %3 = tensor.empty() : tensor<i1>16  %4 = linalg.generic #attrs17    ins(%farg0, %1 : tensor<i32>, tensor<i32>)18    outs(%3 : tensor<i1>) {19    ^bb0(%arg0: i32, %arg1: i32, %arg2: i1):20      %8 = arith.cmpi slt, %arg0, %arg1 : i3221      linalg.yield %8 : i122  } -> tensor<i1>23  return %4 : tensor<i1>24}25 26 27// DET-ALL-LABEL: func @main(%{{.*}}: tensor<i32>)28// DET-ALL-NEXT:    arith.constant 1029// DET-ALL-NEXT:    tensor.extract %{{.*}}[]30// DET-ALL-NEXT:    arith.cmpi slt, %{{.*}}, %{{.*}}31// DET-ALL-NEXT:    tensor.from_elements %{{.*}}32// DET-ALL-NEXT:    return %{{.*}} : tensor<i1>33// DET-ALL-NEXT:  }34 35// DET-CF-LABEL: func @main(%{{.*}}: tensor<i32>)36// DET-CF-NEXT:    arith.constant dense<10> : tensor<i32>37// DET-CF-NEXT:    tensor.empty() : tensor<i1>38// DET-CF-NEXT:    linalg.generic39// DET-CF-NEXT:    ^{{.*}}(%{{.*}}: i32, %{{.*}}: i32, %{{.*}}: i1)40// DET-CF-NEXT:      arith.cmpi slt, %{{.*}}, %{{.*}}41// DET-CF-NEXT:      linalg.yield %{{.*}}42// DET-CF-NEXT:    } -> tensor<i1>43// DET-CF-NEXT:    return %{{.*}}44// DET-CF-NEXT:  }45