MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Run

Method Run

tensorflow/compiler/jit/async_io_conversion_pass.cc:373–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373Status AsyncIoConversionPassImpl::Run() {
374 if (VLOG_IS_ON(1)) {
375 DumpGraphToFile("before_async_io_conversion_pass", *graph_, flib_def_);
376 }
377
378 // Collect output edges into `cluster_out_edges_`.
379 CollectOutputEdgesForClusters();
380
381 // For each cluster, insert AsyncOut operations.
382 for (auto& p : cluster_out_edges_) {
383 const string& cluster_name = p.first;
384 const std::vector<const Edge*>& cluster_outputs = p.second;
385
386 absl::flat_hash_set<OutputTensor, OutputTensor::Hash>
387 cluster_outputs_to_convert;
388 for (const Edge* e : cluster_outputs) {
389 if (e->IsControlEdge()) {
390 // Do not support control edges now.
391 continue;
392 }
393
394 if (IsConvertibleAndProfitable(*e, enable_full_async_io_)) {
395 cluster_outputs_to_convert.insert({e->src(), e->src_output()});
396 }
397 }
398
399 if (cluster_outputs_to_convert.empty()) {
400 // No output edges to be converted for the current cluster.
401 continue;
402 }
403
404 std::vector<string> async_out_tensor_names;
405 std::vector<Node*> async_out_sends;
406 std::vector<Node*> async_out_recvs;
407 for (const OutputTensor& o : cluster_outputs_to_convert) {
408 // Remove unnecessary input control edges to users of `n:oidx`.
409 //
410 // TODO: generalize it by replacing the control edge also with
411 // AsyncOutSend and AsyncOutRecv.
412 RemoveUnnecessaryControlEdgesToUsersOf(o);
413
414 // n:oidx -> AsyncOutSend
415 // AsyncOutRecv -> uses of `n:oidx`
416 InsertAsyncOutSendAndRecv(o, &async_out_tensor_names, &async_out_sends,
417 &async_out_recvs);
418 }
419
420 // Insert AsyncOutInit and AsyncOutDone.
421 InsertAsyncOutInitAndDone(cluster_name, async_out_tensor_names,
422 async_out_sends, async_out_recvs);
423 }
424
425 if (VLOG_IS_ON(1)) {
426 DumpGraphToFile("async_io_conversion_pass", *graph_, flib_def_);
427 }
428
429 return Status::OK();
430}

Callers

nothing calls this directly

Calls 11

DumpGraphToFileFunction · 0.85
GetBuildXlaOpsPassFlagsFunction · 0.85
StrCatFunction · 0.50
IsControlEdgeMethod · 0.45
insertMethod · 0.45
srcMethod · 0.45
src_outputMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected