| 1719 | } |
| 1720 | |
| 1721 | Status MasterSession::StartStep(const BuildGraphOptions& opts, bool is_partial, |
| 1722 | ReffedClientGraph** out_rcg, int64* out_count) { |
| 1723 | const uint64 hash = HashBuildGraphOptions(opts); |
| 1724 | { |
| 1725 | mutex_lock l(mu_); |
| 1726 | // TODO(suharshs): We cache partial run graphs and run graphs separately |
| 1727 | // because there is preprocessing that needs to only be run for partial |
| 1728 | // run calls. |
| 1729 | RCGMap* m = is_partial ? &partial_run_graphs_ : &run_graphs_; |
| 1730 | auto iter = m->find(hash); |
| 1731 | if (iter == m->end()) { |
| 1732 | // We have not seen this subgraph before. Build the subgraph and |
| 1733 | // cache it. |
| 1734 | VLOG(1) << "Unseen hash " << hash << " for " |
| 1735 | << BuildGraphOptionsString(opts) << " is_partial = " << is_partial |
| 1736 | << "\n"; |
| 1737 | std::unique_ptr<ClientGraph> client_graph; |
| 1738 | TF_RETURN_IF_ERROR(execution_state_->BuildGraph(opts, &client_graph)); |
| 1739 | WorkerCacheInterface* worker_cache = get_worker_cache(); |
| 1740 | /*auto entry = new ReffedClientGraph( |
| 1741 | handle_, opts, std::move(client_graph), session_opts_, |
| 1742 | stats_publisher_factory_, is_partial, worker_cache, |
| 1743 | !should_delete_worker_sessions_);*/ |
| 1744 | ReffedClientGraph *entry = nullptr; |
| 1745 | if (env_->run_graph_mode || env_->run_graph_mode_lite) { |
| 1746 | entry = new ReffedClientGraphV2( |
| 1747 | handle_, opts, std::move(client_graph), session_opts_, |
| 1748 | stats_publisher_factory_, execution_state_.get(), is_partial, |
| 1749 | worker_cache, env_, !should_delete_worker_sessions_); |
| 1750 | LOG(INFO) << "Use ReffedClientGraphV2 for partition and run graph."; |
| 1751 | } else { |
| 1752 | entry = new ReffedClientGraph( |
| 1753 | handle_, opts, std::move(client_graph), session_opts_, |
| 1754 | stats_publisher_factory_, execution_state_.get(), is_partial, |
| 1755 | worker_cache, env_, !should_delete_worker_sessions_); |
| 1756 | } |
| 1757 | iter = m->insert({hash, entry}).first; |
| 1758 | VLOG(1) << "Preparing to execute new graph"; |
| 1759 | } |
| 1760 | *out_rcg = iter->second; |
| 1761 | (*out_rcg)->Ref(); |
| 1762 | *out_count = (*out_rcg)->get_and_increment_execution_count(); |
| 1763 | } |
| 1764 | return Status::OK(); |
| 1765 | } |
| 1766 | |
| 1767 | void MasterSession::ClearRunsTable(std::vector<ReffedClientGraph*>* to_unref, |
| 1768 | RCGMap* rcg_map) { |
nothing calls this directly
no test coverage detected