Home | History | Annotate | Download | only in legacy_flags
      1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 #ifndef TENSORFLOW_COMPILER_JIT_LEGACY_FLAGS_MARK_FOR_COMPILATION_PASS_FLAGS_H_
     17 #define TENSORFLOW_COMPILER_JIT_LEGACY_FLAGS_MARK_FOR_COMPILATION_PASS_FLAGS_H_
     18 
     19 // Legacy flags for the XLA bridge's mark_for_compilation_pass module.
     20 
     21 #include <vector>
     22 
     23 #include "tensorflow/core/platform/types.h"
     24 #include "tensorflow/core/util/command_line_flags.h"
     25 
     26 namespace tensorflow {
     27 namespace legacy_flags {
     28 
     29 // Append to *flag_list flag definitions associated with the XLA bridge's
     30 // mark_for_compilation_pass module.
     31 void AppendMarkForCompilationPassFlags(
     32     std::vector<tensorflow::Flag>* flag_list);
     33 
     34 // The values of flags associated with the XLA bridge's
     35 // mark_for_compilation_pass module.
     36 typedef struct {
     37   int32 tf_xla_auto_jit;  // Control compilation of operators into XLA
     38                           // computations on CPU and GPU devices.  0 = use
     39                           // ConfigProto setting; -1 = off; 1 = on for things
     40                           // very likely to be improved; 2 = on for everything.
     41                           // Experimental.
     42   int32 tf_xla_min_cluster_size;  // Minimum number of operators in an XLA
     43                                   // compilation. Ignored for operators placed
     44                                   // on an XLA device or operators explicitly
     45                                   // marked for compilation.
     46   int32 tf_xla_max_cluster_size;  // Maximum number of operators in an XLA
     47                                   // compilation.
     48   bool tf_xla_clustering_debug;   // Dump graphs during XLA compilation.
     49   bool tf_xla_cpu_global_jit;     // Enables global JIT compilation for CPU
     50                                   // via SessionOptions.
     51 } MarkForCompilationPassFlags;
     52 
     53 // Return a pointer to the MarkForCompilationPassFlags struct;
     54 // repeated calls return the same pointer.
     55 // This should be called only after Flags::Parse() has returned.
     56 MarkForCompilationPassFlags* GetMarkForCompilationPassFlags();
     57 
     58 }  // namespace legacy_flags
     59 }  // namespace tensorflow
     60 
     61 #endif  // TENSORFLOW_COMPILER_JIT_LEGACY_FLAGS_MARK_FOR_COMPILATION_PASS_FLAGS_H_
     62