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

Feature/improved sycl queue support #1083

Merged
merged 8 commits into from
Jul 11, 2023

Conversation

diptorupd
Copy link
Contributor

@diptorupd diptorupd commented Jun 23, 2023

  • Have you provided a meaningful PR description?

Adds an extra member to the data model used for a DpnpNdArray typed object that will store a DpctlSyclQueueRef pointer. The change makes it possible to extract the sycl queue pointer used to allocate a dpnp.ndarray from the dpnp.ndarray native representation inside numba-dpex.

With the change all dpnp *_like constructor overloads can now use the exact same queue object from the passed in dpnp.ndarray argument if needed.

  • 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?
  • If this PR is a work in progress, are you filing the PR as a draft?

@diptorupd diptorupd requested a review from chudur-budur as a code owner June 23, 2023 22:17
@diptorupd diptorupd marked this pull request as draft June 23, 2023 22:17
@diptorupd diptorupd force-pushed the feature/improved_sycl_queue_support branch from fd04d93 to d7c2405 Compare June 30, 2023 18:49
Diptorup Deb added 2 commits July 1, 2023 01:36
    - Creates a new data model DpnpNdArrayModel to represent
      DpnpNdArray type objects natively.

      The data model differs from numba's ArrayModel by having
      an extra member to store a sycl::queue pointer.

    - Introduces a _usmarraystruct.h header to define the
      C struct for the DpnpNdArrayModel.

    - Renames numba_dpex.core.datamodel.models.ArrayModel to
      USMArrayModel.

    - Updates kernel launcher and parfor lowering functions to
      account for the new data model.
@diptorupd diptorupd force-pushed the feature/improved_sycl_queue_support branch from 5fd5074 to 7b9cccd Compare July 1, 2023 06:43
@diptorupd diptorupd marked this pull request as ready for review July 1, 2023 06:44
    - Updates the *_like overloads to extract the
      sycl_queue for the input array. It was not possible
      previously as the sycl_queue attribute was not present.
    - Update unit tests.
    - Add new unit tests.
@diptorupd diptorupd force-pushed the feature/improved_sycl_queue_support branch from 7b9cccd to 7a5a317 Compare July 1, 2023 07:10
@diptorupd
Copy link
Contributor Author

@chudur-budur The changes are good to go and ready for review.

@diptorupd
Copy link
Contributor Author

ping @chudur-budur

Copy link
Contributor

@chudur-budur chudur-budur left a comment

Choose a reason for hiding this comment

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

Looks good but there are some issues and questions that I think need to be addressed before merge.

numba_dpex/core/datamodel/models.py Show resolved Hide resolved
numba_dpex/core/datamodel/models.py Show resolved Hide resolved
numba_dpex/core/datamodel/models.py Outdated Show resolved Hide resolved
numba_dpex/core/datamodel/models.py Outdated Show resolved Hide resolved
numba_dpex/core/datamodel/models.py Show resolved Hide resolved
numba_dpex/dpnp_iface/_intrinsic.py Show resolved Hide resolved
builder,
sig,
args,
sycl_queue_arg_pos=sycl_queue_arg_pos,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just declare these two values like a constant at the top of the file and use it everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generally, I will like to avoid global variables. I also wish to find a way to not have to do the hard coded variables, just could not find a way out of properly using keyword args.

Diptorup Deb added 2 commits July 6, 2023 23:31
     - Addresses the review comment to pass required arguments to
       _get_queue_ref explicitly.
Copy link
Contributor

@chudur-budur chudur-budur left a comment

Choose a reason for hiding this comment

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

LGTM

@diptorupd diptorupd merged commit 81af300 into main Jul 11, 2023
@diptorupd diptorupd deleted the feature/improved_sycl_queue_support branch July 11, 2023 16:18
github-actions bot added a commit that referenced this pull request Jul 11, 2023
…_support

Feature/improved sycl queue support 81af300
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.

2 participants