brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · c501a09 Raw
33 lines · plain
1// RUN: mlir-opt %s --sparse-tensor-codegen --cse |  FileCheck %s2 3#CSR = #sparse_tensor.encoding<{4  map = (d0, d1) -> (d0 : dense, d1 : compressed)5}>6 7#CSR_SLICE = #sparse_tensor.encoding<{8  map = (d0 : #sparse_tensor<slice(0, 4, 1)>, d1 : #sparse_tensor<slice(0, 8, 1)>) -> (d0 : dense, d1 : compressed)9}>10 11// CHECK-LABEL:   func.func @sparse_slice(12// CHECK-SAME:                            %[[VAL_0:.*0]]: memref<?xindex>,13// CHECK-SAME:                            %[[VAL_1:.*1]]: memref<?xindex>,14// CHECK-SAME:                            %[[VAL_2:.*2]]: memref<?xf64>,15// CHECK-SAME:                            %[[VAL_3:.*3]]: !sparse_tensor.storage_specifier<#sparse{{[0-9]*}}>)16// CHECK:           %[[VAL_4:.*]] = sparse_tensor.storage_specifier.init with %[[VAL_3]]17// CHECK:           %[[VAL_5:.*]] = arith.constant 0 : index18// CHECK:           %[[VAL_6:.*]] = arith.constant 4 : index19// CHECK:           %[[VAL_7:.*]] = arith.constant 1 : index20// CHECK:           %[[VAL_8:.*]] = sparse_tensor.storage_specifier.set %[[VAL_4]]  dim_offset at 0 with %[[VAL_5]]21// CHECK:           %[[VAL_9:.*]] = sparse_tensor.storage_specifier.set %[[VAL_8]]  lvl_sz at 0 with %[[VAL_6]]22// CHECK:           %[[VAL_10:.*]] = sparse_tensor.storage_specifier.set %[[VAL_9]]  dim_stride at 0 with %[[VAL_7]]23// CHECK:           %[[VAL_11:.*]] = arith.constant 8 : index24// CHECK:           %[[VAL_12:.*]] = sparse_tensor.storage_specifier.set %[[VAL_10]]  dim_offset at 1 with %[[VAL_5]]25// CHECK:           %[[VAL_13:.*]] = sparse_tensor.storage_specifier.set %[[VAL_12]]  lvl_sz at 1 with %[[VAL_11]]26// CHECK:           %[[VAL_14:.*]] = sparse_tensor.storage_specifier.set %[[VAL_13]]  dim_stride at 1 with %[[VAL_7]]27// CHECK:           return %[[VAL_0]], %[[VAL_1]], %[[VAL_2]], %[[VAL_14]]28func.func @sparse_slice(%t1 : tensor<8x8xf64, #CSR>) -> tensor<4x8xf64, #CSR_SLICE> {29  %a1 = tensor.extract_slice %t1[0, 0][4, 8][1, 1] : tensor<8x8xf64, #CSR> to30                                                     tensor<4x8xf64, #CSR_SLICE>31  return %a1 : tensor<4x8xf64, #CSR_SLICE>32}33