Skip to content

Commit 5954cfa

Browse files
srishanmalexdeucher
authored andcommitted
drm/amdgpu: Add documentation for enforce isolation feature
This feature enables process isolation on the graphics engine by serializing access to it and adding a cleaner shader which clears LDS (Local Data Store) and GPRs (General Purpose Registers) between jobs. Cc: Christian König <[email protected]> Cc: Alex Deucher <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Suggested-by: Alex Deucher <[email protected]> Suggested-by: Asad Kamal <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 21cae8d commit 5954cfa

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

Documentation/gpu/amdgpu/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures.
1616
thermal
1717
driver-misc
1818
debugging
19+
process-isolation
1920
amdgpu-glossary
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
=========================
4+
AMDGPU Process Isolation
5+
=========================
6+
7+
The AMDGPU driver includes a feature that enables automatic process isolation on the graphics engine. This feature serializes access to the graphics engine and adds a cleaner shader which clears the Local Data Store (LDS) and General Purpose Registers (GPRs) between jobs. All processes using the GPU, including both graphics and compute workloads, are serialized when this feature is enabled. On GPUs that support partitionable graphics engines, this feature can be enabled on a per-partition basis.
8+
9+
In addition, there is an interface to manually run the cleaner shader when the use of the GPU is complete. This may be preferable in some use cases, such as a single-user system where the login manager triggers the cleaner shader when the user logs out.
10+
11+
Process Isolation
12+
=================
13+
14+
The `run_cleaner_shader` and `enforce_isolation` sysfs interfaces allow users to manually execute the cleaner shader and control the process isolation feature, respectively.
15+
16+
Partition Handling
17+
------------------
18+
19+
The `enforce_isolation` file in sysfs can be used to enable process isolation and automatic shader cleanup between processes. On GPUs that support graphics engine partitioning, this can be enabled per partition. The partition and its current setting (0 disabled, 1 enabled) can be read from sysfs. On GPUs that do not support graphics engine partitioning, only a single partition will be present. Writing 1 to the partition position enables enforce isolation, writing 0 disables it.
20+
21+
Example of enabling enforce isolation on a GPU with multiple partitions:
22+
23+
.. code-block:: console
24+
25+
$ echo 1 0 1 0 > /sys/class/drm/card0/device/enforce_isolation
26+
$ cat /sys/class/drm/card0/device/enforce_isolation
27+
1 0 1 0
28+
29+
The output indicates that enforce isolation is enabled on zeroth and second parition and disabled on first and fourth parition.
30+
31+
For devices with a single partition or those that do not support partitions, there will be only one element:
32+
33+
.. code-block:: console
34+
35+
$ echo 1 > /sys/class/drm/card0/device/enforce_isolation
36+
$ cat /sys/class/drm/card0/device/enforce_isolation
37+
1
38+
39+
Cleaner Shader Execution
40+
========================
41+
42+
The driver can trigger a cleaner shader to clean up the LDS and GPR state on the graphics engine. When process isolation is enabled, this happens automatically between processes. In addition, there is a sysfs file to manually trigger cleaner shader execution.
43+
44+
To manually trigger the execution of the cleaner shader, write `0` to the `run_cleaner_shader` sysfs file:
45+
46+
.. code-block:: console
47+
48+
$ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader
49+
50+
For multi-partition devices, you can specify the partition index when triggering the cleaner shader:
51+
52+
.. code-block:: console
53+
54+
$ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 0
55+
$ echo 1 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 1
56+
$ echo 2 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 2
57+
# ... and so on for each partition
58+
59+
This command initiates the cleaner shader, which will run and complete before any new tasks are scheduled on the GPU.

0 commit comments

Comments
 (0)