Skip to content

Commit 8fbb13b

Browse files
committed
usm bug
1 parent e956642 commit 8fbb13b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dpctl/tests/test_sycl_queue_copy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,20 @@ def test_copy_count_is_in_elements(dtype, element_size):
194194
src = dpctl.memory.MemoryUSMShared(nbytes, queue=q)
195195
dst = dpctl.memory.MemoryUSMShared(nbytes, queue=q)
196196

197+
# USM allocations are uninitialized, so seed dst with a known sentinel
198+
# to verify the untouched half is left intact.
197199
src_mv = memoryview(src)
200+
dst_mv = memoryview(dst)
198201
for i in range(nbytes):
199202
src_mv[i] = i % 256
200-
dst_mv = memoryview(dst)
203+
dst_mv[i] = 0xAA
201204

202205
# Copying half the elements transfers exactly half the bytes.
203206
q.copy(dst, src, num_elements // 2, dtype=dtype)
204207

205208
half_bytes = (num_elements // 2) * element_size
206209
assert dst_mv[:half_bytes].tobytes() == src_mv[:half_bytes].tobytes()
207-
assert dst_mv[half_bytes:nbytes].tobytes() == bytes(nbytes - half_bytes)
210+
assert dst_mv[half_bytes:nbytes].tobytes() == b"\xaa" * (nbytes - half_bytes)
208211

209212

210213
def test_copy_with_invalid_dtype():

0 commit comments

Comments
 (0)