-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[X86] refactor elementwise OP for X86; remove _mm256_zeroupper() beca… #6957
Conversation
…use of incorrect result;
Thanks for your contribution! |
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.
LGTM
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.
LGTM
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.
LGTM,任务紧急,有问题下次修改吧
@@ -38,7 +38,7 @@ static void activate_relu_inplace(float *data, int len, float alpha, int mode) { | |||
__m256 vec_data = _mm256_loadu_ps(data + i); | |||
_mm256_storeu_ps(data + i, _mm256_max_ps(vec_data, vec_zero)); | |||
} | |||
_mm256_zeroupper(); | |||
// _mm256_zeroupper(); |
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.
不需要的代码请删掉
其它的地方也一样
@@ -294,11 +294,12 @@ class RoiAlignComputeTester : public arena::TestCase { | |||
uint64_t new_end = *rois_lod0.rbegin() + bno + 1; | |||
rois_lod0.push_back(new_end); | |||
for (int i = 0; i < (bno + 1); ++i) { | |||
float x1 = randint(0, width / spatial_scale_ - pooled_width_); | |||
float y1 = randint(0, height / spatial_scale_ - pooled_height_); | |||
float x1 = 1.f * randint(0, width / spatial_scale_ - pooled_width_); |
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.
static_cast好一点?
} | ||
} | ||
|
||
#endif // LITE_WITH_ARM |
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.
注释不对?
const typename Config::T* diny, | ||
typename Config::T* dout, | ||
int num) { | ||
static_assert((IS_X_SINGLE && IS_Y_SINGLE) != true, |
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.
static_assert((IS_X_SINGLE && IS_Y_SINGLE) != true, | |
static_assert(!(IS_X_SINGLE && IS_Y_SINGLE), |
// marco func add | ||
ElementWiseFunc(Add) ElementWiseFuncBCast(Add) | ||
// marco func sub | ||
ElementWiseFunc(Sub) ElementWiseFuncBCast(Sub) | ||
// marco func mul | ||
ElementWiseFunc(Mul) ElementWiseFuncBCast(Mul) | ||
// marco func max | ||
ElementWiseFunc(Max) ElementWiseFuncBCast(Max) | ||
// marco func min | ||
ElementWiseFunc(Min) ElementWiseFuncBCast(Min) | ||
// marco func div | ||
ElementWiseFunc(Div) ElementWiseFuncBCast(Div) | ||
// marco func floordiv | ||
ElementWiseFunc(FloorDiv) ElementWiseFuncBCast(FloorDiv) | ||
// marco func mod | ||
ElementWiseFunc(Mod) ElementWiseFuncBCast(Mod) | ||
// marco func pow | ||
ElementWiseFunc(Pow) ElementWiseFuncBCast(Pow) |
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.
建议后面加 ";",这样格式能对齐
#define ElementWiseFuncBCast(op) \ | ||
template <typename T> \ | ||
void Elementwise_Broadcast_##op(const T* dinx, \ | ||
const T* diny, \ | ||
T* dout, \ | ||
int batch, \ |
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.
不推荐这种宏的方式,可以用模板实现的
[X86] refactor elementwise OP for X86;
remove _mm256_zeroupper();