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

Specialize copy_from_numpy_into_usm_ndarray for contig case #1829

Merged
merged 5 commits into from
Sep 12, 2024

Conversation

oleksandr-pavlyk
Copy link
Collaborator

@oleksandr-pavlyk oleksandr-pavlyk commented Sep 10, 2024

Specialize _copy_from_numpy_into_usm_ndarray for contiguous case.

Tensor implementation module temporarily exports both _copy_numpy_into_usm_ndarray_legacy, and
_copy_numpy_into_usm_ndarray functions to performance comparison.

The specialization reuses the same kernel, instantiated with NoOpIndexer, reducing the number of kernel arguments.
It also eliminates small allocation of USM temporaries needed to pass shape/strides information to the general kernel, and the cost of copying from host to these temporary allocations.

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

Copy link

github-actions bot commented Sep 10, 2024

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

for contiguous case.

Tensor implementation module temporarily exports both
_copy_numpy_into_usm_ndarray_legacy, and
_copy_numpy_into_usm_ndarray functions to performance comparison.
@oleksandr-pavlyk oleksandr-pavlyk force-pushed the specialize-1d-case-for-numpy-to-usm-ndarray branch from e043932 to 1869f06 Compare September 10, 2024 15:10
Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_9 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@coveralls
Copy link
Collaborator

coveralls commented Sep 10, 2024

Coverage Status

coverage: 87.907% (+0.01%) from 87.893%
when pulling 33e6c5a on specialize-1d-case-for-numpy-to-usm-ndarray
into f483deb on master.

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_9 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@oleksandr-pavlyk oleksandr-pavlyk marked this pull request as ready for review September 11, 2024 14:16
…ernel

Used unitrace to verify that the contiguous kernel is exercised
in both direct call to asarray (for C-contiguous numpy array) with
type casting, and when assigning to usm-ndarray from numpy of different
data type when both arrays are dense, but strides may be negative.
Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_24 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_25 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@ndgrigorian
Copy link
Collaborator

@oleksandr-pavlyk
Please add the changes to the changelog as well, otherwise this LGTM

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_27 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

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, this is a nice improvement, thank you @oleksandr-pavlyk

@oleksandr-pavlyk oleksandr-pavlyk merged commit 00bb1d1 into master Sep 12, 2024
36 of 48 checks passed
@oleksandr-pavlyk oleksandr-pavlyk deleted the specialize-1d-case-for-numpy-to-usm-ndarray branch September 12, 2024 19:06
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.

3 participants