Skip to content

Commit 72449f8

Browse files
committed
chore: precommit
1 parent aac6293 commit 72449f8

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

dpctl/_sycl_queue.pxd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ cdef public api class SyclQueue (_SyclQueue) [
104104
cpdef memcpy(self, dest, src, size_t count)
105105
cpdef SyclEvent memcpy_async(self, dest, src, size_t count, list dEvents=*)
106106
cpdef copy(self, dest, src, size_t count, str dtype=*)
107-
cpdef SyclEvent copy_async(self, dest, src, size_t count, list dEvents=*, str dtype=*)
107+
cpdef SyclEvent copy_async(
108+
self, dest, src, size_t count, list dEvents=*, str dtype=*
109+
)
108110
cpdef prefetch(self, ptr, size_t count=*)
109111
cpdef mem_advise(self, ptr, size_t count, int mem)
110112
cpdef SyclEvent submit_barrier(self, dependent_events=*)

dpctl/_sycl_queue.pyx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ ctypedef DPCTLSyclEventRef (*queue_copy_fn)(
467467
)
468468

469469
ctypedef DPCTLSyclEventRef (*queue_copy_with_events_fn)(
470-
const DPCTLSyclQueueRef, void*, const void*, size_t, const DPCTLSyclEventRef*, size_t
470+
const DPCTLSyclQueueRef, void*, const void*, size_t,
471+
const DPCTLSyclEventRef*, size_t
471472
)
472473

473474

@@ -511,7 +512,6 @@ cdef DPCTLSyclEventRef _copy_memcpy_impl(
511512
cdef bint dst_is_buf = False
512513
cdef int ret_code = 0
513514
cdef size_t element_size = 0
514-
cdef size_t element_count = 0
515515

516516
if dtype is not None:
517517
element_size = _get_dtype_size(dtype)
@@ -520,7 +520,6 @@ cdef DPCTLSyclEventRef _copy_memcpy_impl(
520520
f"byte_count ({byte_count}) must be a multiple of dtype "
521521
f"element size ({element_size} bytes for '{dtype}')"
522522
)
523-
element_count = byte_count // element_size
524523

525524
if isinstance(src, _Memory):
526525
c_src_ptr = <void*>(<_Memory>src).get_data_ptr()
@@ -1516,8 +1515,9 @@ cdef class SyclQueue(_SyclQueue):
15161515
count (int):
15171516
Number of bytes to copy.
15181517
dtype (str, optional):
1519-
Data type string (e.g., 'i4', 'f8') for typed copy validation.
1520-
If provided, validates that count is a multiple of the element size.
1518+
Data type string (e.g., 'i4', 'f8') for typed copy
1519+
validation. If provided, validates that count is a
1520+
multiple of the element size.
15211521
"""
15221522
cdef DPCTLSyclEventRef ERef = NULL
15231523

@@ -1550,8 +1550,9 @@ cdef class SyclQueue(_SyclQueue):
15501550
dEvents (List[dpctl.SyclEvent], optional):
15511551
Events that this copy depends on.
15521552
dtype (str, optional):
1553-
Data type string (e.g., 'i4', 'f8') for typed copy validation.
1554-
If provided, validates that count is a multiple of the element size.
1553+
Data type string (e.g., 'i4', 'f8') for typed copy
1554+
validation. If provided, validates that count is a
1555+
multiple of the element size.
15551556
Supported types: i1, u1, i2, u2, i4, u4, i8, u8, f4, f8.
15561557
15571558
Returns:

dpctl/tests/test_sycl_queue_copy.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_copy_async_with_dtype_valid():
159159
],
160160
)
161161
def test_copy_with_dtype_invalid_count(dtype, element_size, bad_count):
162-
"""Test that copy raises ValueError when count is not a multiple of dtype size."""
162+
"""Test copy raises ValueError when count isn't a dtype multiple."""
163163
try:
164164
q = dpctl.SyclQueue()
165165
except dpctl.SyclQueueCreationError:
@@ -209,9 +209,10 @@ def test_copy_with_invalid_dtype():
209209
for bad_dtype in invalid_dtypes:
210210
with pytest.raises(ValueError) as cm:
211211
q.copy(dst, src, nbytes, dtype=bad_dtype)
212-
assert "dtype" in str(cm.value).lower() or "unrecognized" in str(
213-
cm.value
214-
).lower()
212+
assert (
213+
"dtype" in str(cm.value).lower()
214+
or "unrecognized" in str(cm.value).lower()
215+
)
215216

216217

217218
def test_copy_with_dtype_host_buffers():

0 commit comments

Comments
 (0)