Skip to content

Conversation

@ndgrigorian
Copy link
Collaborator

This PR proposes permitting the search values of dpt.searchsorted to be Python scalars, a change coming to the 2026 array API spec

Resolves #2224

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

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_104 ran successfully.
Passed: 1114
Failed: 44
Skipped: 82

@ndgrigorian ndgrigorian force-pushed the allow-scalars-searchsorted-search-values branch from b7de201 to e85940e Compare January 6, 2026 06:31
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_104 ran successfully.
Passed: 1115
Failed: 43
Skipped: 82

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_105 ran successfully.
Passed: 1115
Failed: 43
Skipped: 82

@coveralls
Copy link
Collaborator

coveralls commented Jan 6, 2026

Coverage Status

coverage: 86.249% (+0.004%) from 86.245%
when pulling b7c56e1 on allow-scalars-searchsorted-search-values
into 4c57ee7 on master.

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_106 ran successfully.
Passed: 1115
Failed: 43
Skipped: 82

@ndgrigorian ndgrigorian force-pushed the allow-scalars-searchsorted-search-values branch from bda9809 to b7c56e1 Compare January 7, 2026 00:16
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_106 ran successfully.
Passed: 1114
Failed: 44
Skipped: 82

@ndgrigorian ndgrigorian marked this pull request as ready for review January 7, 2026 03:22

if not isinstance(x2, usm_ndarray):
x2 = dpt.asarray(x2, dtype=dt2, usm_type=res_usm_type, sycl_queue=q)
if x2.dtype != dt:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if x2.dtype != dt:
elif x2.dtype != dt:

if x2.dtype != dt:
x2_buf = _empty_like_orderK(x2, dt)
dep_evs = _manager.submitted_events
ht_ev, ev = ti_copy(src=x2, dst=x2_buf, sycl_queue=q, depends=dep_evs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copying x1 and x2 to the buffers might be done in parallel.
While currently it assumes a sequence execution order: x1 must be copied first and then either x2 is cased to usm_ndarray or x2 is copying to the buffer (but always once the x1 copy kernel is completed).

skip_if_dtype_not_supported(dt, q)

x = dpt.zeros(10, dtype=dt, sycl_queue=q)
py_zeros = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to parametrize py_zeros with below values instead of iterating over the loop for sc in py_zeros?

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.

Allow python scalars in the 2nd argument of searchsorted

3 participants