Skip to content

Commit 5621f69

Browse files
committed
task: add more env var documentation
1 parent 7eb75b7 commit 5621f69

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

docs/doc_sources/user_guides/environment_variables.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Environment variables
66

77
Behavior of :py:mod:`dpctl` is affected by :dpcpp_envar:`environment variables <>` that
88
affect DPC++ compiler runtime.
9+
Other relevant environment variables that may not be documented here can be found in:
10+
11+
- `Level Zero <https://intel.github.io/llvm/EnvironmentVariables.html>`_
12+
13+
- `OneAPI <https://oneapi-src.github.io/level-zero-spec/level-zero/latest/core/PROG.html#environment-variables>`_
14+
915

1016
Variable ``ONEAPI_DEVICE_SELECTOR``
1117
-----------------------------------
@@ -50,3 +56,70 @@ The value of the variable is a bit-mask, with the following supported values:
5056
- Enables tracing of PI calls
5157
* - ``-1``
5258
- Enables all levels of tracing
59+
60+
.. _env_var_ze_flat_device_hierarchy:
61+
62+
Variable ``ZE_FLAT_DEVICE_HIERARCHY``
63+
--------------------------
64+
Allows users to define the device hierarchy model exposed by Level Zero driver implementation.
65+
Keep in mind :py:mod:`dpctl.get_composite_devices` will only work while this is set to ``COMBINED``.
66+
67+
.. list-table::
68+
:header-rows: 1
69+
70+
* - Value
71+
- Description
72+
* - ``COMBINED``
73+
- Level Zero devices with multiple tiles will be exposed as a set of root devices, each corresponding to an individual tile. These root devices are component devices, which can be queried for their corresponding composite device, and the composite device can in turn be queried for components. Dedicated composite device APIs will return non-trivial results.
74+
* - ``COMPOSITE``
75+
- Level Zero devices with multiple tiles will be exposed as a singular root device, with tiles accessible as sub-devices.
76+
* - ``FLAT``
77+
- Level Zero devices with multiple tiles will be exposed as a set of root devices, each corresponding to an individual tile. Enabled by default.
78+
79+
Read more about device hierarchy in `Level Zero Specification <https://oneapi-src.github.io/level-zero-spec/level-zero/latest/core/PROG.html#device-hierarchy>`_ and `Intel GPU article <https://www.intel.com/content/www/us/en/developer/articles/technical/flattening-gpu-tile-hierarchy.html>`_.
80+
81+
Variable ``ZE_AFFINITY_MASK``
82+
-------------------------------
83+
Allows users to mask specific devices from being used by SYCL applications.
84+
If we have ``ZE_FLAT_DEVICE_HIERARCHY`` set to ``COMPOSITE``, we can have an AFFINITY of “1” for our application to only see device #1 - making system devices 0, and 2+, invisible.
85+
86+
If we have ``ZE_FLAT_DEVICE_HIERARCHY`` set to ``FLAT``, we can have a ``ZE_AFFINITY_MASK`` of “1” for our application to only see the second tile in the system as logical device #0.
87+
If the system has four dual-tile GPUs installed, this would be the second tile in the first GPU. In ``FLAT`` mode, the numbers use a system-wide-sub-device-number from a flat numbering perspective.
88+
Therefore, we could use the second tile in each of four dual-tile GPUs with ``ZE_AFFINITY_MASK=1,3,5,7``.
89+
90+
If we have ``ZE_FLAT_DEVICE_HIERARCHY`` set to ``COMBINED``, the way tiles and composite devices are exposed depends on the physical devices present and the value of ``ZE_AFFINITY_MASK``:
91+
**If all exposed tiles (as determined by ``ZE_AFFINITY_MASK``) belong to the same physical device:**
92+
- That composite device is available to the application, and each tile is accessible as a component device of that composite device.
93+
94+
**If the exposed tiles belong to different physical devices:**
95+
- A composite device is available for each physical device, and the tiles are accessible as component devices of their respective composite device.
96+
97+
Additional examples to illustrate this are in the detailed documentation for ``ZE_AFFINITY_MASK``, read more about it in `Level Zero Specification <https://oneapi-src.github.io/level-zero-spec/level-zero/latest/core/PROG.html#affinity-mask>`_.
98+
99+
Variable ``ZE_ENABLE_PCI_ID_DEVICE_ORDER``
100+
-------------------------------
101+
Forces driver to report devices from lowest to highest PCI bus ID.
102+
103+
.. list-table::
104+
:header-rows: 1
105+
106+
* - Value
107+
- Description
108+
* - ``0``
109+
- Disabled. Default value.
110+
* - ``1``
111+
- Enabled.
112+
113+
Variable ``ZE_SHARED_FORCE_DEVICE_ALLOC``
114+
-------------------------------
115+
Forces all shared allocations into device memory
116+
117+
.. list-table::
118+
:header-rows: 1
119+
120+
* - Value
121+
- Description
122+
* - ``0``
123+
- Disabled. Default value.
124+
* - ``1``
125+
- Enabled.

dpctl/_sycl_device_factory.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ cpdef list get_composite_devices():
212212
Only available when `ZE_FLAT_DEVICE_HIERARCHY=COMBINED` is set in
213213
the environment, and only for specific Level Zero devices
214214
(i.e., those which expose multiple tiles as root devices).
215+
To read more about `ZE_FLAT_DEVICE_HIERARCHY=COMBINED`,
216+
see :ref:`env_var_ze_flat_device_hierarchy`.
215217
216218
For more information, see:
217219
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_composite_device.asciidoc

0 commit comments

Comments
 (0)