-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
【static】modify backward prune logic for EmptygradOpMaker #53746
Merged
xiaoguoguo626807
merged 31 commits into
PaddlePaddle:develop
from
xiaoguoguo626807:gradopmaker
May 16, 2023
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
7bdf59c
add rules
xiaoguoguo626807 bbdf3f6
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 f67d10f
modify no kernel yaml parse
xiaoguoguo626807 2763cb8
fix_conflict
xiaoguoguo626807 eaac527
success op generate
xiaoguoguo626807 72a6ef5
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 7198b0d
success test_silu_double
xiaoguoguo626807 9c2bb06
modify bug
xiaoguoguo626807 0a2dc96
modify static error
xiaoguoguo626807 d317192
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 eb6e539
modify silu_grad input
xiaoguoguo626807 095d590
fix conflict
xiaoguoguo626807 c13db26
modify kernel signature
xiaoguoguo626807 6ac4947
modify kernel signature
xiaoguoguo626807 94469e8
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 a0903a2
code style
xiaoguoguo626807 c9110f3
Merge branch 'develop' into silu_double_grad
xiaoguoguo626807 e85f951
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 1879741
code style
xiaoguoguo626807 455e545
review
xiaoguoguo626807 af4f4c1
delete opinfo modify
xiaoguoguo626807 debc77e
modify gradOpMaker
xiaoguoguo626807 c0ced95
modify gradOpMaker
xiaoguoguo626807 19635e8
merge and modify silu_double_grad kernel signature
xiaoguoguo626807 357497f
modify silu_double_grad rules
xiaoguoguo626807 5046cef
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 06ac607
Merge commit 'refs/pull/53605/head' of https://github.com/PaddlePaddl…
xiaoguoguo626807 04f3408
modify genarated-j2
xiaoguoguo626807 f4e4576
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
xiaoguoguo626807 8eeb455
add approve rules
xiaoguoguo626807 c0a8190
modify aytograd_functional_static_test
xiaoguoguo626807 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1325,8 +1325,7 @@ All parameter, weight, gradient are variables in Paddle. | |
if ((grad_op_maker == nullptr) && (grad_comp_op_maker == nullptr)) { | ||
// Normally, proto_ should not be null, except some special | ||
// operators, such as LeaklyReluDoubleGrad op. | ||
std::string type = | ||
op_info.proto_ ? op_info.proto_->type() : "unknown"; | ||
std::string type = op_desc.Type(); | ||
PADDLE_THROW(platform::errors::NotFound( | ||
"Neither operator %s's GradOpMaker nor CompGradOpMaker has " | ||
"been registered.\nPlease check whether (%s) operator has " | ||
|
@@ -1348,7 +1347,8 @@ All parameter, weight, gradient are variables in Paddle. | |
VLOG(3) << "need skip: " << need_skip << std::endl; | ||
if (paddle::prim::PrimCommonUtils::IsBwdPrimEnabled()) { | ||
if ((grad_comp_op_maker != nullptr) && (!need_skip)) { | ||
VLOG(3) << "Runing composite fun for " << op_desc.Type(); | ||
VLOG(3) << "Prim Flag Open: Runing composite grad fun for " | ||
<< op_desc.Type(); | ||
grad_op_descs = grad_comp_op_maker(op_desc, | ||
no_grad_set, | ||
&grad_to_var, | ||
|
@@ -1360,9 +1360,13 @@ All parameter, weight, gradient are variables in Paddle. | |
} | ||
} else { | ||
if (grad_op_maker != nullptr) { | ||
VLOG(3) << "Prim Flag Close: Runing origin grad fun for " | ||
<< op_desc.Type(); | ||
grad_op_descs = grad_op_maker( | ||
op_desc, no_grad_set, &grad_to_var, grad_sub_block); | ||
} else { | ||
VLOG(3) << "Prim Flag Close: Runing composite grad fun for " | ||
<< op_desc.Type(); | ||
Comment on lines
+1363
to
+1369
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. 这个LOG级别再降一些把,3 有点高,容易影响到其他地方的调试 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. next pr will modify #53874 |
||
grad_op_descs = grad_comp_op_maker(op_desc, | ||
no_grad_set, | ||
&grad_to_var, | ||
|
@@ -1390,6 +1394,9 @@ All parameter, weight, gradient are variables in Paddle. | |
.Get(op_type) | ||
.HasNonEmptyGradOpMaker(); | ||
}); | ||
m.def("has_empty_grad_op_maker", [](const std::string op_type) { | ||
return framework::OpInfoMap::Instance().Get(op_type).HasEmptyGradOpMaker(); | ||
}); | ||
m.def("has_infer_inplace", [](const std::string op_type) { | ||
return framework::OpInfoMap::Instance().Get(op_type).HasInferInplace(); | ||
}); | ||
|
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.
这里的 else 是不忘删了?
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.
下面还有emptyGradOpMaker的生成分支