From ebdfab6ed7166b486ef273362e1470ff9733f217 Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Tue, 31 Oct 2023 01:45:25 -0700 Subject: [PATCH] Do not use deprecated usePropertiesAsAttributes=0 for tf_saved_model ops. PiperOrigin-RevId: 578099160 --- .../lite/tests/legalize-tf-variables.mlir | 2 +- .../tests/insert_main_function.mlir | 4 +-- ...erge_initializer_function_ops_to_main.mlir | 4 +-- .../mlir/tensorflow/ir/tf_saved_model_ops.td | 1 - .../tensorflow/tests/tf_saved_model/basic.py | 4 +-- .../tests/tf_saved_model/basic_v1.py | 2 +- .../tf_saved_model/hash_table_asset_v1.py | 6 ++-- .../tests/tf_saved_model/hash_table_v1.py | 2 +- .../tests/tf_saved_model/import_restore_v1.py | 2 +- .../include_variables_in_init_v1.py | 2 +- .../tf_saved_model/multi_variables_v1.py | 4 +-- .../partially_shaped_variables.py | 4 +-- .../tf_saved_model/remove_init_variable_v1.py | 2 +- .../tf_saved_model/shared_variable_v1.py | 2 +- ...f_saved_model_optimize_global_tensors.mlir | 36 +++++++++---------- ...timize_global_tensors_interprocedural.mlir | 28 +++++++-------- 16 files changed, 52 insertions(+), 53 deletions(-) diff --git a/tensorflow/compiler/mlir/lite/tests/legalize-tf-variables.mlir b/tensorflow/compiler/mlir/lite/tests/legalize-tf-variables.mlir index 39d0aa8af794c5..54a10bf0dad5bc 100644 --- a/tensorflow/compiler/mlir/lite/tests/legalize-tf-variables.mlir +++ b/tensorflow/compiler/mlir/lite/tests/legalize-tf-variables.mlir @@ -46,7 +46,7 @@ module attributes {tf_saved_model.semantics} { } "tf_saved_model.session_initializer"() {initializers = [@init_all_tables]} : () -> () - // CHECK: "tf_saved_model.session_initializer"() {initializers = [@init_all_tables]} : () -> () + // CHECK: "tf_saved_model.session_initializer"() <{initializers = [@init_all_tables]}> : () -> () // CHECK-LABEL: serving_default func.func @serving_default(%arg0: tensor<1x10xf32> {tf_saved_model.index_path = ["x"]}) -> diff --git a/tensorflow/compiler/mlir/quantization/tensorflow/tests/insert_main_function.mlir b/tensorflow/compiler/mlir/quantization/tensorflow/tests/insert_main_function.mlir index be98dd179bae11..cbd7224397d4e9 100644 --- a/tensorflow/compiler/mlir/quantization/tensorflow/tests/insert_main_function.mlir +++ b/tensorflow/compiler/mlir/quantization/tensorflow/tests/insert_main_function.mlir @@ -49,8 +49,8 @@ module attributes {tf.versions = {producer = 1132 : i32}, tf_saved_model.semanti "tf_saved_model.session_initializer"() {initializers = [@NoOp]} : () -> () "tf_saved_model.asset"() {filename = "assets/mydata.txt", sym_name = "__tf_saved_model_asset0_mydata.txt"} : () -> () // Session initializer ops and asset ops untouched. -// CHECK: "tf_saved_model.session_initializer"() {initializers = [@NoOp]} : () -> () -// CHECK: "tf_saved_model.asset"() {filename = "assets/mydata.txt", sym_name = "__tf_saved_model_asset0_mydata.txt"} : () -> () +// CHECK: "tf_saved_model.session_initializer"() <{initializers = [@NoOp]}> : () -> () +// CHECK: "tf_saved_model.asset"() <{filename = "assets/mydata.txt", sym_name = "__tf_saved_model_asset0_mydata.txt"}> : () -> () func.func @NoOp(%arg0: tensor {tf_saved_model.bound_input = @__tf_saved_model_asset0_mydata.txt}) attributes {tf_saved_model.exported_names = ["__tf_saved_model_session_initializer_NoOp"]} { %0 = "tf.HashTableV2"() {container = "", device = "", key_dtype = !tf_type.string, shared_name = "", use_node_name_sharing = false, value_dtype = i64} : () -> tensor diff --git a/tensorflow/compiler/mlir/quantization/tensorflow/tests/merge_initializer_function_ops_to_main.mlir b/tensorflow/compiler/mlir/quantization/tensorflow/tests/merge_initializer_function_ops_to_main.mlir index 1b0e3e286f1f8d..9dde4fe9445796 100644 --- a/tensorflow/compiler/mlir/quantization/tensorflow/tests/merge_initializer_function_ops_to_main.mlir +++ b/tensorflow/compiler/mlir/quantization/tensorflow/tests/merge_initializer_function_ops_to_main.mlir @@ -303,7 +303,7 @@ func.func @NoOp_0(%arg0: tensor {tf_saved_model.bound_input = @ // CHECK-LABEL: module module attributes {tf_saved_model.semantics} { "tf_saved_model.session_initializer"() {initializers = [@init_func_restore_op]} : () -> () -// CHECK: "tf_saved_model.session_initializer"() {initializers = []} +// CHECK: "tf_saved_model.session_initializer"() <{initializers = []}> func.func @init_func_restore_op(%arg: tensor {tf_saved_model.index_path = ["__tf_file_prefix"]}) attributes {tf_saved_model.exported_names = ["__tf_saved_model_session_initializer_NoOp"], tf_saved_model.initializer_type = "restore_op"} { @@ -383,7 +383,7 @@ module attributes {tf.versions = {bad_consumers = [], min_consumer = 12 : i32, p // CHECK-LABEL: module module attributes {tf_saved_model.semantics} { "tf_saved_model.session_initializer"() {initializers = [@init_func_restore_op]} : () -> () -// CHECK: "tf_saved_model.session_initializer"() {initializers = []} +// CHECK: "tf_saved_model.session_initializer"() <{initializers = []}> func.func @init_func_restore_op(%arg: tensor {tf_saved_model.index_path = ["file_prefix"]}) attributes {tf_saved_model.exported_names = ["__tf_saved_model_session_initializer_NoOp"], tf_saved_model.initializer_type = "restore_op"} { diff --git a/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model_ops.td b/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model_ops.td index 39748a6940452d..726b82969b5e9d 100644 --- a/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model_ops.td +++ b/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model_ops.td @@ -83,7 +83,6 @@ def TfSavedModel_Dialect : Dialect { }]; let cppNamespace = "::mlir::tf_saved_model"; - let usePropertiesForAttributes = 0; } diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic.py index 130348080482e1..118d7f38ebf959 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic.py @@ -39,9 +39,9 @@ def __init__(self): self.c43 = tf.constant(43.0) # During serialization, the constants are given internal (non-user-accessible, non-semantically-load-bearing) exported names. - # CHECK: "tf_saved_model.global_tensor"() {sym_name = "[[CONST:[a-zA-Z_0-9.]+]]", tf_saved_model.exported_names = [{{.*}}], type = tensor, value = dense<4.300000e+01> : tensor} : () -> () + # CHECK: "tf_saved_model.global_tensor"() <{sym_name = "[[CONST:[a-zA-Z_0-9.]+]]", type = tensor, value = dense<4.300000e+01> : tensor}> {tf_saved_model.exported_names = [{{.*}}]} : () -> () - # CHECK: "tf_saved_model.global_tensor"() {is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", tf_saved_model.exported_names = ["v42"], type = tensor, value = dense<4.200000e+01> : tensor} : () -> () + # CHECK: "tf_saved_model.global_tensor"() <{is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor, value = dense<4.200000e+01> : tensor}> {tf_saved_model.exported_names = ["v42"]} : () -> () # CHECK: func {{@[a-zA-Z_0-9]+}}( # CHECK-SAME: %arg0: tensor {tf._user_specified_name = "x", tf_saved_model.index_path = [0]}, # CHECK-SAME: %arg1: tensor>> diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic_v1.py index 2d620c8df759ce..2fc0670538c1c9 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic_v1.py @@ -29,7 +29,7 @@ # CHECK-SAME: min_consumer # CHECK-SAME: producer -# CHECK: "tf_saved_model.global_tensor"() {is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor<1x3xf32>, value = {{.*}} : tensor<1x3xf32>} : () -> () +# CHECK: "tf_saved_model.global_tensor"() <{is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor<1x3xf32>, value = {{.*}} : tensor<1x3xf32>}> : () -> () # CHECK: func {{@[a-zA-Z_0-9]+}}( # CHECK-SAME: [[ARG0:%.*]]: tensor<3x1xf32> {tf_saved_model.index_path = ["x"]}, diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_asset_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_asset_v1.py index bd48dfd220144a..1f533ecdfb10db 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_asset_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_asset_v1.py @@ -22,9 +22,9 @@ import tensorflow.compat.v1 as tf from tensorflow.compiler.mlir.tensorflow.tests.tf_saved_model import common_v1 -# CHECK: "tf_saved_model.session_initializer"() {initializers = [@[[init:.*]]]} : () -> () -# CHECK: "tf_saved_model.asset"() {filename = {{.*}}, sym_name = "[[asset1:__tf_saved_model_asset1_.*]]"} -# CHECK: "tf_saved_model.asset"() {filename = {{.*}}, sym_name = "[[asset0:__tf_saved_model_asset0_.*]]"} +# CHECK: "tf_saved_model.session_initializer"() <{initializers = [@[[init:.*]]]}> : () -> () +# CHECK: "tf_saved_model.asset"() <{filename = {{.*}}, sym_name = "[[asset1:__tf_saved_model_asset1_.*]]"}> +# CHECK: "tf_saved_model.asset"() <{filename = {{.*}}, sym_name = "[[asset0:__tf_saved_model_asset0_.*]]"}> # CHECK: func @[[init]] # CHECK-SAME: [[ARG0:%.*]]: tensor {tf_saved_model.bound_input = @[[asset0]]} diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_v1.py index 744f302dac610b..4383b1befbb3e5 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/hash_table_v1.py @@ -30,7 +30,7 @@ # CHECK-SAME: producer # CHECK: "tf_saved_model.global_tensor"() -# CHECK: "tf_saved_model.session_initializer"() {initializers = [@[[init:.*]]]} : () -> () +# CHECK: "tf_saved_model.session_initializer"() <{initializers = [@[[init:.*]]]}> : () -> () # CHECK: func @[[init]] # CHECK-SAME: tf_saved_model.initializer_type = "init_op" diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/import_restore_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/import_restore_v1.py index cc8b5adf7ca6c4..fe2c6925a6fa0a 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/import_restore_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/import_restore_v1.py @@ -33,7 +33,7 @@ # CHECK-SAME: initializers = [@[[restore:.*]]] # CHECK: "tf_saved_model.asset"() -# CHECK-SAME: {filename = [[filename:.*]], sym_name = "[[sym_name:.*]]"} : () -> () +# CHECK-SAME: <{filename = [[filename:.*]], sym_name = "[[sym_name:.*]]"}> : () -> () # CHECK: func @[[restore]]( # CHECK-SAME: [[variable_path:%.*]]: tensor {tf_saved_model.bound_input = @[[sym_name]]} diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/include_variables_in_init_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/include_variables_in_init_v1.py index bc8457aab0f63c..c7957a68b13967 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/include_variables_in_init_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/include_variables_in_init_v1.py @@ -30,7 +30,7 @@ # CHECK-SAME: producer # CHECK: "tf_saved_model.global_tensor"() -# CHECK: "tf_saved_model.session_initializer"() {initializers = [@[[INIT_FUNC:[a-zA-Z_0-9]+]]]} : () -> () +# CHECK: "tf_saved_model.session_initializer"() <{initializers = [@[[INIT_FUNC:[a-zA-Z_0-9]+]]]}> : () -> () # Initializer function. This should contain the initialization sequence for the # variable. diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/multi_variables_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/multi_variables_v1.py index 6eb8cbe20b0fbf..b3c3a2028651f6 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/multi_variables_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/multi_variables_v1.py @@ -19,8 +19,8 @@ import tensorflow.compat.v1 as tf from tensorflow.compiler.mlir.tensorflow.tests.tf_saved_model import common_v1 -# CHECK: "tf_saved_model.global_tensor"() {is_mutable, sym_name = "[[VAR0:[a-zA-Z_0-9]+]]", type = tensor<5x3xf32>, value = {{.*}} : tensor<5x3xf32>} : () -> () -# CHECK: "tf_saved_model.global_tensor"() {is_mutable, sym_name = "[[VAR1:[a-zA-Z_0-9]+]]", type = tensor<3x5xf32>, value = {{.*}} : tensor<3x5xf32>} : () -> () +# CHECK: "tf_saved_model.global_tensor"() <{is_mutable, sym_name = "[[VAR0:[a-zA-Z_0-9]+]]", type = tensor<5x3xf32>, value = {{.*}} : tensor<5x3xf32>}> : () -> () +# CHECK: "tf_saved_model.global_tensor"() <{is_mutable, sym_name = "[[VAR1:[a-zA-Z_0-9]+]]", type = tensor<3x5xf32>, value = {{.*}} : tensor<3x5xf32>}> : () -> () # CHECK: func {{@[a-zA-Z_0-9]+}}( # CHECK-SAME: [[ARG0:%.*]]: tensor>> {tf_saved_model.bound_input = @[[VAR0]]}, # CHECK-SAME: [[ARG1:%.*]]: tensor>> {tf_saved_model.bound_input = @[[VAR1]]}) diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/partially_shaped_variables.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/partially_shaped_variables.py index 8b0137271ed492..a4238d56839355 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/partially_shaped_variables.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/partially_shaped_variables.py @@ -24,8 +24,8 @@ class TestModule(tf.Module): def __init__(self): super(TestModule, self).__init__() - # CHECK: "tf_saved_model.global_tensor"() {is_mutable, {{.*}} tf_saved_model.exported_names = ["v0"], type = tensor<*xf32>, value = dense<0.000000e+00> : tensor<1xf32>} : () -> () - # CHECK: "tf_saved_model.global_tensor"() {is_mutable, {{.*}} tf_saved_model.exported_names = ["v1"], type = tensor, value = dense<[0.000000e+00, 1.000000e+00]> : tensor<2xf32>} : () -> () + # CHECK: "tf_saved_model.global_tensor"() <{is_mutable, {{.*}} type = tensor<*xf32>, value = dense<0.000000e+00> : tensor<1xf32>}> {tf_saved_model.exported_names = ["v0"]} : () -> () + # CHECK: "tf_saved_model.global_tensor"() <{is_mutable, {{.*}} type = tensor, value = dense<[0.000000e+00, 1.000000e+00]> : tensor<2xf32>}> {tf_saved_model.exported_names = ["v1"]} : () -> () self.v0 = tf.Variable([0.], shape=tf.TensorShape(None)) self.v1 = tf.Variable([0., 1.], shape=[None]) diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/remove_init_variable_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/remove_init_variable_v1.py index 261ff5577eb209..b2be608f8c25c9 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/remove_init_variable_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/remove_init_variable_v1.py @@ -29,7 +29,7 @@ # CHECK-SAME: min_consumer # CHECK-SAME: producer -# CHECK: "tf_saved_model.global_tensor"() {is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor<1x3xf32>, value = {{.*}} : tensor<1x3xf32>} : () -> () +# CHECK: "tf_saved_model.global_tensor"() <{is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor<1x3xf32>, value = {{.*}} : tensor<1x3xf32>}> : () -> () # CHECK-NOT: session_initializer # CHECK: func {{@[a-zA-Z_0-9]+}}( diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/shared_variable_v1.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/shared_variable_v1.py index 6c47dd5b590069..2382a37f971a22 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/shared_variable_v1.py +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/shared_variable_v1.py @@ -19,7 +19,7 @@ import tensorflow.compat.v1 as tf from tensorflow.compiler.mlir.tensorflow.tests.tf_saved_model import common_v1 -# CHECK: "tf_saved_model.global_tensor"() {is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor<1x3xf32>, value = {{.*}} : tensor<1x3xf32>} : () -> () +# CHECK: "tf_saved_model.global_tensor"() <{is_mutable, sym_name = "[[VAR:[a-zA-Z_0-9]+]]", type = tensor<1x3xf32>, value = {{.*}} : tensor<1x3xf32>}> : () -> () # CHECK: func {{@[a-zA-Z_0-9]+}}( # CHECK-SAME: [[ARG0:%.*]]: tensor<3x1xf32> {tf_saved_model.index_path = ["x"]}, diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors.mlir b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors.mlir index ae61fc94c56f97..ea26be8dc444cd 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors.mlir +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors.mlir @@ -8,9 +8,9 @@ module attributes {tf_saved_model.semantics} { // Test case: Basic test of marking immutable. - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-NOT: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) -> (tensor {tf_saved_model.index_path = []}) @@ -27,9 +27,9 @@ module attributes {tf_saved_model.semantics} { // Test case: Don't mark immutable if the variable is mutated. - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) @@ -47,9 +47,9 @@ module attributes {tf_saved_model.semantics} { // Test case: Don't mark immutable if the variable is exported. - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> {{{.*}}} : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", tf_saved_model.exported_names = ["v"], type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) -> (tensor {tf_saved_model.index_path = []}) @@ -148,9 +148,9 @@ module {} // Test use as an input in unhandled op module attributes {tf_saved_model.semantics} { - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) @@ -166,9 +166,9 @@ module attributes {tf_saved_model.semantics} { // Test use as a region capture in an unhandled op module attributes {tf_saved_model.semantics} { - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) @@ -187,14 +187,14 @@ module attributes {tf_saved_model.semantics} { // to the unhandled op. module attributes {tf_saved_model.semantics} { - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "u", type = tensor, value = dense<22.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}, %arg1: tensor>> {tf_saved_model.bound_input = @u}) @@ -212,14 +212,14 @@ module attributes {tf_saved_model.semantics} { // Test multiple global tensors uses as operands for an unhandled op. module attributes {tf_saved_model.semantics} { - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "u", type = tensor, value = dense<22.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}, %arg1: tensor>> {tf_saved_model.bound_input = @u}) diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors_interprocedural.mlir b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors_interprocedural.mlir index c05698c0d34469..d773e38f8362fe 100644 --- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors_interprocedural.mlir +++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model_optimize_global_tensors_interprocedural.mlir @@ -9,9 +9,9 @@ module attributes {tf_saved_model.semantics} { // Test case: This test exercises marking a global tensor as immutable after it propagates // via set of chained calls -> f -> f_callee -> f_callee_callee - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-NOT: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) -> (tensor {tf_saved_model.index_path = []}) @@ -39,11 +39,11 @@ module attributes {tf_saved_model.semantics} { // Test case: // This test exercises trying to mark immutable when same func is called by multiple callers // with different global tensors. - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-NOT: is_mutable "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-NOT: is_mutable "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v2", type = tensor, value = dense<42.> : tensor } : () -> () @@ -73,9 +73,9 @@ module attributes {tf_saved_model.semantics} { // Test case: This test exercises immutability without explicit use // via ReadVariableOp - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-NOT: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) -> (tensor {tf_saved_model.index_path = []}) @@ -99,9 +99,9 @@ module attributes {tf_saved_model.semantics} { // CHECK-LABEL: module attributes {tf_saved_model.semantics} module attributes {tf_saved_model.semantics} { - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () // CHECK: func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) @@ -133,9 +133,9 @@ module attributes {tf_saved_model.semantics} { // Test case: The inter-procedural analysis with different types of // TF call ops - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () // CHECK: func @f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) @@ -166,9 +166,9 @@ module attributes {tf_saved_model.semantics} { // Test case: The inter-procedural analysis does not recurse infinitely - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-NOT: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @exported_f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) -> (tensor {tf_saved_model.index_path = []}) @@ -199,9 +199,9 @@ module attributes {tf_saved_model.semantics} { // Test case: Inter-procedural analysis with resource usage in an // unknown op, we assume mutating behavior and propagate that. - // CHECK: "tf_saved_model.global_tensor"() { + // CHECK: "tf_saved_model.global_tensor"() <{ // CHECK-SAME: is_mutable - // CHECK-SAME: } : () -> () + // CHECK-SAME: }> : () -> () "tf_saved_model.global_tensor"() { is_mutable, sym_name = "v", type = tensor, value = dense<42.> : tensor } : () -> () func.func @exported_f(%arg0: tensor>> {tf_saved_model.bound_input = @v}) -> (tensor {tf_saved_model.index_path = []})