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

Function DecodeTaskIdFromInt64

oneflow/core/graph/task_id.cpp:61–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61TaskId DecodeTaskIdFromInt64(int64_t task_id_val) {
62 int64_t rank = (task_id_val & kRankInt64Mask) >> kRankShift;
63 int64_t device_type = (task_id_val & kDeviceTypeInt64Mask) >> kDeviceTypeShift;
64 int64_t device_index = (task_id_val & kDeviceIndexInt64Mask) >> kDeviceIndexShift;
65 int64_t stream_index = (task_id_val & kStreamIndexInt64Mask) >> kStreamIndexShift;
66 int64_t task_index = task_id_val & kTaskIndexInt64Mask;
67 StreamId stream_id{static_cast<DeviceId::rank_t>(rank), static_cast<DeviceType>(device_type),
68 static_cast<DeviceId::device_index_t>(device_index),
69 static_cast<StreamId::stream_index_t>(stream_index)};
70 return TaskId{stream_id, static_cast<TaskId::task_index_t>(task_index)};
71}
72
73int64_t MachineId4ActorId(int64_t actor_id) {
74 return DecodeTaskIdFromInt64(actor_id).stream_id().rank();

Calls

no outgoing calls

Tested by

no test coverage detected