Skip to content

Support complex numbers in sycl::reduction #5477

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
Pennycook opened this issue Feb 4, 2022 · 2 comments
Closed

Support complex numbers in sycl::reduction #5477

Pennycook opened this issue Feb 4, 2022 · 2 comments
Labels
confirmed enhancement New feature or request spec extension All issues/PRs related to extensions specifications

Comments

@Pennycook
Copy link
Contributor

Pennycook commented Feb 4, 2022

The sycl_ext_oneapi_complex_algorithms extension adds support for std::complex to algorithms like reduce and reduce_over_group.

During review of #5394, it became clear that adding support for std::complex to sycl::known_identity would have two benefits:

  1. It would simplify the implementation of the group algorithms, since known_identity could be used for all supported types
  2. It would enable std::complex to be used by sycl::reduction without the user passing an explicit identity

Opening this issue to gauge interest in the idea, and for discussion with reduction implementers (e.g. @v-klochkov) regarding feasibility of extending known_identity in this way.

@Pennycook Pennycook added enhancement New feature or request spec extension All issues/PRs related to extensions specifications labels Feb 4, 2022
@vladimirlaz vladimirlaz self-assigned this Feb 7, 2022
@vladimirlaz vladimirlaz removed their assignment Feb 10, 2022
@v-klochkov
Copy link
Contributor

I agree and think that sycl::has_known_identity should return true for std::plusstd::complex.
That will automatically enable std::complex plus operation for sycl::reductions without explicitly passed identity value.

steffenlarsen pushed a commit that referenced this issue Mar 2, 2023
This PR proposes to augment sycl::has_known_identity to return true for
std::complex and std::plus operator. This will have two benefits:

1. It enables support for complex numbers in sycl::reduction without the
user having to explicitly pass identity.
2. sycl::known_identity can now be used to simplify the implementation
of group algorithms (See PR #5394).

Also, this PR addresses the Github issue #5477.
Test Case PR: intel/llvm-test-suite#1609
@uditagarwal97
Copy link
Contributor

Addressed in #8425.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed enhancement New feature or request spec extension All issues/PRs related to extensions specifications
Projects
None yet
Development

No branches or pull requests

4 participants