// RUN: mlir-opt %s --lower-sparse-ops-to-foreach --split-input-file | FileCheck %s // Ensure that we exit gracefully rather than crashing. // CHECK-LABEL: func.func @test_tensor_dim_unranked // CHECK: tensor.dim func.func @test_tensor_dim_unranked(%arg0: tensor<*xf32>) -> index { %c = arith.constant 0 : index %0 = tensor.dim %arg0, %c : tensor<*xf32> return %0 : index } // ----- #SparseVector = #sparse_tensor.encoding<{ map = (d0) -> (d0 : compressed) }> // CHECK-LABEL: func.func @test_no_constant_dim // CHECK: tensor.dim func.func @test_no_constant_dim(%arg0: tensor, %arg1: index) -> index { %0 = tensor.dim %arg0, %arg1 : tensor return %0 : index } // ----- // CHECK-LABEL: func.func @test_tensor_dim_no_encoding // CHECK: tensor.dim func.func @test_tensor_dim_no_encoding(%arg0: tensor) -> index { %c = arith.constant 0 : index %0 = tensor.dim %arg0, %c : tensor return %0 : index } // ----- // CHECK-LABEL: func.func @test_tensor_reshape_unranked // CHECK: tensor.reshape func.func @test_tensor_reshape_unranked(%src: tensor<*xf32>, %shape: tensor<1xi32>) -> tensor { %dst = tensor.reshape %src(%shape) : (tensor<*xf32>, tensor<1xi32>) -> tensor return %dst : tensor } // ----- // CHECK-LABEL: func.func @test_tensor_reshape_no_encoding // CHECK: tensor.reshape func.func @test_tensor_reshape_no_encoding(%src: tensor, %shape: tensor<1xi32>) -> tensor { %dst = tensor.reshape %src(%shape) : (tensor, tensor<1xi32>) -> tensor return %dst : tensor }