@@ -1206,6 +1206,41 @@ func.func @test_unranked_tensor(%arg0: tensor<*xf32>) {
12061206
12071207// -----
12081208
1209+ // CHECK-LABEL: tensor_dim
1210+ func.func @test_tensor_dim (%arg0: tensor <1 x2147483648 xf32 >) {
1211+ %0 = tosa.const_shape {values = dense <0 > : tensor <2 xindex >} : () -> !tosa.shape <2 >
1212+ %1 = tosa.const_shape {values = dense <1 > : tensor <2 xindex >} : () -> !tosa.shape <2 >
1213+
1214+ // expected-error@+1 {{'tosa.slice' op failed level check: operand tensor size (in bytes) <= (1 << MAX_LOG2_SIZE - 1)}}
1215+ %2 = tosa.slice %arg0 , %0 , %1 : (tensor <1 x2147483648 xf32 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <1 x1 xf32 >
1216+ return
1217+ }
1218+
1219+ // -----
1220+
1221+ // CHECK-LABEL: tensor_size
1222+ func.func @test_tensor_size (%arg0: tensor <1 x1073741824 xf32 >) {
1223+ %0 = tosa.const_shape {values = dense <0 > : tensor <2 xindex >} : () -> !tosa.shape <2 >
1224+ %1 = tosa.const_shape {values = dense <1 > : tensor <2 xindex >} : () -> !tosa.shape <2 >
1225+
1226+ // expected-error@+1 {{'tosa.slice' op failed level check: operand tensor size (in bytes) <= (1 << MAX_LOG2_SIZE - 1)}}
1227+ %2 = tosa.slice %arg0 , %0 , %1 : (tensor <1 x1073741824 xf32 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <1 x1 xf32 >
1228+ return
1229+ }
1230+
1231+ // -----
1232+
1233+ // CHECK-LABEL: tensor_size
1234+ func.func @test_tensor_size_ok (%arg0: tensor <1 x536870911 xf32 >) {
1235+ %0 = tosa.const_shape {values = dense <0 > : tensor <2 xindex >} : () -> !tosa.shape <2 >
1236+ %1 = tosa.const_shape {values = dense <1 > : tensor <2 xindex >} : () -> !tosa.shape <2 >
1237+
1238+ %2 = tosa.slice %arg0 , %0 , %1 : (tensor <1 x536870911 xf32 >, !tosa.shape <2 >, !tosa.shape <2 >) -> tensor <1 x1 xf32 >
1239+ return
1240+ }
1241+
1242+ // -----
1243+
12091244// CHECK-LABEL: test_concat_tensor_list_size
12101245func.func @test_concat_tensor_list_size () {
12111246 %0 = " tosa.const" () {values = dense <0 > : tensor <1 xi32 >} : () -> tensor <1 xi32 >
0 commit comments