[Mlir-commits] [mlir] 2bbe8e8 - [mlir][tosa] Add more level_check tests for tensor_dim and tensor_size (#135062)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 10 08:13:28 PDT 2025
Author: Jerry-Ge
Date: 2025-04-10T08:13:24-07:00
New Revision: 2bbe8e825e53f3878c344adc7b5440c1040b097e
URL: https://github.com/llvm/llvm-project/commit/2bbe8e825e53f3878c344adc7b5440c1040b097e
DIFF: https://github.com/llvm/llvm-project/commit/2bbe8e825e53f3878c344adc7b5440c1040b097e.diff
LOG: [mlir][tosa] Add more level_check tests for tensor_dim and tensor_size (#135062)
Signed-off-by: Jerry Ge <jerry.ge at arm.com>
Added:
Modified:
mlir/test/Dialect/Tosa/level_check.mlir
Removed:
################################################################################
diff --git a/mlir/test/Dialect/Tosa/level_check.mlir b/mlir/test/Dialect/Tosa/level_check.mlir
index 8c3b2e526e444..39a868103cf26 100644
--- a/mlir/test/Dialect/Tosa/level_check.mlir
+++ b/mlir/test/Dialect/Tosa/level_check.mlir
@@ -1206,6 +1206,41 @@ func.func @test_unranked_tensor(%arg0: tensor<*xf32>) {
// -----
+// CHECK-LABEL: tensor_dim
+func.func @test_tensor_dim(%arg0: tensor<1x2147483648xf32>) {
+ %0 = tosa.const_shape {values = dense<0> : tensor<2xindex>} : () -> !tosa.shape<2>
+ %1 = tosa.const_shape {values = dense<1> : tensor<2xindex>} : () -> !tosa.shape<2>
+
+ // expected-error at +1 {{'tosa.slice' op failed level check: operand tensor size (in bytes) <= (1 << MAX_LOG2_SIZE - 1)}}
+ %2= tosa.slice %arg0, %0, %1 : (tensor<1x2147483648xf32>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1xf32>
+ return
+}
+
+// -----
+
+// CHECK-LABEL: tensor_size
+func.func @test_tensor_size(%arg0: tensor<1x1073741824xf32>) {
+ %0 = tosa.const_shape {values = dense<0> : tensor<2xindex>} : () -> !tosa.shape<2>
+ %1 = tosa.const_shape {values = dense<1> : tensor<2xindex>} : () -> !tosa.shape<2>
+
+ // expected-error at +1 {{'tosa.slice' op failed level check: operand tensor size (in bytes) <= (1 << MAX_LOG2_SIZE - 1)}}
+ %2= tosa.slice %arg0, %0, %1 : (tensor<1x1073741824xf32>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1xf32>
+ return
+}
+
+// -----
+
+// CHECK-LABEL: tensor_size
+func.func @test_tensor_size_ok(%arg0: tensor<1x536870911xf32>) {
+ %0 = tosa.const_shape {values = dense<0> : tensor<2xindex>} : () -> !tosa.shape<2>
+ %1 = tosa.const_shape {values = dense<1> : tensor<2xindex>} : () -> !tosa.shape<2>
+
+ %2= tosa.slice %arg0, %0, %1 : (tensor<1x536870911xf32>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1xf32>
+ return
+}
+
+// -----
+
// CHECK-LABEL: test_concat_tensor_list_size
func.func @test_concat_tensor_list_size() {
%0 = "tosa.const"() {values = dense<0> : tensor<1xi32>} : () -> tensor<1xi32>
More information about the Mlir-commits
mailing list