-
Notifications
You must be signed in to change notification settings - Fork 754
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
[SYCL] Add marray support to common + some math functions #8631
[SYCL] Add marray support to common + some math functions #8631
Conversation
This patch adds marray support to all functions from Table 179 of SYCL 2020 spec + to functions fabs, ilogb, fmax, fmin, ldexp, pown, rootn from Table 175 + to function exp10 from Table 177.
/verify with intel/llvm-test-suite#1656 |
template <typename T, size_t N> | ||
inline __SYCL_ALWAYS_INLINE | ||
std::enable_if_t<detail::is_sgenfloat<T>::value, marray<T, N>> | ||
pown(marray<T, N> x, marray<int, N> y) __NOEXC { |
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.
Looks like we can add one more high-level macro to generalize definitions of pown
, rootn
and ldexp
. Similar to __SYCL_MATH_FUNCTION_2_OVERLOAD(atan2)
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.
Basically yes, the reason I didn't do this is to stick to code style in this part of the file.
@@ -122,10 +122,27 @@ __SYCL_MATH_FUNCTION_OVERLOAD_FM(log2) | |||
__SYCL_MATH_FUNCTION_OVERLOAD_FM(log10) | |||
__SYCL_MATH_FUNCTION_OVERLOAD_FM(sqrt) | |||
__SYCL_MATH_FUNCTION_OVERLOAD_FM(rsqrt) | |||
__SYCL_MATH_FUNCTION_OVERLOAD_FM(fabs) |
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.
I suggest to outline such tiny additions into a separate PR, because we can merge them almost right away.
/verify with intel/llvm-test-suite#1656 |
/verify with intel/llvm-test-suite#1656 |
@bader @AlexeySachkov lol, now clang-format suggests to get these suspicious changes back. Should I apply them or I can just add ignore-lint label? |
I'm against ignoring formatting issues in the code we own. If you prefer to keep existing formatting, you can disable clang-format for some parts. https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code Some suggestions look reasonable. E.g. @@ -182,9 +182,8 @@ __SYCL_MATH_FUNCTION_2_OVERLOAD(remainder)
template <typename T, size_t N>
inline __SYCL_ALWAYS_INLINE
std::enable_if_t<__FAST_MATH_SGENFLOAT(T), marray<T, N>>
- powr(marray<T, N> x, marray<T, N> y) __NOEXC {
- __SYCL_MATH_FUNCTION_2_OVERLOAD_IMPL(powr)
-}
+ powr(marray<T, N> x,
+ marray<T, N> y) __NOEXC{__SYCL_MATH_FUNCTION_2_OVERLOAD_IMPL(powr)} Do you know why clang-format gives different results? I know that the version must be the same, so I suppose there were changes in the config file. Right? |
@bader honestly I don't know. This one definitely looks strange:
I'm okay to apply these suggestions if you think that this formatting is right. |
This should be the decision of the code owners. I've given you options on how to keep the existing formatting so you can change it, keep it, or mix these options. -__SYCL_MATH_FUNCTION_2_SGENFLOAT_Y_OVERLOAD(fmax)
-__SYCL_MATH_FUNCTION_2_SGENFLOAT_Y_OVERLOAD(fmin)
+ __SYCL_MATH_FUNCTION_2_SGENFLOAT_Y_OVERLOAD(fmin) My personal view is that this change makes formatting inconsistent, so wouldn't apply it. I suppose |
This reverts commit 23cfc1e.
/verify with intel/llvm-test-suite#1656 |
Current formatting looks good to me and I would prefer not to revert back to the weird one |
@againull, @intel/llvm-reviewers-runtime, could you please take a look? |
/verify with intel/llvm-test-suite#1656 |
This patch adds support of sycl::marray to the rest math built-in functions (SYCL 2020, Table 175), and adds missing tests for math and common functions for intel#8631 to reduce number of upcoming cherry-picks.
This patch adds support of sycl::marray to the rest of math built-in functions (SYCL 2020, Table 175), and adds missing tests for math and common functions for #8631 to reduce number of upcoming cherry-picks.
This patch adds marray support to all functions from Table 179 of SYCL 2020 spec + to functions fabs, ilogb, fmax, fmin, ldexp, pown, rootn from Table 175 + to function exp10 from Table 177.
E2E tests: intel/llvm-test-suite#1656