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

Function EncodeTaskIdToInt64

oneflow/core/graph/task_id.cpp:52–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50} // namespace
51
52int64_t EncodeTaskIdToInt64(const TaskId& task_id) {
53 int64_t id = static_cast<int64_t>(task_id.task_index());
54 id |= static_cast<int64_t>(task_id.stream_id().stream_index()) << kStreamIndexShift;
55 id |= static_cast<int64_t>(task_id.stream_id().device_index()) << kDeviceIndexShift;
56 id |= static_cast<int64_t>(task_id.stream_id().device_type()) << kDeviceTypeShift;
57 id |= static_cast<int64_t>(task_id.stream_id().rank()) << kRankShift;
58 return id;
59}
60
61TaskId DecodeTaskIdFromInt64(int64_t task_id_val) {
62 int64_t rank = (task_id_val & kRankInt64Mask) >> kRankShift;

Callers 3

UpdateTaskIdMethod · 0.85
update_new_task_idMethod · 0.85
ToProtoMethod · 0.85

Calls 5

task_indexMethod · 0.80
stream_indexMethod · 0.80
device_indexMethod · 0.45
device_typeMethod · 0.45
rankMethod · 0.45

Tested by

no test coverage detected