Allow TPU's special FP debug flags to be passed via DebugOptions,

PiperOrigin-RevId: 304934290
Change-Id: I628236b106a33f651c2ba7b2b8a1f93432291cc0
This commit is contained in:
Davide Libenzi 2020-04-05 17:38:12 -07:00 committed by TensorFlower Gardener
parent 016d16c741
commit a930563d96
2 changed files with 15 additions and 1 deletions

View File

@ -535,6 +535,16 @@ static void AllocateFlags() {
bool_setter_for(&DebugOptions::set_xla_gpu_deterministic_reductions),
flag_values->xla_gpu_deterministic_reductions(),
"Always run deterministic reductions on GPU"),
tensorflow::Flag(
"xla_tpu_detect_nan",
bool_setter_for(&DebugOptions::set_xla_tpu_detect_nan),
flag_values->xla_tpu_detect_nan(),
"Trigger error on execution on TPU if a NAN value is detected"),
tensorflow::Flag(
"xla_tpu_detect_inf",
bool_setter_for(&DebugOptions::set_xla_tpu_detect_inf),
flag_values->xla_tpu_detect_inf(),
"Trigger error on execution on TPU if a INF value is detected"),
});
ParseFlagsFromEnvAndDieIfUnknown("XLA_FLAGS", *flag_objects);
}

View File

@ -265,7 +265,11 @@ message DebugOptions {
// Guarantee run-to-run determinism from reductions on XLA:GPU.
bool xla_gpu_deterministic_reductions = 130;
// Next id: 135
// Debug options that trigger execution errors when NaN or Inf are detected.
bool xla_tpu_detect_nan = 135;
bool xla_tpu_detect_inf = 136;
// Next id: 137
// Extra options to pass to the compilation backend (e.g. LLVM); specific
// interpretation of these values is left to the backend.