Skip to content

Commit c9bc3fe

Browse files
authored
Rename _usm_type parameter from context to syclobj (#55)
1 parent 4aae1da commit c9bc3fe

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

dppl/_memory.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,26 @@ cdef class Memory:
7878
return "<Intel(R) USM allocated memory block of {} bytes at {}>" \
7979
.format(self.nbytes, hex(<object>(<Py_ssize_t>self.memory_ptr)))
8080

81-
def _usm_type(self, context=None):
81+
def _usm_type(self, syclobj=None):
8282
cdef const char* kind
8383
cdef SyclContext ctx
8484
cdef SyclQueue q
85-
if context is None:
85+
if syclobj is None:
8686
ctx = self._context
8787
kind = DPPLUSM_GetPointerType(self.memory_ptr,
8888
ctx.get_context_ref())
89-
elif isinstance(context, SyclContext):
90-
ctx = <SyclContext>(context)
89+
elif isinstance(syclobj, SyclContext):
90+
ctx = <SyclContext>(syclobj)
9191
kind = DPPLUSM_GetPointerType(self.memory_ptr,
9292
ctx.get_context_ref())
93-
elif isinstance(context, SyclQueue):
94-
q = <SyclQueue>(context)
93+
elif isinstance(syclobj, SyclQueue):
94+
q = <SyclQueue>(syclobj)
9595
ctx = q.get_sycl_context()
9696
kind = DPPLUSM_GetPointerType(self.memory_ptr,
9797
ctx.get_context_ref())
9898
else:
99-
raise ValueError("sycl_context keyword can be either None, "
100-
"or an instance of dppl.SyclConext")
99+
raise ValueError("syclobj keyword can be either None, "
100+
"or an instance of SyclConext or SyclQueue")
101101
return kind.decode('UTF-8')
102102

103103

dppl/tests/dppl_tests/test_sycl_usm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_memory_cpu_context (self):
5555

5656
current_queue = dppl.get_current_queue()
5757
# type as view from current queue
58-
usm_type = mobj._usm_type(context=current_queue)
58+
usm_type = mobj._usm_type(current_queue)
5959
# type can be unknown if current queue is
6060
# not in the same SYCL context
6161
self.assertTrue(usm_type in ['unknown', 'shared'])
@@ -68,7 +68,7 @@ def test_memory_gpu_context (self):
6868
usm_type = mobj._usm_type()
6969
self.assertEqual(usm_type, 'shared')
7070
current_queue = dppl.get_current_queue()
71-
usm_type = mobj._usm_type(context=current_queue)
71+
usm_type = mobj._usm_type(current_queue)
7272
self.assertTrue(usm_type in ['unknown', 'shared'])
7373

7474

0 commit comments

Comments
 (0)