Skip to content

Incomplete SYCL 2020 math functions marray support #5991

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

Closed
JackAKirk opened this issue Apr 8, 2022 · 1 comment
Closed

Incomplete SYCL 2020 math functions marray support #5991

JackAKirk opened this issue Apr 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@JackAKirk
Copy link
Contributor

JackAKirk commented Apr 8, 2022

Table 161 of the SYCL 2020 spec revision 4 provides the following relevant descriptions:

floatn: float{n}, mfloat{n}, marray<{N},float>
genfloatf: float, floatn
genfloat: genfloatf, genfloatd, genfloath

where

{N} means any positive value of size_t type.

The spec then defines math functions such as:

genfloat acos (genfloat x)

which are implemented in intel/llvm as (https://github.com/intel/llvm/blob/sycl/sycl/include/CL/sycl/builtins.hpp):

// genfloat acos (genfloat x)
template <typename T>
detail::enable_if_t<detail::is_genfloat<T>::value, T> acos(T x) __NOEXC {
  return __sycl_std::__invoke_acos<T>(x);
}

Now if we follow the definition of genfloat type trait and sub traits eventually we get that the subset of marray types contained within genfloat is defined by marray_float_list as:

using marray_float_list =
    type_list<marray<float, 1>, marray<float, 2>, marray<float, 3>,
              marray<float, 4>, marray<float, 8>, marray<float, 16>>;

i.e. this covers the set {n} : (from the sycl spec)

where {n} means 2,3,4,8,16

which does not match the set from the sycl spec which covers {N} defined above.

This means that we should increase marray_float_list to cover the complete set {N}, unless there is a good reason that only the limited {n} is supported by the sycl Math functions (In which case the SYCL spec should be updated)?

@JackAKirk
Copy link
Contributor Author

Resolved by #6038.

bader pushed a commit that referenced this issue Dec 2, 2022
This PR aims to fix issue: #5991
and provide efficient working marray math function implementations for
all backends.

marray math function support is currently switched on for {n} ({n}
defined in #5991) but the implementations are currently broken and
untested. There is also very limited test coverage for sycl::vec cases.
The SYCL 2020 specification states that the set {N} ({N} defined in
#5991) should be supported for marray math function cases.

All SYCL 2020 math, native math, and half_precision math functions now
have marray support when the function's arguments are of type `genfloat`
and have the same argument type for all arguments.

Tests: intel/llvm-test-suite#1002

Signed-off-by: jack.kirk <jack.kirk@codeplay.com>
Co-authored-by: JackAKirk <chezjakirk@gmail.com>
Co-authored-by: Jakub Chlanda <jakub@codeplay.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant