From db14325178ef9aebcb5632b0f9ba1d860ccd7a5f Mon Sep 17 00:00:00 2001 From: Lucy Fox Date: Tue, 20 Oct 2020 15:38:29 -0700 Subject: [PATCH] Update naming of MLIR bridge flag and add some documentation. PiperOrigin-RevId: 338152017 Change-Id: Ib0573db86327077245d60c7eb57d8e10ec051b6e --- tensorflow/compiler/jit/flags.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tensorflow/compiler/jit/flags.cc b/tensorflow/compiler/jit/flags.cc index 683acd0bae9..52d8fb94ff6 100644 --- a/tensorflow/compiler/jit/flags.cc +++ b/tensorflow/compiler/jit/flags.cc @@ -167,8 +167,16 @@ void AllocateAndParseFlags() { jitter_flags = new IntroduceFloatingPointJitterPassFlags; jitter_flags->jitter_amount = 1e-5; + // The `enable_mlir_bridge` flag allows the user to explicitly request that + // their program is (or isn't) compiled using the MLIR-based TF-to-XLA bridge. + // + // The `enable_mlir_bridge_is_explicit` variable tracks whether or not the + // user has made an explicit request. That is, if this variable is set to + // true, the program honors the user's request as per `enable_mlir_bridge`; if + // it's set to false, the default behavior is used (which may run either + // bridge, on a per-graph basis). bool enable_mlir_bridge = false; - bool enable_mlir_bridge_flag_updated = false; + bool enable_mlir_bridge_is_explicit = false; auto setter_for_jitter_tensor_names = [](string sequence) { jitter_flags->tensor_names = absl::StrSplit(sequence, ','); @@ -219,13 +227,13 @@ void AllocateAndParseFlags() { Flag("tf_mlir_enable_mlir_bridge", &enable_mlir_bridge, "Enables experimental MLIR-Based TensorFlow Compiler Bridge.", - &enable_mlir_bridge_flag_updated)}); + &enable_mlir_bridge_is_explicit)}); AppendMarkForCompilationPassFlagsInternal(flag_list); xla::ParseFlagsFromEnvAndDieIfUnknown("TF_XLA_FLAGS", *flag_list); mlir_flags = new MlirCommonFlags; - if (!enable_mlir_bridge_flag_updated) { + if (!enable_mlir_bridge_is_explicit) { mlir_flags->tf_mlir_enable_mlir_bridge = ConfigProto::Experimental::MLIR_BRIDGE_ROLLOUT_UNSPECIFIED; } else if (enable_mlir_bridge) {