Skip to content

Commit a7d255a

Browse files
committed
Changes to exception messages throughout _dlpack.pyx
1 parent a113eaa commit a7d255a

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
@@ -405,15 +405,16 @@ cpdef to_dlpack_versioned_capsule(usm_ndarray usm_ary, bint copied):
405405
if pDRef is not NULL:
406406
DPCTLDevice_Delete(pDRef)
407407
raise DLPackCreationError(
408-
"to_dlpack_capsule: DLPack can only export arrays allocated "
409-
"on non-partitioned SYCL devices on platforms where "
410-
"default_context oneAPI extension is not supported."
408+
"to_dlpack_versioned_capsule: DLPack can only export arrays "
409+
"allocated on non-partitioned SYCL devices on platforms "
410+
"where default_context oneAPI extension is not supported."
411411
)
412412
else:
413413
if not usm_ary.sycl_context == default_context:
414414
raise DLPackCreationError(
415-
"to_dlpack_capsule: DLPack can only export arrays based on USM "
416-
"allocations bound to a default platform SYCL context"
415+
"to_dlpack_versioned_capsule: DLPack can only export arrays "
416+
"based on USM allocations bound to a default platform SYCL "
417+
"context"
417418
)
418419
# Find the unpartitioned parent of the allocation device
419420
pDRef = DPCTLDevice_GetParentDevice(ary_sycl_device.get_device_ref())
@@ -429,20 +430,22 @@ cpdef to_dlpack_versioned_capsule(usm_ndarray usm_ary, bint copied):
429430
device_id = ary_sycl_device.get_overall_ordinal()
430431
if device_id < 0:
431432
raise DLPackCreationError(
432-
"to_dlpack_capsule: failed to determine device_id"
433+
"to_dlpack_versioned_capsule: failed to determine device_id"
433434
)
434435

435436
dlmv_tensor = <DLManagedTensorVersioned *> stdlib.malloc(
436437
sizeof(DLManagedTensorVersioned))
437438
if dlmv_tensor is NULL:
438439
raise MemoryError(
439-
"to_dlpack_capsule: Could not allocate memory for DLManagedTensorVersioned"
440+
"to_dlpack_versioned_capsule: Could not allocate memory "
441+
"for DLManagedTensorVersioned"
440442
)
441443
shape_strides_ptr = <int64_t *>stdlib.malloc((sizeof(int64_t) * 2) * nd)
442444
if shape_strides_ptr is NULL:
443445
stdlib.free(dlmv_tensor)
444446
raise MemoryError(
445-
"to_dlpack_capsule: Could not allocate memory for shape/strides"
447+
"to_dlpack_versioned_capsule: Could not allocate memory "
448+
"for shape/strides"
446449
)
447450
# this can be a separate function for handling shapes and strides
448451
shape_ptr = usm_ary.get_shape()
@@ -538,7 +541,7 @@ cdef class _DLManagedTensorOwner:
538541
cdef class _DLManagedTensorVersionedOwner:
539542
"""
540543
Helper class managing the lifetime of the DLManagedTensorVersioned
541-
struct transferred from a 'dlpack' capsule.
544+
struct transferred from a 'dlpack_versioned' capsule.
542545
"""
543546
cdef DLManagedTensorVersioned *dlmv_tensor
544547

0 commit comments

Comments
 (0)