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

Adds boxing and unboxing functionality for dpnp.ndarray to numba_dpex #902

Merged
merged 15 commits into from
Feb 16, 2023

Conversation

diptorupd
Copy link
Contributor

  • Have you provided a meaningful PR description?
    The PR implements the boxing and unboxing routines for a dpnp.ndarray to numba_dpex.
  • 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 marked this pull request as draft February 4, 2023 05:11
@diptorupd diptorupd force-pushed the feature/dpnp_ndarray/box-unbox branch 5 times, most recently from 38083f2 to 14e6d52 Compare February 6, 2023 03:22
@diptorupd diptorupd force-pushed the feature/dpnp_ndarray/box-unbox branch 3 times, most recently from cad9c02 to d8dd46d Compare February 13, 2023 05:05
@diptorupd diptorupd requested a review from DrTodd13 February 13, 2023 05:09
@diptorupd diptorupd marked this pull request as ready for review February 14, 2023 02:35
mingjie-intel and others added 2 commits February 13, 2023 21:20
   - Made all args to the constructor except ndim as optional.
   - If no queue or device is provided then select a default
     queue using dpctl.
   - Select a default dtype using the same logic as dpctl.tensor.
   - Bugfix: make sure the derived dtype is passed to the parent
     Array type's constuctor.
   - Fix tests and examples impacted by UsmNdArray type changes.
   - Skip all dpnp.empty tests for now. These tests will be
     changed once the new implementation for dpnp.empty is
     merged.
   - Adds a Numba type to represent dpctl.SyclQueue and
     infer it as an opaque pointer inside the compiler.
@diptorupd diptorupd force-pushed the feature/dpnp_ndarray/box-unbox branch from 3960fc3 to 19e9b85 Compare February 14, 2023 03:22
mingjie-intel and others added 6 commits February 13, 2023 21:25
   - Copy over needed headers and private functions from Numba's
     nrt_python extesion.
   - Adds a boxing function for dpnp.ndarrays.

        - takes a Numba native arystruct object and creates a
	  dpctl.tensor.usm_ndarray object and then a dpnp.ndarray
	  PyObject and returns it.
	- If the arystruct object had a Numba allocated meminfo
	  pointer, the dpctl.tensor.usm_ndarray uses the meminfo
	  object as its base pointer.
	- If the arystruct object had a parent pointer, i.e., it was
	  created from an externally passed dpnp.ndarray PyObject,
	  returns the parent back instead of creating a new dpnp.ndarray.
  - Adds an unboxing helper function to the _dpexrt_python.c
    for dpnp.ndarray.
  - Implements helper functions to create and destroy
    an NRT_ExternalAllocator object that uses usm allocators.
   - Adds a function to allocate a NRT_MemInfo object's data
     pointer using USM allocators.
   - Adds helpers to generate C calls to dpexrt_python native functions
     directly inside LLVM IR.
   - Registers the helper function in _dpexrt_python so that we can insert
     calls to them via llvmlite.
    - Removes the numba_dpex/core/dpnp_ndarray modules
    - Adds an arrayobj submodule to numba_dpex/dpnp_iface
    - Implements boxing and unboxing for dpnp.ndarrays using
      _dpexrt_python extension.
    - Adds an overload for dpnp.empty to dono_iface/arrayobj.
    - Implement refresh and a dpex target registry.
    - Initialize the dpjit dispacther and runtime sub-modules
      when dpex loads.
    - doxstrings etc.
@diptorupd diptorupd force-pushed the feature/dpnp_ndarray/box-unbox branch from 19e9b85 to 253be29 Compare February 14, 2023 03:25
Added runtime tests.
@diptorupd diptorupd force-pushed the feature/dpnp_ndarray/box-unbox branch 2 times, most recently from 25ebd55 to b554084 Compare February 15, 2023 03:37
Copy link
Contributor

@mingjie-intel mingjie-intel left a comment

Choose a reason for hiding this comment

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

LGTM.

Diptorup Deb and others added 3 commits February 16, 2023 00:38
    - Set PyErr_SetString before returning NULL from
      DPEXRT_sycl_usm_ndarray_to_python_acqref.
    - Add few extra NULL checks.
    - Remove debug prints.
    - Add NRT_debug wrappers to debug prints.
@diptorupd diptorupd force-pushed the feature/dpnp_ndarray/box-unbox branch from ac144f0 to 70e93bc Compare February 16, 2023 07:07
@diptorupd diptorupd merged commit bf10086 into main Feb 16, 2023
@diptorupd diptorupd deleted the feature/dpnp_ndarray/box-unbox branch February 16, 2023 14:52
github-actions bot added a commit that referenced this pull request Feb 16, 2023
Adds boxing and unboxing functionality for dpnp.ndarray to numba_dpex bf10086
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