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

add channels last for MaxPool2d #48917

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions aten/src/ATen/cpu/vec256/vec256_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ struct Vec256 {
}
return mask;
}
Vec256<T> isnan() const {
mingfeima marked this conversation as resolved.
Show resolved Hide resolved
Vec256<T> vec;
for (int64_t i = 0; i != size(); i++) {
if (_isnan(values[i])) {
std::memset(static_cast<void*>(vec.values + i), 0xFF, sizeof(T));
} else {
std::memset(static_cast<void*>(vec.values + i), 0, sizeof(T));
}
}
return vec;
}
Vec256<T> map(T (*f)(T)) const {
Vec256<T> ret;
for (int64_t i = 0; i != size(); i++) {
Expand Down
3 changes: 3 additions & 0 deletions aten/src/ATen/cpu/vec256/vec256_double.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ template <> class Vec256<double> {
__m256d cmp = _mm256_cmp_pd(values, _mm256_set1_pd(0.0), _CMP_EQ_OQ);
return _mm256_movemask_pd(cmp);
}
Vec256<double> isnan() const {
return _mm256_cmp_pd(values, _mm256_set1_pd(0.0), _CMP_UNORD_Q);
}
Vec256<double> map(double (*f)(double)) const {
__at_align32__ double tmp[size()];
store(tmp);
Expand Down
3 changes: 3 additions & 0 deletions aten/src/ATen/cpu/vec256/vec256_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ template <> class Vec256<float> {
__m256 cmp = _mm256_cmp_ps(values, _mm256_set1_ps(0.0f), _CMP_EQ_OQ);
return _mm256_movemask_ps(cmp);
}
Vec256<float> isnan() const {
return _mm256_cmp_ps(values, _mm256_set1_ps(0.0f), _CMP_UNORD_Q);
}
Vec256<float> map(float (*f)(float)) const {
__at_align32__ float tmp[size()];
store(tmp);
Expand Down
13 changes: 13 additions & 0 deletions aten/src/ATen/cpu/vec256/vec256_float_neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ template <> class Vec256<float> {
}
return mask;
}
Vec256<float> isnan() const {
__at_align32__ float tmp[size()];
__at_align32__ float res[size()];
store(tmp);
for (int64_t i = 0; i < size(); i++) {
mingfeima marked this conversation as resolved.
Show resolved Hide resolved
if (_isnan(tmp[i])) {
std::memset(static_cast<void*>(&res[i]), 0xFF, sizeof(float));
} else {
std::memset(static_cast<void*>(&res[i]), 0, sizeof(float));
}
}
return loadu(res);
};
Vec256<float> map(float (*f)(float)) const {
__at_align32__ float tmp[size()];
store(tmp);
Expand Down