brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · cf1eb3e Raw
42 lines · plain
1// Reported by https://github.com/llvm/llvm-project/issues/615302 3// RUN: mlir-opt %s --sparse-reinterpret-map -sparsification | FileCheck %s4 5#map1 = affine_map<(d0) -> (0, d0)>6#map2 = affine_map<(d0) -> (d0)>7 8#SpVec = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }>9 10// CHECK-LABEL:   func.func @main(11// CHECK-SAME:      %[[VAL_0:.*0]]: tensor<1x77xi1>,12// CHECK-SAME:      %[[VAL_1:.*1]]: tensor<1x77xi1>) -> tensor<77xi1, #{{.*}}> {13// CHECK-DAG:       %[[VAL_2:.*]] = arith.constant 77 : index14// CHECK-DAG:       %[[VAL_3:.*]] = arith.constant 0 : index15// CHECK-DAG:       %[[VAL_4:.*]] = arith.constant 1 : index16// CHECK-DAG:       %[[VAL_5:.*]] = tensor.empty() : tensor<77xi1, #{{.*}}>17// CHECK-DAG:       %[[VAL_6:.*]] = bufferization.to_buffer %[[VAL_0]] : tensor<1x77xi1>18// CHECK-DAG:       %[[VAL_7:.*]] = bufferization.to_buffer %[[VAL_1]] : tensor<1x77xi1>19// CHECK:           %[[VAL_8:.*]] = scf.for %[[VAL_9:.*]] = %[[VAL_3]] to %[[VAL_2]] step %[[VAL_4]] iter_args(%[[VAL_10:.*]] = %[[VAL_5]]) -> (tensor<77xi1, #{{.*}}>) {20// CHECK:             %[[VAL_11:.*]] = memref.load %[[VAL_6]]{{\[}}%[[VAL_3]], %[[VAL_9]]] : memref<1x77xi1>21// CHECK:             %[[VAL_12:.*]] = memref.load %[[VAL_7]]{{\[}}%[[VAL_3]], %[[VAL_9]]] : memref<1x77xi1>22// CHECK:             %[[VAL_13:.*]] = arith.addi %[[VAL_11]], %[[VAL_12]] : i123// CHECK:             %[[VAL_14:.*]] = tensor.insert %[[VAL_13]] into %[[VAL_10]]{{\[}}%[[VAL_9]]] : tensor<77xi1, #{{.*}}>24// CHECK:             scf.yield %[[VAL_14]] : tensor<77xi1, #{{.*}}>25// CHECK:           }26// CHECK:           %[[VAL_15:.*]] = sparse_tensor.load %[[VAL_16:.*]] hasInserts : tensor<77xi1, #{{.*}}>27// CHECK:           return %[[VAL_15]] : tensor<77xi1, #{{.*}}>28// CHECK:         }29func.func @main(%arg0: tensor<1x77xi1>, %arg1: tensor<1x77xi1>) -> tensor<77xi1, #SpVec> {30  %0 = tensor.empty() : tensor<77xi1, #SpVec>31  %1 = linalg.generic {32    indexing_maps = [#map1, #map1, #map2],33    iterator_types = ["parallel"]}34    ins(%arg0, %arg1 : tensor<1x77xi1>, tensor<1x77xi1>)35    outs(%0 : tensor<77xi1, #SpVec>) {36  ^bb0(%in: i1, %in_0: i1, %out: i1):37    %2 = arith.addi %in, %in_0 : i138    linalg.yield %2 : i139  } -> tensor<77xi1, #SpVec>40  return %1 : tensor<77xi1, #SpVec>41}42