message: [XLA] Make --xla_dump_executions_to actually dump the HloSnapshot.
diff: @@ -348,8 +348,8 @@ StatusOr<std::vector<std::unique_ptr<Executable>>> Service::BuildExecutables(
  module_protos[i]->entry_computation_name().c_str());
  TF_RETURN_IF_ERROR(
  Executable::DumpToDirectory(directory_path, filename, *hlo_snapshot));
  - hlo_snapshots.push_back(std::move(hlo_snapshot));
  }
  + hlo_snapshots.push_back(std::move(hlo_snapshot));
  }
  VLOG(1) << "Computations:";
  @@ -721,6 +721,15 @@ Status Service::ExecuteGraphParallel(const ExecuteGraphParallelRequest* arg,
  executable_ptrs.push_back(executable.get());
  }
  + for (int i = 0; i < executable_ptrs.size(); i++) {
  + if (executable_ptrs[i]->dumping_snapshot()) {
  + TF_RETURN_IF_ERROR(RecordArguments(all_arguments[i].front(),
  + all_executors[i][0],
  + execute_backend_->transfer_manager(),
  + executable_ptrs[i]->hlo_snapshot()));
  + }
  + }
  +
  // Execute the generated executables in parallel and return the device
  // handles for each computation's output.
  ExecutionProfile profile;
  @@ -736,6 +745,18 @@ Status Service::ExecuteGraphParallel(const ExecuteGraphParallelRequest* arg,
  *result->add_responses() = response;
  }
  + for (int i = 0; i < executable_ptrs.size(); i++) {
  + if (executable_ptrs[i]->dumping_snapshot()) {
  + TF_ASSIGN_OR_RETURN(const ShapedBuffer* result_buffer,
  + allocation_tracker_.ResolveForReplica(outputs[i], 0));
  + TF_RETURN_IF_ERROR(RecordResult(*result_buffer, all_executors[i][0],
  + execute_backend_->transfer_manager(),
  + executable_ptrs[i]->hlo_snapshot()));
  + // Dump out the ith snapshot.
  + TF_RETURN_IF_ERROR(executable_ptrs[i]->DumpHloSnapshot());
  + }
  + }
  +
  VLOG(1) << "successfully completed 'execute-graph-parallel' request";
  return Status::OK();
  }
  @@ -835,6 +856,10 @@ StatusOr<std::unique_ptr<Executable>> Service::BuildExecutable(
  backend->compiler()->RunBackend(
  std::move(module), executor, device_allocator));
  + if (!execution_directory_path.empty()) {
  + executable->set_hlo_snapshot(std::move(hlo_snapshot));
  + }
  +
  return std::move(executable);
  }
  