From c5ed2a71d24935d07c87a4b1d9a26ca60863a037 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 3 Sep 2021 07:02:59 -0500 Subject: [PATCH] Renamed get_sycl_backend method in SyclQueue to backend property Removed name-sake property added to query the underlying sycl_device --- dpctl/_sycl_queue.pyx | 18 ++++++------------ dpctl/tests/test_sycl_queue.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/dpctl/_sycl_queue.pyx b/dpctl/_sycl_queue.pyx index 945fee6f82..de719de049 100644 --- a/dpctl/_sycl_queue.pyx +++ b/dpctl/_sycl_queue.pyx @@ -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: @@ -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 diff --git a/dpctl/tests/test_sycl_queue.py b/dpctl/tests/test_sycl_queue.py index 941746652c..5b978153ae 100644 --- a/dpctl/tests/test_sycl_queue.py +++ b/dpctl/tests/test_sycl_queue.py @@ -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__(): @@ -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(): @@ -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)