MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / GetStreamId

Function GetStreamId

oneflow/core/graph/task_graph.cpp:297–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295namespace {
296
297StreamId GetStreamId(const OpNode* op_node, int64_t parallel_id, TaskType task_type) {
298 const ParallelDesc& parallel_desc = op_node->parallel_desc();
299 int64_t machine_id = CHECK_JUST(parallel_desc.MachineId4ParallelId(parallel_id));
300 int64_t dev_phy_id = CHECK_JUST(parallel_desc.DeviceId4ParallelId(parallel_id));
301
302 DeviceId::device_index_t device_index = parallel_desc.device_type() == DeviceType::kCPU
303 ? 0
304 : static_cast<DeviceId::device_index_t>(dev_phy_id);
305 DeviceId device_id{static_cast<DeviceId::rank_t>(machine_id), parallel_desc.device_type(),
306 device_index};
307 StreamId::stream_index_t stream_index = 0;
308 if (op_node->op().op_conf().has_stream_name_hint()) {
309 const std::string& stream_name_hint = op_node->op().op_conf().stream_name_hint();
310 VLOG(3) << "set op: " << op_node->op().op_name() << " to stream: " << stream_name_hint;
311 stream_index = Singleton<TaskStreamIndexManager>::Get()->GetNamedTaskStreamIndex(
312 device_id, stream_name_hint);
313 } else {
314 stream_index =
315 Singleton<TaskStreamIndexManager>::Get()->GetTaskStreamIndex(task_type, device_id);
316 }
317 return StreamId{device_id, stream_index};
318}
319
320TaskType TaskType4OpNode(const OpNode* op_node) {
321 std::unique_ptr<CompTaskNode> comp_task_node(NewCompTaskNode4OpNode(op_node));

Callers 7

PlanToPhysicalGraphFileFunction · 0.85
InitMemoryChainsFunction · 0.85
ToDotFileMethod · 0.85
GetDeviceDescFunction · 0.85
GetDeviceIndexMethod · 0.85
CreateOpNode2TaskIdsMethod · 0.85

Calls 8

GetFunction · 0.85
MachineId4ParallelIdMethod · 0.80
DeviceId4ParallelIdMethod · 0.80
GetTaskStreamIndexMethod · 0.80
parallel_descMethod · 0.45
device_typeMethod · 0.45
opMethod · 0.45

Tested by

no test coverage detected