| 37 | std::once_flag flags_init; |
| 38 | |
| 39 | bool SetterForXlaAutoJitFlag(const string& value) { |
| 40 | int32 opt_level; |
| 41 | // We need to use the mark_for_compilation_flags directly here instead of |
| 42 | // going via GetMarkForCompilationPassFlags() to avoid infinite recursion. The |
| 43 | // latter will try to setup and parse flags, which would bring us back to this |
| 44 | // setter. |
| 45 | if (absl::SimpleAtoi(value, &opt_level)) { |
| 46 | mark_for_compilation_flags->xla_auto_jit_flag |
| 47 | .optimization_level_single_gpu = opt_level; |
| 48 | mark_for_compilation_flags->xla_auto_jit_flag.optimization_level_general = |
| 49 | opt_level; |
| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | if (value == "fusible") { |
| 54 | mark_for_compilation_flags->xla_auto_jit_flag |
| 55 | .optimization_level_single_gpu = 1; |
| 56 | mark_for_compilation_flags->xla_auto_jit_flag.optimization_level_general = |
| 57 | 1; |
| 58 | mark_for_compilation_flags->tf_xla_ops_to_cluster = "FUSIBLE"; |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | absl::string_view value_sv(value); |
| 63 | if (!absl::ConsumePrefix(&value_sv, "single-gpu(") || |
| 64 | !absl::ConsumeSuffix(&value_sv, ")") || |
| 65 | !absl::SimpleAtoi(value_sv, &opt_level)) { |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | mark_for_compilation_flags->xla_auto_jit_flag.optimization_level_single_gpu = |
| 70 | opt_level; |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | void AppendMarkForCompilationPassFlagsInternal(std::vector<Flag>* flag_list) { |
| 75 | std::vector<Flag> new_flags = { |
no test coverage detected