Skip to content

Avoid superfluous copy of dpctl_capi struct #1595

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

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

oleksandr-pavlyk
Copy link
Contributor

This PR eliminates superfluous copying of dpctl_capi instance, even if it is later eliminated by the compiler.

The copying would necessary in static dpctl_capi api = lookup() line, since lookup returns dpctl_capi instance by value.
The change is to make it return a reference.

Since dpctl_capi is a singleton, this change only eliminates a single copy, so consider it a technical debt cleanup change.

The PR also adds a default move assignment operator for dpctl_capi.

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

Copy link

github-actions bot commented Mar 18, 2024

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

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 87.832%. remained the same
when pulling 1b19fb7 on eliminated-uncessary-copies-in-dpctl-capi
into 1fac073 on master.

Copy link

Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_130 ran successfully.
Passed: 906
Failed: 0
Skipped: 94

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!

@oleksandr-pavlyk oleksandr-pavlyk merged commit 6fdc174 into master Mar 18, 2024
@oleksandr-pavlyk oleksandr-pavlyk deleted the eliminated-uncessary-copies-in-dpctl-capi branch March 18, 2024 22:17
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