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

Implement extension for dpnp.choose #2201

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

ndgrigorian
Copy link
Contributor

This PR implements a new SYCL kernel for dpnp.choose in a new extension, _indexing_impl.

choose is an embarrassingly parallel copy operation, where the array to copy from is chosen from a list based on the index in the indices array.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to 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 filing the PR as a draft?

dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch 3 times, most recently from c42f2ae to 8793b54 Compare December 9, 2024 23:08
@ndgrigorian
Copy link
Contributor Author

Tests will need to be added in general, and especially to test_usm_type and test_sycl_queue, but suggestions are committed, as well as existing tests passing, so this PR is ready for first phase of review @antonwolfy

@ndgrigorian ndgrigorian marked this pull request as ready for review December 10, 2024 00:50
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch from 8793b54 to e7f0a0b Compare December 10, 2024 00:54
dpnp/backend/kernels/dpnp_krnl_indexing.cpp Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/dpnp_array.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose_kernel.hpp Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/dpnp_iface_indexing.py Outdated Show resolved Hide resolved
dpnp/tests/test_indexing.py Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch from ed84f7a to 7642045 Compare December 13, 2024 17:24
@coveralls
Copy link
Collaborator

coveralls commented Dec 13, 2024

Coverage Status

coverage: 71.688% (+0.4%) from 71.325%
when pulling ce0e0e3 on ndgrigorian:dedicated-choose-kernel
into 6e9d830 on IntelPython:master.

@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch from 7642045 to efa7e1c Compare December 14, 2024 00:14
dpnp/backend/extensions/indexing/choose_kernel.hpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
dpnp/backend/extensions/indexing/choose.cpp Outdated Show resolved Hide resolved
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch from efa7e1c to 131308f Compare December 26, 2024 18:40
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch 3 times, most recently from a54f420 to 0fb1fdf Compare January 12, 2025 02:13
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch 3 times, most recently from 925b7d8 to dad41e3 Compare January 28, 2025 03:54
ndgrigorian and others added 29 commits February 2, 2025 14:36
Based on suggestions by @AlexanderKalistratov

Create unique_ptr wraps a device allocation, which still needs to be manually freed
after kernel run, but will be deallocated automatically during validation leading
to launch
Removes need for accumulating a list of USM types and queues
Also corrects errors for unexpected dtype to TypeError to match NumPy
Logic now handles 0d inputs to _populate_choose_kernel_params
to avoid dereferencing empty shape and strides of input arrays
Fix spacing in choices type list

Fix spacing in example arrays
py_choose now uses multiple functions to move host data for choose
kernel parameters to the device
@ndgrigorian ndgrigorian force-pushed the dedicated-choose-kernel branch from 6b81516 to ce0e0e3 Compare February 2, 2025 22:36
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.

5 participants