diff --git a/dpctl/memory/_memory.pyx b/dpctl/memory/_memory.pyx index 6a98cf9857..93f69ce548 100644 --- a/dpctl/memory/_memory.pyx +++ b/dpctl/memory/_memory.pyx @@ -295,6 +295,15 @@ cdef class _Memory: def __get__(self): return self.queue.get_sycl_device() + property sycl_queue: + """ + :class:`dpctl.SyclQueue` with :class:`dpctl.SyclContext` the + USM allocation is bound to and :class:`dpctl.SyclDevice` it was + allocated on. + """ + def __get__(self): + return self.queue + def __repr__(self): return ( "" diff --git a/dpctl/tests/test_sycl_usm.py b/dpctl/tests/test_sycl_usm.py index da19c37668..cb1bfe30d4 100644 --- a/dpctl/tests/test_sycl_usm.py +++ b/dpctl/tests/test_sycl_usm.py @@ -59,6 +59,8 @@ def test_memory_create(memory_ctor): assert len(mobj) == nbytes assert mobj.size == nbytes assert mobj._context == queue.sycl_context + assert mobj._queue == queue + assert mobj.sycl_queue == queue assert type(repr(mobj)) is str assert type(bytes(mobj)) is bytes assert sys.getsizeof(mobj) > nbytes @@ -495,7 +497,7 @@ def test_with_constructor(memory_ctor): shape=(64,), strides=(1,), offset=0, - syclobj=buf._queue._get_capsule(), + syclobj=buf.sycl_queue._get_capsule(), ) check_view(v) # Use context capsule