| 324 | } |
| 325 | |
| 326 | void DumpExecutionOptions(const ExecutionOptions& execution_options, |
| 327 | const DebugOptions& debug_options) { |
| 328 | CanonicalDebugOptions opts(debug_options); |
| 329 | tensorflow::Env* env = tensorflow::Env::Default(); |
| 330 | const string& dir = opts.dump_to; |
| 331 | if (env->IsDirectory(dir).ok()) { |
| 332 | string filename = tensorflow::io::JoinPath(dir, "execution_options"); |
| 333 | Status status; |
| 334 | if (opts.dump_as_text) { |
| 335 | status = tensorflow::WriteTextProto(env, absl::StrCat(filename, ".txt"), |
| 336 | execution_options); |
| 337 | } else { |
| 338 | status = tensorflow::WriteBinaryProto(env, absl::StrCat(filename, ".pb"), |
| 339 | execution_options); |
| 340 | } |
| 341 | if (!status.ok()) { |
| 342 | LOG(ERROR) << "Could not write XLA debug data to " << filename << ": " |
| 343 | << status; |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | void DumpHloModuleIfEnabled(const HloModule& module, string_view name) { |
| 349 | CanonicalDebugOptions opts(module.config().debug_options()); |
no test coverage detected