Skip to content

Conversation

@chudur-budur
Copy link
Contributor

It's a follow-up PR of #1007. This fully implements the support of dpctl.SyclQueue() in @dpjit so that

  • A SYCL queue doesn't need to be created every time when memory allocation happens.
  • A single (or cahced) queue can be passed around.
  • Functions like alloc_empty_arrayobj() and intrinsics like _empty_nd_impl() can handle a queue that has been passed down.
  • For the same purpose, the memory allocation c interface function like DPEXRT_MemInfo_alloc() in _dpexrt_python.c takes queue as an argument.

Testing code:

import dpctl
import dpnp
from numba_dpex import dpjit

@dpjit
def func(q1, q2):
    c = dpnp.empty(1, sycl_queue=q1)
    d = dpnp.zeros(1, sycl_queue=q2)
    return c, d

queue1 = dpctl.SyclQueue()
queue2 = dpctl.SyclQueue()
a, b = func(queue1, queue2)
print(a)
print(b)
  • 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?
  • If this PR is a work in progress, are you filing the PR as a draft?

khaled and others added 6 commits May 7, 2023 16:31
    - Enables using the queue keyword for dpnp array constructors.
    - Uses the DpctlSyclQueueRef for memory allocations and remove
      using a filter string to first create a queue.
    - Unit tests.
    - Removes a queue copy during NRTExternalAllocator as the
      ownership of the passed in queue belongs to the
      NRTExternalAllocator and the extra copy introduced a memory
      leak. It is the caller's responsibility to do any queue
      copy if needed.
    - Reverts all superfluous naming changes to reduce the diff.
    - Fixes few docstrings that needed to be updated.
tests/core/types/DpctlSyclQueue

Moved queue comparison functions in _helper.py file.

Moved test_array_creation_errors.py into tests/core/types/USMNdArray
@chudur-budur chudur-budur requested a review from diptorupd as a code owner May 7, 2023 21:33
Disable sycl_queue=queue
@chudur-budur chudur-budur force-pushed the feature/usmndarray-fully-enable-sycl-queue branch from 6aa9782 to c3dd408 Compare May 8, 2023 00:58
@diptorupd
Copy link
Contributor

Closing as the PR is superseded by #1032

@diptorupd diptorupd closed this May 8, 2023
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