Merged
Conversation
b493ab6 to
5358737
Compare
94f79ac to
49de951
Compare
Xreki
reviewed
Apr 12, 2021
082730f to
5f667fc
Compare
Xreki
reviewed
Apr 14, 2021
04b5e61 to
80ed55d
Compare
Xreki
approved these changes
Apr 15, 2021
| }; | ||
|
|
||
| template <typename T> | ||
| int GetVectorizedSizeImpl(const T *pointer) { |
Contributor
There was a problem hiding this comment.
在一些复杂、多维的情况下,能否向量化需要满足2个条件:
- 地址对齐
- size是VecSize的倍数。比如broadcast的配置[M, N][N],要求N是VecSize的倍数。记录一下,same dims的情况简单一些。
| int remain = size - VecSize * tid; | ||
| remain = remain > 0 ? remain : 0; | ||
| if (remain >= VecSize) { | ||
| auto data = ElementwiseDataWrapper<ET, VecSize, T>(out, in0, in1); |
Contributor
There was a problem hiding this comment.
咦,ElementwiseDataWrapper是在CUDA Kernel内部定义的么,可以挪到外层(即LaunchElementwiseCudaKernel)函数里面定义?而且ElementwiseDataWrapper本身具备load/store_vector、load/store_scalar的功能,这里if、else也可以使用同一个ElementwiseDataWrapper对象。
Xreki
reviewed
Apr 18, 2021
Xreki
reviewed
Apr 18, 2021
| break; | ||
| default: | ||
| PADDLE_THROW(platform::errors::Unimplemented( | ||
| "Unsupported vectorized size: %d !", vec_size)); |
Contributor
There was a problem hiding this comment.
是不是default就当成vec_size=1来处理比较好?
Xreki
reviewed
Apr 18, 2021
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR types
Performance optimization
PR changes
OPs
Describe
Common same dims elementwise op template