[Mlir-commits] [mlir] [TOSA] Remove i64 from valid element datatypes in validation (PR #113380)

Luke Hutton llvmlistbot at llvm.org
Tue Oct 22 13:54:36 PDT 2024


https://github.com/lhutton1 created https://github.com/llvm/llvm-project/pull/113380

Align the validation pass valid element datatypes check more closely to the specification by removing i64 as a supported datatype. The spec does not currently support it.

Change-Id: I38b386ee53da168e85a8b6fe4c8378cfbd8f2fe4

>From 6a1c0df84504081a38e3fc663ce46f3403169786 Mon Sep 17 00:00:00 2001
From: Luke Hutton <luke.hutton at arm.com>
Date: Mon, 21 Oct 2024 14:15:22 +0000
Subject: [PATCH] [TOSA] Remove i64 from valid element datatypes in validation

Align the validation pass valid element datatypes check more closely to
the specification by removing i64 as a supported datatype. The spec
does not currently support it.

Change-Id: I38b386ee53da168e85a8b6fe4c8378cfbd8f2fe4
Signed-off-by: Luke Hutton <luke.hutton at arm.com>
---
 mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp |  1 -
 mlir/test/Dialect/Tosa/invalid.mlir                 | 10 ++++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
index e390a613b58077..93e8cac6b84e9c 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
@@ -543,7 +543,6 @@ bool TosaValidation::isValidElementType(Type type) {
       case 16:
       case 32:
       case 48:
-      case 64:
         return true;
       default:
         return false;
diff --git a/mlir/test/Dialect/Tosa/invalid.mlir b/mlir/test/Dialect/Tosa/invalid.mlir
index b9298b66643538..9a29bf1236e8d8 100644
--- a/mlir/test/Dialect/Tosa/invalid.mlir
+++ b/mlir/test/Dialect/Tosa/invalid.mlir
@@ -609,3 +609,13 @@ func.func @test_transpose_conv2d_invalid_outshape(%arg0: tensor<1x32x32x8xf32>,
   %0 = tosa.transpose_conv2d %arg0, %arg1, %arg2 {out_pad = array<i64: 0, 0, 0, 0>, out_shape = array<i64: 1, 32, 32>, stride = array<i64: 1, 1>} : (tensor<1x32x32x8xf32>, tensor<16x1x1x8xf32>, tensor<16xf32>) -> tensor<1x32x32x16xf32>
   return %0 : tensor<1x32x32x16xf32>
 }
+
+// -----
+
+// CHECK-LABEL: test_unsupported_int64_data_type
+func.func @test_unsupported_int64_data_type(%arg0: tensor<1x13x13x5xf32>) -> tensor<1x13x13xi64> {
+  // expected-error at +1 {{'tosa.argmax' op is not profile-aligned: element type 'i64' is not legal}}
+  %0 = tosa.argmax %arg0 {axis = 3 : i32} : (tensor<1x13x13x5xf32>) -> tensor<1x13x13xi64>
+  // expected-error at +1 {{'func.return' op is not profile-aligned: element type 'i64' is not legal}}
+  return %0 : tensor<1x13x13xi64>
+}



More information about the Mlir-commits mailing list