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

Function DoFuseRecv

tensorflow/core/graph/graph_partition.cc:837–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835}
836
837Status DoFuseRecv(const PartitionOptions& opts, const GraphInfo& g_info,
838 const DupFuseRecvTable& recvs, GraphDef* dst_graph,
839 GlobalDupFuseRecvTable* dup_global_fuse_recv) {
840 std::vector<const std::vector<FuseRecvInfo>* > fuse_recv_infos;
841 std::vector<const Edge*> edges;
842
843 auto it = recvs.begin();
844 while (it != recvs.end()) {
845 const std::vector<FuseRecvInfo>* fuse_recv_info = &(it->second);
846 fuse_recv_infos.push_back(fuse_recv_info);
847 edges.push_back((*fuse_recv_info)[0].edge);
848 ++it;
849 }
850
851 Status status;
852 NodeDef* real_recv = nullptr;
853 std::vector<NodeDef*> filters =
854 AddFuseRecv(opts, g_info, dst_graph, edges, &real_recv, &status);
855 if (!status.ok()) {
856 return status;
857 }
858
859 int i = 0;
860 for (auto fuse_recv_info : fuse_recv_infos) {
861 DupRecvKey key;
862 bool init = true;
863 int slot = 0;
864 auto iter_inner = fuse_recv_info->begin();
865 while(iter_inner != fuse_recv_info->end()) {
866 if (init) {
867 key.src_node_id = iter_inner->edge->src()->id();
868 key.src_output_slot = iter_inner->edge->src_output();
869 key.dst_graph = dst_graph;
870 key.recv_output_on_host = IsDstInputOnHost(iter_inner->edge, g_info);
871 if (iter_inner->edge->IsControlEdge()) {
872 slot = Graph::kControlSlot;
873 } else if (filters[i] == real_recv) {
874 slot = i;
875 }
876
877 init = false;
878 }
879
880 if (slot == Graph::kControlSlot) {
881 AddInput(iter_inner->dst_def, filters[i]->name(), Graph::kControlSlot);
882 } else {
883 SetInput(iter_inner->dst_def, iter_inner->edge->dst_input(),
884 filters[i]->name(), slot);
885 }
886 ++iter_inner;
887 }
888
889 // Record the global recv info
890 FuseRecvInfo global_global_recv_info;
891 global_global_recv_info.recv = filters[i];
892 global_global_recv_info.slot = slot;
893 (*dup_global_fuse_recv)[key] = global_global_recv_info;
894

Callers 1

HandleFuseRecvGroupFunction · 0.85

Calls 14

AddFuseRecvFunction · 0.85
IsDstInputOnHostFunction · 0.85
SetInputFunction · 0.85
AddInputFunction · 0.70
nameMethod · 0.65
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
okMethod · 0.45
idMethod · 0.45
srcMethod · 0.45
src_outputMethod · 0.45

Tested by

no test coverage detected