Skip to content

Conversation

@engineer1109
Copy link
Contributor

PR types

New features

PR changes

Others

Description

Custom Device可以使用pass conv_elementwise_add_act_fuse_pass
但是激活层融合只有"identity", "relu" 有效。
原因是 conv_elementwise_add_act_fuse_pass判定激活层是否可用取决于cutlass_can_fuse和cudnn_can_fuse
这影响了custom device的使用。

所以添加了

    custom_act_set = {
        "identity", "relu", "sigmoid", "tanh", "swish", "leaky_relu"};

让Custom Device可以正常使用conv_elementwise_add_act_fuse_pass的全部激活层融合。
这个PR不影响现有的任何实现。

Custom Device想要启用激活层融合则需要在Paddle Inference的config手动添加Pass

        config.pass_builder()->AppendPass("silu_fuse_pass");
        config.pass_builder()->AppendPass("conv_bn_fuse_pass");
        config.pass_builder()->AppendPass("conv_eltwiseadd_bn_fuse_pass");
        config.pass_builder()->AppendPass("conv_elementwise_add_act_fuse_pass");
        config.pass_builder()->AppendPass("conv_elementwise_add_fuse_pass");

Pass启用后,将会使用fused_conv2d_add_act Kernel.

@paddle-bot
Copy link

paddle-bot bot commented Jan 10, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@engineer1109
Copy link
Contributor Author

@qili93 有空麻烦Review一下,CI已经全绿

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jan 18, 2024

Sorry to inform you that eaee6b5's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@engineer1109
Copy link
Contributor Author

@qili93 CI又完成了一次,麻烦有空看下

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

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

LGTM

@qili93 qili93 merged commit 87b1b00 into PaddlePaddle:develop Jan 19, 2024
@qili93
Copy link
Contributor

qili93 commented Jan 19, 2024

Thansk for your contribution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants