brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 4f21055 Raw
55 lines · plain
1// RUN: mlir-opt %s --lower-sparse-ops-to-foreach --split-input-file | FileCheck %s2 3// Ensure that we exit gracefully rather than crashing.4 5// CHECK-LABEL: func.func @test_tensor_dim_unranked6//       CHECK: tensor.dim7func.func @test_tensor_dim_unranked(%arg0: tensor<*xf32>) -> index {8  %c = arith.constant 0 : index9  %0 = tensor.dim %arg0, %c : tensor<*xf32>10  return %0 : index11}12 13// -----14 15#SparseVector = #sparse_tensor.encoding<{16  map = (d0) -> (d0 : compressed)17}>18 19// CHECK-LABEL: func.func @test_no_constant_dim20//       CHECK: tensor.dim21func.func @test_no_constant_dim(%arg0: tensor<?xf64, #SparseVector>, %arg1: index) -> index {22  %0 = tensor.dim %arg0, %arg1 : tensor<?xf64, #SparseVector>23  return %0 : index24}25 26// -----27 28// CHECK-LABEL: func.func @test_tensor_dim_no_encoding29//       CHECK: tensor.dim30func.func @test_tensor_dim_no_encoding(%arg0: tensor<?xf32>) -> index {31  %c = arith.constant 0 : index32  %0 = tensor.dim %arg0, %c : tensor<?xf32>33  return %0 : index34}35 36// -----37 38// CHECK-LABEL: func.func @test_tensor_reshape_unranked39//       CHECK: tensor.reshape40func.func @test_tensor_reshape_unranked(%src: tensor<*xf32>, %shape: tensor<1xi32>) -> tensor<?xf32> {41  %dst = tensor.reshape %src(%shape)42         : (tensor<*xf32>, tensor<1xi32>) -> tensor<?xf32>43  return %dst : tensor<?xf32>44}45 46// -----47 48// CHECK-LABEL: func.func @test_tensor_reshape_no_encoding49//       CHECK: tensor.reshape50func.func @test_tensor_reshape_no_encoding(%src: tensor<?x?xf32>, %shape: tensor<1xi32>) -> tensor<?xf32> {51  %dst = tensor.reshape %src(%shape)52         : (tensor<?x?xf32>, tensor<1xi32>) -> tensor<?xf32>53  return %dst : tensor<?xf32>54}55