-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TaskNode::order_in_chain #10102
Merged
Merged
TaskNode::order_in_chain #10102
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f1c2078
remove mem_chain merge
chengtbf 9f6d21e
TaskNode::order_in_chain
chengtbf 51efb80
Merge branch 'master' into dev_cc_order_in_chain
chengtbf 2c73e74
Update oneflow/core/graph/task_graph.cpp
chengtbf e4d30df
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
chengtbf 677ece4
refine task proto id
chengtbf ec7d071
Merge branch 'master' into dev_cc_order_in_chain
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,8 +248,8 @@ void PlanUtil::MergeMemBlockIdByLogicalChainId(Plan* plan, const Job& job) { | |
DeviceType device_type = stream_id.device_id().device_type(); | ||
// TODO(zwx): eliminate this special 'is cpu' determine | ||
if (device_type == DeviceType::kCPU) { continue; } | ||
if (!IsValidChainId(task->task_set_info().chain_id())) { continue; } | ||
int64_t logical_chain_id = task->task_set_info().chain_id(); | ||
if (!IsValidChainId(task->chain_id())) { continue; } | ||
int64_t logical_chain_id = task->chain_id(); | ||
|
||
for (auto& pair : *(task->mutable_produced_regst_desc())) { | ||
RegstDescProto* regst_desc = &pair.second; | ||
|
@@ -300,7 +300,7 @@ void PlanUtil::MergeMemBlockIdByLogicalChainId(Plan* plan, const Job& job) { | |
DeviceType device_type = stream_id.device_id().device_type(); | ||
// TODO(zwx): eliminate this special 'is cpu' determine | ||
if (device_type == DeviceType::kCPU) { continue; } | ||
if (!IsValidChainId(task->task_set_info().chain_id())) { continue; } | ||
if (!IsValidChainId(task->chain_id())) { continue; } | ||
|
||
for (auto& pair : *(task->mutable_produced_regst_desc())) { | ||
RegstDescProto* regst_desc = &pair.second; | ||
|
@@ -1066,13 +1066,6 @@ struct RankDeviceMemoryInfo { | |
} // namespace | ||
|
||
void PlanUtil::PlanMemoryLog(Plan* plan, const std::string& plan_name) { | ||
std::vector<const TaskProto*> ordered_tasks; | ||
for (const TaskProto& task : plan->task()) { ordered_tasks.push_back(&task); } | ||
auto CompTask = [](const TaskProto* a, const TaskProto* b) { | ||
return a->task_set_info().order_in_graph() < b->task_set_info().order_in_graph(); | ||
}; | ||
std::sort(ordered_tasks.begin(), ordered_tasks.end(), CompTask); | ||
|
||
std::vector<RankDeviceMemoryInfo> rank_device_memory_infos(GlobalProcessCtx::WorldSize(), | ||
RankDeviceMemoryInfo()); | ||
HashMap<int64_t, MemBlockMemoryInfo> mem_block_id2info; | ||
|
@@ -1111,8 +1104,8 @@ void PlanUtil::PlanMemoryLog(Plan* plan, const std::string& plan_name) { | |
} | ||
} | ||
|
||
for (const auto* task : ordered_tasks) { | ||
for (const auto& pair : task->produced_regst_desc()) { | ||
for (const auto& task : plan->task()) { | ||
for (const auto& pair : task.produced_regst_desc()) { | ||
const auto& regst = pair.second; | ||
if (regst.regst_desc_type().has_data_regst_desc() | ||
&& mem_block_id2info.find(regst.mem_block_id()) != mem_block_id2info.end()) { | ||
|
@@ -1214,10 +1207,11 @@ void PlanUtil::PlanMemoryLog(Plan* plan, const std::string& plan_name) { | |
} | ||
|
||
void PlanUtil::GenLightPlan(Plan* plan, const std::string& plan_name) { | ||
// NOTE(chengcheng): ordered_tasks is NOT exec order, just task id order. | ||
std::vector<const TaskProto*> ordered_tasks; | ||
for (const TaskProto& task : plan->task()) { ordered_tasks.push_back(&task); } | ||
auto CompTask = [](const TaskProto* a, const TaskProto* b) { | ||
return a->task_set_info().order_in_graph() < b->task_set_info().order_in_graph(); | ||
return a->task_id() < b->task_id(); | ||
}; | ||
std::sort(ordered_tasks.begin(), ordered_tasks.end(), CompTask); | ||
|
||
|
@@ -1288,8 +1282,10 @@ void PlanUtil::GenLightPlan(Plan* plan, const std::string& plan_name) { | |
<< " task_id2name cannot find" << task_id; | ||
int64_t thrd_id = task->thrd_id(); | ||
StreamId stream_id = DecodeStreamIdFromInt64(thrd_id); | ||
file_stream << "order : " << std::to_string(i) << " , actor id : " << std::to_string(task_id) | ||
<< " name : " << task_id2name.at(task_id) << " thrd : " << std::to_string(thrd_id) | ||
file_stream << "i : " << std::to_string(i) << " , actor id : " << std::to_string(task_id) | ||
<< " thrd : " << std::to_string(thrd_id) << " name : " << task_id2name.at(task_id) | ||
<< "\n chain_id : " << std::to_string(task->chain_id()) | ||
<< " order_in_chain : " << std::to_string(task->order_in_chain()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 增加了 chain id 的信息,格式修改: before:
after:
|
||
<< " device_type : " << DeviceType_Name(stream_id.device_type()) | ||
<< " stream_index : " << std::to_string(stream_id.stream_index()) << " {\n"; | ||
for (const auto& key2consume_regst : task->consumed_regst_desc_id()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对物理图上的拉直算法做了一点 refine,移除了 order in graph 概念。 仅提供 ordered task nodes 。 @Yipeng1994
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯嗯,之前在分离编译的大pr上看到了这个改动