Skip to content

Commit

Permalink
Renamed get_sycl_backend method in SyclQueue to backend property
Browse files Browse the repository at this point in the history
Removed name-sake property added to query the underlying sycl_device
  • Loading branch information
oleksandr-pavlyk committed Sep 3, 2021
1 parent c1895f7 commit c5ed2a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
18 changes: 6 additions & 12 deletions dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,12 @@ cdef class SyclQueue(_SyclQueue):
else:
return False

def get_sycl_backend(self):
""" Returns the Sycl backend associated with the queue.
@property
def backend(self):
""" Returns the backend_type enum value for this queue.
Returns:
backend_type: The backend for the queue.
"""
cdef _backend_type BE = DPCTLQueue_GetBackend(self._queue_ref)
if BE == _backend_type._OPENCL:
Expand Down Expand Up @@ -959,16 +963,6 @@ cdef class SyclQueue(_SyclQueue):

return SyclEvent._create(ERef, [])

@property
def backend(self):
"""Returns the backend_type enum value for the device
associated with this queue.
Returns:
backend_type: The backend for the device.
"""
return self.sycl_device.backend

@property
def name(self):
"""Returns the device name for the device
Expand Down
15 changes: 15 additions & 0 deletions dpctl/tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def test_queue_submit_barrier(valid_filter):
ev3.wait()
ev1.wait()
ev2.wait()
with pytest.raises(TypeError):
q.submit_barrier(range(3))


def test_queue__repr__():
Expand Down Expand Up @@ -488,6 +490,11 @@ def test_constructor_many_arg():
dpctl.SyclQueue(None, None, None, None)
with pytest.raises(TypeError):
dpctl.SyclQueue(None, None)
ctx = dpctl.SyclContext()
with pytest.raises(TypeError):
dpctl.SyclQueue(ctx, None)
with pytest.raises(TypeError):
dpctl.SyclQueue(ctx)


def test_queue_wait():
Expand All @@ -510,3 +517,11 @@ def test_queue_memops():
q.memcpy(m1, m2, 512)
q.prefetch(m1, 512)
q.mem_advise(m1, 512, 0)
with pytest.raises(TypeError):
q.memcpy(m1, list(), 512)
with pytest.raises(TypeError):
q.memcpy(list(), m2, 512)
with pytest.raises(TypeError):
q.prefetch(list(), 512)
with pytest.raises(TypeError):
q.mem_advise(list(), 512, 0)

0 comments on commit c5ed2a7

Please sign in to comment.