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

Disable vectorized bitwise_invert for boolean inputs #1681

Merged
merged 3 commits into from
May 16, 2024

Conversation

ndgrigorian
Copy link
Collaborator

@ndgrigorian ndgrigorian commented May 16, 2024

This PR proposes removing the sycl::vec overload of bitwise_invert for boolean inputs to fix unexpected behaviors.

Vectorized bitwise_invert on boolean inputs would corrupt the data in a subtle way. When casting this data to an integer data type, 255 would always be the result of casting true.
This is likely related to operator! on sycl::vec returning -1 for true and expecting the output type to be a signed integer type.

  • 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?
  • If this PR is a work in progress, are you opening the PR as a draft?

This overload would cause sufficiently large boolean arrays to produce unexpected results when cast to another type
Copy link

github-actions bot commented May 16, 2024

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

Copy link

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_359 ran successfully.
Passed: 889
Failed: 16
Skipped: 91

@coveralls
Copy link
Collaborator

coveralls commented May 16, 2024

Coverage Status

coverage: 87.951%. remained the same
when pulling c6404ee on fix-bitwise-invert-on-boolean-inputs
into c994666 on master.

@ndgrigorian ndgrigorian changed the title Fixes bitwise_invert on sufficiently large boolean inputs Disable vectorized bitwise_invert boolean inputs May 16, 2024
Copy link
Collaborator

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thank you @ndgrigorian ! I have added @npolina4 as a reviewer as original reporter of this issue.

Copy link

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_360 ran successfully.
Passed: 888
Failed: 17
Skipped: 91

Copy link
Collaborator

@npolina4 npolina4 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you @ndgrigorian!

@ndgrigorian ndgrigorian changed the title Disable vectorized bitwise_invert boolean inputs Disable vectorized bitwise_invert for boolean inputs May 16, 2024
@ndgrigorian ndgrigorian merged commit ba09dd8 into master May 16, 2024
42 of 58 checks passed
@ndgrigorian ndgrigorian deleted the fix-bitwise-invert-on-boolean-inputs branch May 16, 2024 19:50
oleksandr-pavlyk added a commit that referenced this pull request May 16, 2024
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.

None yet

4 participants