Print values for parsed MarkForCompilationPassFlags and XlaOpsCommonFlags

While at it change from "typedef struct { ... } X;" to "struct X { ... };".  The
former is a C-ism not necessary in C++.

PiperOrigin-RevId: 221089377
This commit is contained in:
Sanjoy Das 2018-11-12 07:35:16 -08:00 committed by TensorFlower Gardener
parent d8ba8138a2
commit 499b8bd16d
3 changed files with 21 additions and 3 deletions

View File

@ -20,6 +20,7 @@ limitations under the License.
#include "tensorflow/compiler/jit/legacy_flags/mark_for_compilation_pass_flags.h" #include "tensorflow/compiler/jit/legacy_flags/mark_for_compilation_pass_flags.h"
#include "tensorflow/compiler/xla/parse_flags_from_env.h" #include "tensorflow/compiler/xla/parse_flags_from_env.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/types.h" #include "tensorflow/core/platform/types.h"
#include "tensorflow/core/util/command_line_flags.h" #include "tensorflow/core/util/command_line_flags.h"
@ -65,6 +66,17 @@ static void AllocateFlags() {
"enable fusion of element-wise operations only using XLA when " "enable fusion of element-wise operations only using XLA when "
"global_jit_level is ON*.")}); "global_jit_level is ON*.")});
xla::ParseFlagsFromEnv(*flag_list); xla::ParseFlagsFromEnv(*flag_list);
if (VLOG_IS_ON(1)) {
VLOG(1) << "Parsed MarkForCompilationPassFlags:";
VLOG(1) << " tf_xla_auto_jit = " << flags->tf_xla_auto_jit;
VLOG(1) << " tf_xla_min_cluster_size = " << flags->tf_xla_min_cluster_size;
VLOG(1) << " tf_xla_max_cluster_size = " << flags->tf_xla_max_cluster_size;
VLOG(1) << " tf_xla_clustering_debug = " << flags->tf_xla_clustering_debug;
VLOG(1) << " tf_xla_cpu_global_jit = " << flags->tf_xla_cpu_global_jit;
VLOG(1) << " tf_xla_clustering_fuel = " << flags->tf_xla_clustering_fuel;
VLOG(1) << " tf_xla_fusion_only = " << flags->tf_xla_fusion_only;
}
} }
// Append to *append_to flag definitions associated with the XLA bridge's // Append to *append_to flag definitions associated with the XLA bridge's

View File

@ -33,7 +33,7 @@ void AppendMarkForCompilationPassFlags(
// The values of flags associated with the XLA bridge's // The values of flags associated with the XLA bridge's
// mark_for_compilation_pass module. // mark_for_compilation_pass module.
typedef struct { struct MarkForCompilationPassFlags {
int32 tf_xla_auto_jit; // Control compilation of operators into XLA int32 tf_xla_auto_jit; // Control compilation of operators into XLA
// computations on CPU and GPU devices. 0 = use // computations on CPU and GPU devices. 0 = use
// ConfigProto setting; -1 = off; 1 = on for things // ConfigProto setting; -1 = off; 1 = on for things
@ -55,7 +55,7 @@ typedef struct {
// is set to ON* and overrides its behavior. If // is set to ON* and overrides its behavior. If
// true, enable fusion of element-wise operations // true, enable fusion of element-wise operations
// only using XLA. // only using XLA.
} MarkForCompilationPassFlags; };
// Return a pointer to the MarkForCompilationPassFlags struct; // Return a pointer to the MarkForCompilationPassFlags struct;
// repeated calls return the same pointer. // repeated calls return the same pointer.

View File

@ -18,7 +18,7 @@ limitations under the License.
#include "tensorflow/compiler/jit/legacy_flags/xla_ops_common_flags.h" #include "tensorflow/compiler/jit/legacy_flags/xla_ops_common_flags.h"
#include "tensorflow/compiler/xla/parse_flags_from_env.h" #include "tensorflow/compiler/xla/parse_flags_from_env.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/util/command_line_flags.h" #include "tensorflow/core/util/command_line_flags.h"
namespace tensorflow { namespace tensorflow {
@ -36,6 +36,12 @@ void AllocateAndParseFlags() {
&flags->tf_xla_always_defer_compilation, ""), &flags->tf_xla_always_defer_compilation, ""),
}); });
xla::ParseFlagsFromEnv(*flag_list); xla::ParseFlagsFromEnv(*flag_list);
if (VLOG_IS_ON(1)) {
VLOG(1) << "Parsed XlaOpsCommonFlags:";
VLOG(1) << " tf_xla_always_defer_compilation = "
<< flags->tf_xla_always_defer_compilation;
}
} }
const XlaOpsCommonFlags& GetXlaOpsCommonFlags() { const XlaOpsCommonFlags& GetXlaOpsCommonFlags() {