Skip to content

Commit 73a9803

Browse files
committed
Expose more dpctl exceptions: SyclContextCreationError, SyclQueueCreationError, USMAllocationError, ExecutionPlacementError
1 parent 53d1838 commit 73a9803

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

doc/reference/exceptions.rst

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,32 @@ Exceptions
3636
...
3737
DLPackCreationError: to_dlpack_capsule: DLPack can only export arrays based on USM allocations bound to a default platform SYCL context
3838
39-
.. autodata:: SyclDeviceCreationError
39+
.. data:: ExecutionPlacementError
40+
41+
Given when execution placement target can not be unambiguously determined
42+
from input arrays. Make sure that input arrays are associated with the same
43+
:class:`dpctl.SyclQueue`, or migrate data to the same
44+
:class:`dpctl.SyclQueue` using :meth:`dpnp.ndarray.to_device` method.
45+
46+
.. data:: SyclContextCreationError
47+
48+
Given when :class:`dpctl.SyclContext` instance could not created.
49+
50+
.. data:: SyclDeviceCreationError
51+
52+
Given when :class:`dpctl.SyclDevice` instance could not created.
53+
54+
.. data:: SyclQueueCreationError
55+
56+
Given when :class:`dpctl.SyclQueue` instance could not created.
57+
The creation can fail if the filter string is invalid, or the backend or
58+
device type values are not supported.
59+
60+
.. data:: USMAllocationError
61+
62+
Given when Unified Shared Memory (USM) allocation call returns a null
63+
pointer, signaling a failure to perform the allocation.
64+
Some common reasons for allocation failure are:
65+
66+
* insufficient free memory to perform the allocation request
67+
* allocation size exceeds the maximum supported by targeted backend

dpnp/exceptions/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
from dpctl import SyclDeviceCreationError
1+
from dpctl import (
2+
SyclContextCreationError,
3+
SyclDeviceCreationError,
4+
SyclQueueCreationError,
5+
)
6+
from dpctl.memory import USMAllocationError
27
from dpctl.tensor._dlpack import DLPackCreationError
8+
from dpctl.utils import ExecutionPlacementError
39
from numpy.exceptions import AxisError
410

511
__all__ = [
612
"AxisError",
713
"DLPackCreationError",
14+
"ExecutionPlacementError",
815
"SyclDeviceCreationError",
16+
"SyclContextCreationError",
17+
"SyclQueueCreationError",
18+
"USMAllocationError",
919
]

0 commit comments

Comments
 (0)