-
Notifications
You must be signed in to change notification settings - Fork 787
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
Feat/debug pass #7054
Merged
Merged
Feat/debug pass #7054
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6730807
add pass debug
strint be578af
debug pass
strint 2071002
refine comment of fuse add pass
strint adf582a
Merge branch 'master' into feat/debug_pass
strint 6871f4a
Merge branch 'master' into feat/debug_pass
strint 3a8ab57
Merge branch 'master' into feat/debug_pass
strint b1619f0
Merge branch 'master' into feat/debug_pass
strint 32a7bfa
Merge branch 'master' into feat/debug_pass
strint 4226902
auto format by CI
oneflow-ci-bot e2f2fa8
Merge branch 'master' into feat/debug_pass
oneflow-ci-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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -965,8 +965,36 @@ Maybe<void> LazyJobBuildAndInferCtx::Complete() { | |
Global<JobDesc>::Delete(); | ||
auto scope = std::make_unique<GlobalJobDescScope>(mut_job()->job_conf(), job_id()); | ||
JobPassCtx job_pass_ctx(GlobalJobDesc()); | ||
auto DoPass = [&](const std::string& pass_name) -> Maybe<void> { | ||
return JobPass4Name(pass_name)(mut_job(), &job_pass_ctx); | ||
const auto& job_name = job().job_conf().job_name(); | ||
auto LogJob = [&](const std::string& name_suffix) -> void { | ||
std::string full_log_name = | ||
job_name + "-job_id_" + std::to_string(job_id()) + "-" + name_suffix; | ||
TeePersistentLogStream::Create(full_log_name)->Write(job()); | ||
Global<OpGraph>::New(job()); | ||
Global<OpGraph>::Get()->ToDotWithFilePath(full_log_name + ".dot"); | ||
Global<OpGraph>::Delete(); | ||
}; | ||
std::string debug_pass_name = GetStringFromEnv("ONEFLOW_DEBUG_PASS", ""); | ||
auto NeedLogJob = [&](const std::string& pass_name) -> bool { | ||
if ("ALL" == debug_pass_name) { | ||
return true; | ||
} else if (pass_name == debug_pass_name) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}; | ||
auto DoPass = [&](const std::string& pass_name, int32_t cnt = 0) -> Maybe<void> { | ||
if (unlikely(NeedLogJob(pass_name))) { | ||
std::string cnt_str = cnt > 0 ? std::to_string(cnt) : ""; | ||
LogJob(pass_name + cnt_str + "-before"); | ||
} | ||
JUST(JobPass4Name(pass_name)(mut_job(), &job_pass_ctx)); | ||
if (unlikely(NeedLogJob(pass_name))) { | ||
std::string cnt_str = cnt > 0 ? std::to_string(cnt) : ""; | ||
LogJob(pass_name + cnt_str + "-after"); | ||
} | ||
return Maybe<void>::Ok(); | ||
}; | ||
|
||
if (Global<ResourceDesc, ForSession>::Get()->enable_debug_mode() | ||
|
@@ -1007,7 +1035,7 @@ Maybe<void> LazyJobBuildAndInferCtx::Complete() { | |
JUST(DoPass("FuseAddToOutputPass")); | ||
// run this pass again to fuse ops created in the first run. | ||
// TODO(guoran): loop multiple times inside the pass | ||
JUST(DoPass("FuseAddToOutputPass")); | ||
JUST(DoPass("FuseAddToOutputPass", 1)); | ||
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. 该pass会被调用两遍,所以需要id区分下 |
||
JUST(DoPass("IndexedSlicesOptimizerRewritePass")); | ||
JUST(DoPass("SplitSparseSoftmaxCrossEntropyOpPass")); | ||
JUST(DoPass("DoParallelCastBeforeWideningTypeCast")); | ||
|
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.
ALL,打印所有pass前后的job log;
特定名字,就打印对应名字的pass前后的job log;
默认不打印;