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

Removes malformed fast path for zero-size arrays in repeat #1682

Merged
merged 2 commits into from
May 16, 2024

Conversation

ndgrigorian
Copy link
Collaborator

@ndgrigorian ndgrigorian commented May 16, 2024

This PR fixes a small bug in dpctl.tensor.repeat caught by the array API tests where calling repeat with axis=None on a zero-size array would result in an array with the shape of the input, rather than x.shape == (0,) as expected.

To fix this, the malformed fast path for zero-size arrays has been removed, as it was unnecessary: all calls in repeat are already special-cased in the C++ backend to return empty events for zero-size inputs, so any savings for this path were minimal.

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

@ndgrigorian ndgrigorian changed the title Removes malformed fast path for size-zero arrays in repeat Removes malformed fast path for zero-size arrays in repeat May 16, 2024
@ndgrigorian
Copy link
Collaborator Author

@oleksandr-pavlyk
I've added a test for the correct behavior.

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_358 ran successfully.
Passed: 890
Failed: 15
Skipped: 91

@coveralls
Copy link
Collaborator

coveralls commented May 16, 2024

Coverage Status

coverage: 87.967% (+0.02%) from 87.951%
when pulling 4c64cf4 on fix-repeat-size-zero-arrays
into c994666 on master.

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.

LGTM! Having tests has been helpful!

Copy link

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

oleksandr-pavlyk added a commit that referenced this pull request May 16, 2024
@ndgrigorian ndgrigorian merged commit 8a706ae into master May 16, 2024
43 of 58 checks passed
@ndgrigorian ndgrigorian deleted the fix-repeat-size-zero-arrays branch May 16, 2024 21:18
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

3 participants