Skip to content

Commit c5e1859

Browse files
committed
Changes to exception messages throughout _dlpack.pyx
1 parent c59362f commit c5e1859

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

dpctl/tensor/_dlpack.pyx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,16 @@ cpdef to_dlpack_versioned_capsule(usm_ndarray usm_ary, bint copied):
397397
if pDRef is not NULL:
398398
DPCTLDevice_Delete(pDRef)
399399
raise DLPackCreationError(
400-
"to_dlpack_capsule: DLPack can only export arrays allocated "
401-
"on non-partitioned SYCL devices on platforms where "
402-
"default_context oneAPI extension is not supported."
400+
"to_dlpack_versioned_capsule: DLPack can only export arrays "
401+
"allocated on non-partitioned SYCL devices on platforms "
402+
"where default_context oneAPI extension is not supported."
403403
)
404404
else:
405405
if not usm_ary.sycl_context == default_context:
406406
raise DLPackCreationError(
407-
"to_dlpack_capsule: DLPack can only export arrays based on USM "
408-
"allocations bound to a default platform SYCL context"
407+
"to_dlpack_versioned_capsule: DLPack can only export arrays "
408+
"based on USM allocations bound to a default platform SYCL "
409+
"context"
409410
)
410411
# Find the unpartitioned parent of the allocation device
411412
pDRef = DPCTLDevice_GetParentDevice(ary_sycl_device.get_device_ref())
@@ -421,20 +422,22 @@ cpdef to_dlpack_versioned_capsule(usm_ndarray usm_ary, bint copied):
421422
device_id = ary_sycl_device.get_overall_ordinal()
422423
if device_id < 0:
423424
raise DLPackCreationError(
424-
"to_dlpack_capsule: failed to determine device_id"
425+
"to_dlpack_versioned_capsule: failed to determine device_id"
425426
)
426427

427428
dlmv_tensor = <DLManagedTensorVersioned *> stdlib.malloc(
428429
sizeof(DLManagedTensorVersioned))
429430
if dlmv_tensor is NULL:
430431
raise MemoryError(
431-
"to_dlpack_capsule: Could not allocate memory for DLManagedTensorVersioned"
432+
"to_dlpack_versioned_capsule: Could not allocate memory "
433+
"for DLManagedTensorVersioned"
432434
)
433435
shape_strides_ptr = <int64_t *>stdlib.malloc((sizeof(int64_t) * 2) * nd)
434436
if shape_strides_ptr is NULL:
435437
stdlib.free(dlmv_tensor)
436438
raise MemoryError(
437-
"to_dlpack_capsule: Could not allocate memory for shape/strides"
439+
"to_dlpack_versioned_capsule: Could not allocate memory "
440+
"for shape/strides"
438441
)
439442
# this can be a separate function for handling shapes and strides
440443
shape_ptr = usm_ary.get_shape()
@@ -530,7 +533,7 @@ cdef class _DLManagedTensorOwner:
530533
cdef class _DLManagedTensorVersionedOwner:
531534
"""
532535
Helper class managing the lifetime of the DLManagedTensorVersioned
533-
struct transferred from a 'dlpack' capsule.
536+
struct transferred from a 'dlpack_versioned' capsule.
534537
"""
535538
cdef DLManagedTensorVersioned *dlmv_tensor
536539

0 commit comments

Comments
 (0)