Skip to content

Update _empty_like_pair_orderK for support arrays of different shapes #1224

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

Conversation

vlad-perevezentsev
Copy link
Collaborator

This PR solves #1222.

Now _empty_like_pair_orderK takes a new res_shape parameter to check if the shape of the resulting array has changed after broadcasting. If the resulting array shape is not equal the shape of the input arrays, dpt.empty will be called instead of dpt.empty_like.

Also this PR updates the logic for stride input arrays in _empty_like_pair_orderK for cases of different stride list lengths. The previous implementation expected st1 and st2 to have the same stride list length and always used the X1 array shape for the resulting array.

Added tests only for test_add. This is enough to check for new changes and to reduce the number of test lines.

  • 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?

@coveralls
Copy link
Collaborator

coveralls commented Jun 2, 2023

Coverage Status

coverage: 84.054% (+0.02%) from 84.035% when pulling c46866b on vlad-perevezentsev:fix_binaryelementwisefunc into 1596a13 on IntelPython:master.

ndgrigorian
ndgrigorian previously approved these changes Jun 2, 2023
Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @vlad-perevezentsev!

@oleksandr-pavlyk
Copy link
Contributor

Please check the coverall report to find out why the coverage went down by that much and add tests.

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

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

The nightly build failure is unrelated to this PR, so I'm going to go ahead and approve it.

@vlad-perevezentsev vlad-perevezentsev merged commit 368a17e into IntelPython:master Jun 7, 2023
@github-actions
Copy link

github-actions bot commented Jun 7, 2023

Array API standard conformance tests for dpctl=0.14.3dev3=py310h7bf5fec_14 ran successfully.
Passed: 321
Failed: 679
Skipped: 119

@vlad-perevezentsev vlad-perevezentsev deleted the fix_binaryelementwisefunc branch June 20, 2023 10:53
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.

_empty_like_pair_orderK in BinaryElementwiseFunc allocates the wrong result shape
4 participants