Skip to content
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

[OpenCL] fuse conv prelu pass #5461

Merged
merged 12 commits into from
Mar 3, 2021

Conversation

daming5432
Copy link
Collaborator

@daming5432 daming5432 commented Feb 3, 2021

mtcnn_det2 骁龙865融合前耗时2.28ms,融合后2.07ms
mtcnn_det3 骁龙865融合前耗时5.69ms,融合后4.72ms

@@ -21,7 +21,8 @@ __kernel void conv2d_1x1_opt(
__private const int input_height, /* of one block */
__private const int output_width,
__private const int output_height,
__private const int old_w) {
__private const int old_w,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是out_tensor_w嘛

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是prelu的参数,是一个tensor。之前的act里面只要添加attribute就好了,prelu融合需要添加一个新的输入

output0 = activation_type4(output0, alpha0);
output1 = activation_type4(output1, alpha1);
output2 = activation_type4(output2, alpha2);
output3 = activation_type4(output3, alpha3);
Copy link
Contributor

@ysh329 ysh329 Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑能否把该值融合到activation_type和type4中,以增加默认参数的方式。这个与FUSE_SCALE_ACT还有些不同,后者FUSE_SCALE不仅在convkernel中有用到,在element kernel中也有用到

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看原来的实现中有prelu的选项,如果有prelu定义时添加一个参数,如果没有就只有一个参数。你是说把第二个参数设置成默认就含有是么

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对的,第二个参数默认就含有

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

@daming5432 daming5432 changed the title fuse conv prelu pass test fuse conv prelu pass Feb 3, 2021
@ysh329 ysh329 changed the title fuse conv prelu pass [OpenCL] fuse conv prelu pass Feb 23, 2021
output2 = activation_type4(output2);
output3 = activation_type4(output3);
CL_DTYPE4 alpha0,alpha1,alpha2,alpha3;
#ifdef PRELU_CH
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全局宏比较多,可以增加一些注释标记

比如

#ifdef PRELU_CH  // {

// }
#endif defined(PRELU_ELE) // {

// }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改

ysh329
ysh329 previously approved these changes Mar 1, 2021
Copy link
Contributor

@ysh329 ysh329 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Superjomn
Superjomn previously approved these changes Mar 1, 2021
Copy link
Collaborator

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daming5432 daming5432 dismissed stale reviews from Superjomn and ysh329 via 8fd713c March 1, 2021 13:44
Superjomn
Superjomn previously approved these changes Mar 2, 2021
Copy link
Collaborator

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daming5432 daming5432 merged commit d51bd58 into PaddlePaddle:develop Mar 3, 2021
@daming5432 daming5432 deleted the fuse_conv_prelu_pass branch March 3, 2021 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants