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

Function NeedSameDeviceSendRecv

tensorflow/core/graph/graph_partition.cc:114–133  ·  view source on GitHub ↗

Return true iff we need to add the same device send/recv for 'edge'.

Source from the content-addressed store, hash-verified

112
113// Return true iff we need to add the same device send/recv for 'edge'.
114bool NeedSameDeviceSendRecv(const Edge* edge, const GraphInfo& info) {
115 if (edge->IsControlEdge()) {
116 return false;
117 }
118
119 const Node* src = edge->src();
120 const Node* dst = edge->dst();
121 if (src->assigned_device_name() == dst->assigned_device_name()) {
122 int src_port = edge->src_output();
123 int dst_port = edge->dst_input();
124 if (info.device_types[src->id()] != DEVICE_CPU) {
125 auto src_it = info.output_types.find({src->id(), src_port});
126 DCHECK(src_it != info.output_types.end());
127 auto dst_it = info.input_types.find({dst->id(), dst_port});
128 DCHECK(dst_it != info.input_types.end());
129 return src_it->second != dst_it->second;
130 }
131 }
132 return false;
133}
134
135// Return true iff (dst, dst_input) is specified on host memory.
136bool IsDstInputOnHost(const Edge* edge, const GraphInfo& info) {

Callers 5

AddSendFunction · 0.85
AddRecvFunction · 0.85
AddFuseRecvFunction · 0.85
PartitionFunction · 0.85
PartitionWithTensorFuseFunction · 0.85

Calls 8

IsControlEdgeMethod · 0.45
srcMethod · 0.45
dstMethod · 0.45
src_outputMethod · 0.45
dst_inputMethod · 0.45
idMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected