From 85cfb4c4296e8934aaba01b0cdee377aaab6ee51 Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Wed, 2 Mar 2022 19:18:57 -0800 Subject: [PATCH] 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 --- integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp | 2 +- .../tensorflow/iree_tf_compiler/TFL/test/import/BUILD | 6 ------ .../tensorflow/iree_tf_compiler/TFL/test/import/add.mlir | 4 ++-- .../iree_tf_compiler/TFL/test/import/multi_add.mlir | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp b/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp index ed9a78a0fa5f..1696f3441d5e 100644 --- a/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp +++ b/integrations/tensorflow/iree_tf_compiler/TFL/Passes.cpp @@ -45,7 +45,7 @@ void buildTFLImportPassPipeline(OpPassManager &pm) { //---------------------------------------------------------------------------- pm.addPass(createConvertModuleMetadataPass()); - pm.nest().addPass(createConvertFunctionMetadataPass()); + pm.nest().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 65a378cf1170..e21753b896bd 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 @@ iree_lit_test_suite( 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 2b563a0aa085..c204c6388a51 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 6d8e283779e1..8aa3845574ef 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>