dpctl icon indicating copy to clipboard operation
dpctl copied to clipboard

Update integer advanced indexing for array API 2024.12 spec

Open ndgrigorian opened this issue 9 months ago • 7 comments

The array API specification now requires advanced integer indexing (i.e., with arrays) to promote Python integer scalars to arrays when mixed with integer arrays.

This PR implements this behavior, promoting any integer indices and fixes a bug in indexing where integer indices from 0D arrays were being brought to the host as Python scalars

With the previous behavior, 0D arrays and integer scalars were considered on the same level, and when positioned between two non-0D arrays, would throw IndexError, noting that basic slicing is not permitting between advanced indices. With the new behavior, an exception is made for integer indices after index arrays but prior to other basic slicing operations, these are now considered on the level of arrays instead, and are promoted to arrays prior to kernel launch.

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

ndgrigorian avatar Mar 26 '25 23:03 ndgrigorian

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

github-actions[bot] avatar Mar 26 '25 23:03 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_75 ran successfully. Passed: 894 Failed: 2 Skipped: 154

github-actions[bot] avatar Mar 26 '25 23:03 github-actions[bot]

Coverage Status

coverage: 86.392% (+0.01%) from 86.381% when pulling 2fdac4cb555aa3c82f9a6d036076d3128bc7d9d0 on update-indexing-for-array-api-2024 into f8c751bf963ffccb3fe12c23a18a99b87b145c2e on master.

coveralls avatar Mar 26 '25 23:03 coveralls

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_78 ran successfully. Passed: 894 Failed: 2 Skipped: 154

github-actions[bot] avatar Mar 31 '25 17:03 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_104 ran successfully. Passed: 894 Failed: 2 Skipped: 154

github-actions[bot] avatar Apr 02 '25 07:04 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_109 ran successfully. Passed: 894 Failed: 2 Skipped: 154

github-actions[bot] avatar Apr 03 '25 02:04 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_110 ran successfully. Passed: 894 Failed: 2 Skipped: 154

github-actions[bot] avatar Apr 03 '25 06:04 github-actions[bot]

@antonwolfy a couple of new tests added, I think PR is ready for another review pass

ndgrigorian avatar Apr 08 '25 01:04 ndgrigorian

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_116 ran successfully. Passed: 894 Failed: 2 Skipped: 154

github-actions[bot] avatar Apr 08 '25 02:04 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_123 ran successfully. Passed: 912 Failed: 2 Skipped: 154

github-actions[bot] avatar Apr 09 '25 04:04 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_126 ran successfully. Passed: 913 Failed: 1 Skipped: 154

github-actions[bot] avatar Apr 09 '25 06:04 github-actions[bot]

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_128 ran successfully. Passed: 912 Failed: 2 Skipped: 154

github-actions[bot] avatar Apr 09 '25 17:04 github-actions[bot]