| 295 | namespace { |
| 296 | |
| 297 | StreamId 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 | |
| 320 | TaskType TaskType4OpNode(const OpNode* op_node) { |
| 321 | std::unique_ptr<CompTaskNode> comp_task_node(NewCompTaskNode4OpNode(op_node)); |
no test coverage detected