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

Fused elementwises kernels and ops #51427

Merged

Conversation

HulekJakub
Copy link
Contributor

@HulekJakub HulekJakub commented Mar 9, 2023

PR types

Others

PR changes

Others

Description

  • added fused elementwise kernel
  • added fused elementwises ops (add, sub, mul, div)
  • mkldnn -> onednn
  • adjusted unit tests

@paddle-bot
Copy link

paddle-bot bot commented Mar 9, 2023

你的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.

@HulekJakub HulekJakub marked this pull request as draft March 9, 2023 09:32
@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Mar 9, 2023
@@ -175,7 +175,7 @@ if(WITH_MKLDNN)
pass_library(softplus_activation_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(shuffle_channel_mkldnn_detect_pass inference DIR mkldnn)
pass_library(fc_act_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(elt_act_mkldnn_fuse_pass inference DIR mkldnn)
pass_library(elt_act_onednn_fuse_pass inference DIR mkldnn)
Copy link
Member

Choose a reason for hiding this comment

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

As we change it already, please change elt to either eltwise or elementwise as it's more common among other passes.

}
extra {
attrs {
name: "x_data_format"
Copy link
Member

Choose a reason for hiding this comment

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

x_data_format and y_data_format seem to be deprecated attributes. Please don't add them here. They should be also removed from base operators

type: FLOAT
}
attrs {
name: "Scale_x"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name: "Scale_x"
name: "scale_x"

All attributes should be lowercase. We must unify it, as there are currently too many duplicates with quantization scales.

Comment on lines 46 to 49
attrs {
name: "fuse_activation"
type: STRING
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
attrs {
name: "fuse_activation"
type: STRING
}
attrs {
name: "fuse_activation"
type: STRING
}
attrs {
name: "fuse_alpha"
type: FLOAT
}
attrs {
name: "fuse_beta"
type: FLOAT
}

Comment on lines 26 to 33
attrs {
name: "alpha"
type: FLOAT
}
attrs {
name: "beta"
type: FLOAT
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
attrs {
name: "alpha"
type: FLOAT
}
attrs {
name: "beta"
type: FLOAT
}

name: "fuse_activation"
type: STRING
}
}
Copy link
Member

Choose a reason for hiding this comment

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

There is also float fused_output_scale from operator_scale_onednn_fuse_pass

name: "fuse_activation"
type: STRING
}
}
Copy link
Member

Choose a reason for hiding this comment

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

All comments to fused_elementwise_add.pbtxt are valid for other fused_elementwise_.pbtxt

name: "fuse_activation"
type: STRING
}
}
Copy link
Member

Choose a reason for hiding this comment

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

elementwise_mul can have fused_unsqueeze2_axes attribute fromoperator_unsqueeze2_onednn_fuse_pass

@HulekJakub HulekJakub marked this pull request as ready for review March 10, 2023 14:31
YuanRisheng
YuanRisheng previously approved these changes May 15, 2023
zyfncg
zyfncg previously approved these changes May 15, 2023
XieYunshen
XieYunshen previously approved these changes May 15, 2023
Aurelius84
Aurelius84 previously approved these changes May 15, 2023
Silv3S
Silv3S previously approved these changes May 15, 2023
@YuanRisheng
Copy link
Contributor

I am sorry to inform you that you need update code again. I have analyzed the CI-Coverage and found the problem. The test test_elementwise_add_mkldnn_op has some issues and it is forbidden before. In this PR, test_elementwise_add_mkldnn_op is renamed to test_elementwise_add_onednn_op , it will be no longer be banned. So , you could change name to test_elementwise_add_mkldnn_op for passing it. Good Luck! @HulekJakub

@HulekJakub
Copy link
Contributor Author

@YuanRisheng Done. I've seen that PR-CI-Coverage first checks approves and fails if there aren't required ones, and only once the approves are there it runs tests, which really slows development (tests work on local, have to wait for approves, test doesn't work on CI, approves get dismissed which is just a waste of time)

@YuanRisheng
Copy link
Contributor

@YuanRisheng Done. I've seen that PR-CI-Coverage first checks approves and fails if there aren't required ones, and only once the approves are there it runs tests, which really slows development (tests work on local, have to wait for approves, test doesn't work on CI, approves get dismissed which is just a waste of time)

@HulekJakub Thank you for your feedback. I will report this issue to my team. And CI-Windows fails because of set_tests_properties(test_elementwise_add_onednn_op PROPERTIES TIMEOUT 60) in CMakeLists.txt

@xinyu-intel xinyu-intel self-requested a review May 17, 2023 06:15
@YuanRisheng YuanRisheng requested a review from zyfncg May 17, 2023 09:22
Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@YuanRisheng YuanRisheng merged commit fb4a6ec into PaddlePaddle:develop May 18, 2023
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers Intel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants