Skip to content

Use sycl experimental complex namespace for real and imag #2062

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
wants to merge 2 commits into from

Conversation

ndgrigorian
Copy link
Collaborator

This PR proposes

  • imag using static constant value of 0 for real inputs
  • real and imag both using the experimental complex namespace calls
  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

`imag` uses static constant value of 0 for real inputs and both use sycl complex extension
Copy link

github-actions bot commented Apr 25, 2025

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@coveralls
Copy link
Collaborator

coveralls commented Apr 25, 2025

Coverage Status

coverage: 86.419%. remained the same
when pulling 7564d1c on update-real-imag-implementations
into 8adc781 on master.

Copy link

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_164 ran successfully.
Passed: 1110
Failed: 2
Skipped: 119

@ndgrigorian ndgrigorian marked this pull request as ready for review April 26, 2025 02:46
return std::imag(in);
using realT = typename argT::value_type;
using sycl_complexT = typename exprm_ns::complex<realT>;
return exprm_ns::imag(sycl_complexT(in));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be unclear from the PR description what was the motivation to switch to experimental namespace and why other place where std::imag used are not impacted.. Would it make sense to add clarity on that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial motivation was old technical debt to add the constant value for imag, since we may as well use it for real-valued types.

In terms of why add in the experimental namespace change, complex header is not supported on AMD and this has been an issue with recent AMD builds. I've pushed another branch which removes (almost) every use of complex in kernel code aside from conversion to SYCL complex type. I want to see if this resolves issues with AMD builds on OS compiler.

Copy link
Collaborator Author

@ndgrigorian ndgrigorian Apr 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think it would be best to slowly transition to full use of the sycl complex extension. We also have benchmarking now and can see if this PR brings regressions once we have some unary elementwise benchmarks in place.

But it could be done in a separate PR, if you feel it makes more sense that way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, thank you. I'm totally with that. Just it was a bit unclear from the PR description.

Copy link

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_165 ran successfully.
Passed: 1108
Failed: 4
Skipped: 119

Copy link
Collaborator

@antonwolfy antonwolfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ndgrigorian
Copy link
Collaborator Author

Closing PR because I think exprm_ns use should be moved into a separate commit, I will open a PR with only the change to use constant_value in imag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants