Skip to content

[Docs] Add documentation for dpctl enums #2019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/doc_sources/api_reference/dpctl/constants.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _dpctl_constants:

Constants
=========

The following constants are defined in :py:mod:`dpctl`:

.. currentmodule:: dpctl

.. autodata:: device_type

.. autodata:: backend_type

.. autodata:: event_status_type

.. autodata:: global_mem_cache_type
14 changes: 14 additions & 0 deletions docs/doc_sources/api_reference/dpctl/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@
has_cpu_devices
has_accelerator_devices

.. rubric:: Enums

.. list-table::
:widths: 10 50

* - :py:class:`dpctl.device_type`
- An :class:`enum.Enum` of supported SYCL device types.
* - :py:class:`dpctl.backend_type`
- An :class:`enum.Enum` of supported SYCL backends.
* - :py:class:`dpctl.event_status_type`
- An :class:`enum.Enum` of SYCL event states.
* - :py:class:`dpctl.global_mem_cache_type`
- An :class:`enum.Enum` of global memory cache types for a device.

.. rubric:: Exceptions

.. autosummary::
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _dpctl_tensor_constants:

Constants
========================
=========

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

Expand Down
37 changes: 30 additions & 7 deletions dpctl/enum_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@

class device_type(Enum):
"""
An enumeration of supported SYCL device types.
An :class:`enum.Enum` of supported SYCL device types.

| ``all``
| ``accelerator``
| ``automatic``
| ``cpu``
| ``custom``
| ``gpu``

:Example:
.. code-block:: python
Expand All @@ -54,7 +61,13 @@ class device_type(Enum):

class backend_type(Enum):
"""
An enumeration of supported SYCL backends.
An :class:`enum.Enum` of supported SYCL backends.

| ``all``
| ``cuda``
| ``hip``
| ``level_zero``
| ``opencl``

:Example:
.. code-block:: python
Expand All @@ -63,7 +76,7 @@ class backend_type(Enum):

# create a SYCL device with OpenCL backend using filter selector
d = dpctl.SyclDevice("opencl")
print(d.backend)
d.backend
# Possible output: <backend_type.opencl: 5>
"""

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

class event_status_type(Enum):
"""
An enumeration of SYCL event states.
An :class:`enum.Enum` of SYCL event states.

| ``unknown_status``
| ``submitted``
| ``running``
| ``complete``

:Example:
.. code-block:: python

import dpctl
ev = dpctl.SyclEvent()
print(ev.execution_status )
ev.execution_status
# Possible output: <event_status_type.complete: 4>
"""

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

class global_mem_cache_type(Enum):
"""
An enumeration of global memory cache types for a device.
An :class:`enum.Enum` of global memory cache types for a device.

| ``indeterminate``
| ``none``
| ``read_only``
| ``read_write``

:Example:
.. code-block:: python

import dpctl
dev = dpctl.SyclDevice()
print(dev.global_mem_cache_type)
dev.global_mem_cache_type
# Possible output: <global_mem_cache_type.read_write: 4>
"""

Expand Down
Loading