Skip to content

Commit 59e7d4d

Browse files
authored
Merge pull request #2019 from IntelPython/document-dpctl-enum-types
[Docs] Add documentation for dpctl enums
2 parents 45ab64c + 0984620 commit 59e7d4d

File tree

4 files changed

+61
-8
lines changed

4 files changed

+61
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. _dpctl_constants:
2+
3+
Constants
4+
=========
5+
6+
The following constants are defined in :py:mod:`dpctl`:
7+
8+
.. currentmodule:: dpctl
9+
10+
.. autodata:: device_type
11+
12+
.. autodata:: backend_type
13+
14+
.. autodata:: event_status_type
15+
16+
.. autodata:: global_mem_cache_type

docs/doc_sources/api_reference/dpctl/index.rst

+14
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@
6262
has_cpu_devices
6363
has_accelerator_devices
6464

65+
.. rubric:: Enums
66+
67+
.. list-table::
68+
:widths: 10 50
69+
70+
* - :py:class:`dpctl.device_type`
71+
- An :class:`enum.Enum` of supported SYCL device types.
72+
* - :py:class:`dpctl.backend_type`
73+
- An :class:`enum.Enum` of supported SYCL backends.
74+
* - :py:class:`dpctl.event_status_type`
75+
- An :class:`enum.Enum` of SYCL event states.
76+
* - :py:class:`dpctl.global_mem_cache_type`
77+
- An :class:`enum.Enum` of global memory cache types for a device.
78+
6579
.. rubric:: Exceptions
6680

6781
.. autosummary::

docs/doc_sources/api_reference/dpctl/tensor.constants.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _dpctl_tensor_constants:
22

33
Constants
4-
========================
4+
=========
55

66
The following constants are defined in :py:mod:`dpctl.tensor`:
77

dpctl/enum_types.py

+30-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@
2727

2828
class device_type(Enum):
2929
"""
30-
An enumeration of supported SYCL device types.
30+
An :class:`enum.Enum` of supported SYCL device types.
31+
32+
| ``all``
33+
| ``accelerator``
34+
| ``automatic``
35+
| ``cpu``
36+
| ``custom``
37+
| ``gpu``
3138
3239
:Example:
3340
.. code-block:: python
@@ -54,7 +61,13 @@ class device_type(Enum):
5461

5562
class backend_type(Enum):
5663
"""
57-
An enumeration of supported SYCL backends.
64+
An :class:`enum.Enum` of supported SYCL backends.
65+
66+
| ``all``
67+
| ``cuda``
68+
| ``hip``
69+
| ``level_zero``
70+
| ``opencl``
5871
5972
:Example:
6073
.. code-block:: python
@@ -63,7 +76,7 @@ class backend_type(Enum):
6376
6477
# create a SYCL device with OpenCL backend using filter selector
6578
d = dpctl.SyclDevice("opencl")
66-
print(d.backend)
79+
d.backend
6780
# Possible output: <backend_type.opencl: 5>
6881
"""
6982

@@ -76,14 +89,19 @@ class backend_type(Enum):
7689

7790
class event_status_type(Enum):
7891
"""
79-
An enumeration of SYCL event states.
92+
An :class:`enum.Enum` of SYCL event states.
93+
94+
| ``unknown_status``
95+
| ``submitted``
96+
| ``running``
97+
| ``complete``
8098
8199
:Example:
82100
.. code-block:: python
83101
84102
import dpctl
85103
ev = dpctl.SyclEvent()
86-
print(ev.execution_status )
104+
ev.execution_status
87105
# Possible output: <event_status_type.complete: 4>
88106
"""
89107

@@ -95,14 +113,19 @@ class event_status_type(Enum):
95113

96114
class global_mem_cache_type(Enum):
97115
"""
98-
An enumeration of global memory cache types for a device.
116+
An :class:`enum.Enum` of global memory cache types for a device.
117+
118+
| ``indeterminate``
119+
| ``none``
120+
| ``read_only``
121+
| ``read_write``
99122
100123
:Example:
101124
.. code-block:: python
102125
103126
import dpctl
104127
dev = dpctl.SyclDevice()
105-
print(dev.global_mem_cache_type)
128+
dev.global_mem_cache_type
106129
# Possible output: <global_mem_cache_type.read_write: 4>
107130
"""
108131

0 commit comments

Comments
 (0)