Run TFLite ConvertFunctionMetadataPass on FuncOp. (#8443)
This pass did not appear to be running and the tests that would have caught it were disabled.
Found while helping with https://github.com/google/iree/issues/8412
diff --git a/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp b/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp
index ed9a78a..1696f34 100644
--- a/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp
+++ b/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp
@@ -45,7 +45,7 @@
//----------------------------------------------------------------------------
pm.addPass(createConvertModuleMetadataPass());
- pm.nest<ModuleOp>().addPass(createConvertFunctionMetadataPass());
+ pm.nest<FuncOp>().addPass(createConvertFunctionMetadataPass());
//----------------------------------------------------------------------------
// Convert all TFL ops to TOSA ops
diff --git a/integrations/tensorflow/iree_tf_compiler/TFL/test/import/BUILD b/integrations/tensorflow/iree_tf_compiler/TFL/test/import/BUILD
index 65a378c..e21753b 100644
--- a/integrations/tensorflow/iree_tf_compiler/TFL/test/import/BUILD
+++ b/integrations/tensorflow/iree_tf_compiler/TFL/test/import/BUILD
@@ -23,12 +23,6 @@
include = ["*.mlir"],
),
data = glob(["*.tflite"]),
- # TODO: These tests have never passed
- tags = [
- "manual",
- "nokokoro",
- "notap",
- ],
tools = [
"//iree_tf_compiler:iree-import-tflite",
"@llvm-project//llvm:FileCheck",
diff --git a/integrations/tensorflow/iree_tf_compiler/TFL/test/import/add.mlir b/integrations/tensorflow/iree_tf_compiler/TFL/test/import/add.mlir
index 2b563a0..c204c63 100644
--- a/integrations/tensorflow/iree_tf_compiler/TFL/test/import/add.mlir
+++ b/integrations/tensorflow/iree_tf_compiler/TFL/test/import/add.mlir
@@ -1,7 +1,7 @@
-// RUN: iree-import-tflite iree_tf_compiler/test/TFL/add.tflite | FileCheck %s
+// RUN: iree-import-tflite %S/add.tflite | FileCheck %s
// CHECK: module {
-// CHECK-NEXT: func @main(%arg0: tensor<1x8x8x3xf32>) -> tensor<1x8x8x3xf32> attributes {tf.entry_function = {inputs = "input", outputs = "output"}} {
+// CHECK-NEXT: func @main(%arg0: tensor<1x8x8x3xf32> {iree.identifier = "input"}) -> (tensor<1x8x8x3xf32> {iree.identifier = "output"}) {
// CHECK-NEXT: %0 = "tosa.add"(%arg0, %arg0) : (tensor<1x8x8x3xf32>, tensor<1x8x8x3xf32>) -> tensor<1x8x8x3xf32>
// CHECK-NEXT: %1 = "tosa.add"(%0, %arg0) : (tensor<1x8x8x3xf32>, tensor<1x8x8x3xf32>) -> tensor<1x8x8x3xf32>
// CHECK-NEXT: return %1 : tensor<1x8x8x3xf32>
diff --git a/integrations/tensorflow/iree_tf_compiler/TFL/test/import/multi_add.mlir b/integrations/tensorflow/iree_tf_compiler/TFL/test/import/multi_add.mlir
index 6d8e283..8aa3845 100644
--- a/integrations/tensorflow/iree_tf_compiler/TFL/test/import/multi_add.mlir
+++ b/integrations/tensorflow/iree_tf_compiler/TFL/test/import/multi_add.mlir
@@ -1,7 +1,7 @@
-// RUN: iree-import-tflite iree_tf_compiler/test/TFL/multi_add.tflite | FileCheck %s
+// RUN: iree-import-tflite %S/multi_add.tflite | FileCheck %s
// CHECK: module {
-// CHECK-NEXT: func @main(%arg0: tensor<1x8x8x3xf32>, %arg1: tensor<1x8x8x3xf32>, %arg2: tensor<1x8x8x3xf32>, %arg3: tensor<1x8x8x3xf32>) -> (tensor<1x8x8x3xf32>, tensor<1x8x8x3xf32>) attributes {tf.entry_function = {inputs = "a,b,c,d", outputs = "x,y"}} {
+// CHECK-NEXT: func @main(%arg0: tensor<1x8x8x3xf32> {iree.identifier = "a"}, %arg1: tensor<1x8x8x3xf32> {iree.identifier = "b"}, %arg2: tensor<1x8x8x3xf32> {iree.identifier = "c"}, %arg3: tensor<1x8x8x3xf32> {iree.identifier = "d"}) -> (tensor<1x8x8x3xf32> {iree.identifier = "x"}, tensor<1x8x8x3xf32> {iree.identifier = "y"}) {
// CHECK-NEXT: %0 = "tosa.add"(%arg1, %arg2) : (tensor<1x8x8x3xf32>, tensor<1x8x8x3xf32>) -> tensor<1x8x8x3xf32>
// CHECK-NEXT: %1 = "tosa.add"(%arg0, %0) : (tensor<1x8x8x3xf32>, tensor<1x8x8x3xf32>) -> tensor<1x8x8x3xf32>
// CHECK-NEXT: %2 = "tosa.add"(%arg3, %0) : (tensor<1x8x8x3xf32>, tensor<1x8x8x3xf32>) -> tensor<1x8x8x3xf32>