-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[static op generation] pool2d, pool3d #54070
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
a9ba11a
[phi] autogen code pool2d
gouzil 01f4c46
[phi] move poolop GetExpectedKernelType and GetKernelTypeForVar
gouzil 7f7fabc
[phi] fix move GetExpectedKernelType
gouzil fc3dbc7
[phi] autogen code pool3d
gouzil dbda093
[fluid] fix get_expected_kernel_func
gouzil 1399e2a
[fluid] fix get_expected_kernel_func
gouzil ddf15ba
[phi][yml] fix args
gouzil e81a123
[fluid] rm pool_op cmake
gouzil 94eabd3
[phi] fix GetKernelTypeForVar
gouzil a0399b1
[phi] fix args; reduction legacy
gouzil 2099624
[phi] fix pool2d_double_grad args
gouzil 010194d
[phi] fix pool3d args; reduction pool3d legacy; fix test
gouzil 6f615f0
clean
gouzil 83ffe1d
[phi] fix yaml add attrs ; [test] fix cmake
gouzil 19444d3
[phi] fix pool3d args
gouzil b8ab81c
[phi] fix pool2d_double_grad args
gouzil 0a743bf
Merge branch 'develop' of github.com:gouzil/Paddle into autogen_code_…
gouzil ec9cfe5
[phi] op_compat add keep_signature; RollBACK pool_sig
gouzil d263253
[phi] RollBACK output
gouzil 23a8700
[phi] try fix multiple definition
gouzil 791de7e
[phi] fix keep_signature; RollBACK op_compat
gouzil 39f9ec1
[phi] fix manual_signature
gouzil 8c4810f
Merge branch 'develop' of github.com:gouzil/Paddle into autogen_code_…
gouzil b1d9b1b
Merge branches 'autogen_code_pool2d' and 'develop' of github.com:gouz…
gouzil b51b2ac
[phi]clean get_expected_kernel_func;[phi] rm compat;
gouzil e0baf77
Merge branch 'develop' of github.com:gouzil/Paddle into autogen_code_…
gouzil d4ce114
[phi] Fix Misdeletion
gouzil 36f722f
Merge branch 'develop' of github.com:gouzil/Paddle into autogen_code_…
gouzil 8b81c16
add use_cudnn
gouzil fd262b2
Merge branch 'develop' of github.com:gouzil/Paddle into autogen_code_…
gouzil 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 hidden or 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 |
---|---|---|
|
@@ -61,6 +61,20 @@ static bool ReduceOpHasOptimizedOneDNNKernel( | |
return true; | ||
} | ||
|
||
// only poolop | ||
bool CanMKLDNNSupportPool(const framework::ExecutionContext& ctx) { | ||
if (ctx.Attr<bool>("adaptive") == false) return true; | ||
// oneDNN is supporting only unchangable in size pool window | ||
auto src_tz = phi::vectorize(ctx.Input<phi::DenseTensor>("X")->dims()); | ||
if (!ctx.HasAttr("ksize")) { | ||
return false; | ||
} | ||
std::vector<int> ksize = ctx.Attr<std::vector<int>>("ksize"); | ||
// Fast but not exhustive check | ||
return ((src_tz[src_tz.size() - 1] % ksize[1] == 0) && | ||
(src_tz[src_tz.size() - 2] % ksize[0] == 0)); | ||
} | ||
|
||
phi::KernelKey GetReduceExpectedKernelType( | ||
const framework::ExecutionContext& ctx, | ||
const framework::OperatorWithKernel* op_ptr) { | ||
|
@@ -117,6 +131,31 @@ phi::KernelKey GetAssignExpectedKernelType( | |
ctx.device_context().GetPlace()); | ||
} | ||
|
||
phi::KernelKey GetPoolExpectedKernelType( | ||
const framework::ExecutionContext& ctx, | ||
const framework::OperatorWithKernel* op_ptr) { | ||
auto data_type = op_ptr->OperatorWithKernel::IndicateVarDataType(ctx, "X"); | ||
|
||
// NOTE(jiahongyu): Below codes originally enclosed by PADDLE_WITH_MKLDNN | ||
op_ptr->SetDnnFallback(!CanMKLDNNSupportPool(ctx)); | ||
// NOTE(jiahongyu) END: Above codes originally enclosed by PADDLE_WITH_MKLDNN | ||
|
||
return phi::KernelKey(data_type, ctx.GetPlace()); | ||
} | ||
|
||
phi::KernelKey GetPoolGradExpectedKernelType( | ||
const framework::ExecutionContext& ctx, | ||
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. 删除这个,逻辑跟 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. Done |
||
const framework::OperatorWithKernel* op_ptr) { | ||
auto input_data_type = | ||
op_ptr->OperatorWithKernel::IndicateVarDataType(ctx, "X"); | ||
|
||
// NOTE(jiahongyu): Below codes originally enclosed by PADDLE_WITH_MKLDNN | ||
op_ptr->SetDnnFallback(!CanMKLDNNSupportPool(ctx)); | ||
// NOTE(jiahongyu): Above codes originally enclosed by PADDLE_WITH_MKLDNN | ||
|
||
return phi::KernelKey(input_data_type, ctx.GetPlace()); | ||
} | ||
|
||
phi::KernelKey GetSgdExpectedKernelType( | ||
const framework::ExecutionContext& ctx, | ||
const framework::OperatorWithKernel* op_ptr) { | ||
|
This file contains hidden or 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
Oops, something went wrong.
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.
增加
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.
Done