← Documents Documentation/gpu/amdgpu/process-isolation.rst GitHub 원문 ↗

Linux 6.18.37 · GPU

AMDGPU Process Isolation

AMDGPU graphics engine의 process isolation, partition별 enforce_isolation, cleaner shader 실행을 전문 번역합니다.

Source pathDocumentation/gpu/amdgpu/process-isolation.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

process-isolation.rst:1-59

AMDGPU process isolation은 graphics engine 접근을 직렬화하고 job 사이에 cleaner shader로 LDS와 GPR을 정리합니다. `enforce_isolation`은 partition별 자동 격리를 설정하고, `run_cleaner_shader`는 지정한 partition에서 정리 shader를 수동 실행합니다. 수동 실행은 완료된 뒤에야 GPU의 새 task가 schedule됩니다.

두 sysfs 인터페이스 비교
파일쓰기 값의 의미주요 동작
enforce_isolation각 partition 위치의 0 또는 1process isolation 비활성 또는 활성
run_cleaner_shader실행 대상 partition indexcleaner shader 수동 실행

값의 의미가 서로 다르므로 파일별로 해석합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
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 partition and disabled on first and third partition.
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.
60

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

AMDGPU process isolation 개요

1-14

AMDGPU 드라이버에는 graphics engine에서 자동 process isolation을 활성화하는 기능이 있습니다. 이 기능은 graphics engine 접근을 직렬화하고, job 사이에서 Local Data Store(LDS)와 General Purpose Register(GPR)를 지우는 cleaner shader를 추가합니다.

기능을 활성화하면 graphics workload와 compute workload를 포함하여 GPU를 사용하는 모든 process가 직렬화됩니다. partition 가능한 graphics engine을 지원하는 GPU에서는 partition별로 이 기능을 활성화할 수 있습니다.

GPU 사용이 끝났을 때 cleaner shader를 수동으로 실행하는 인터페이스도 있습니다. 예를 들어 single-user system에서는 사용자가 로그아웃할 때 login manager가 cleaner shader를 실행하게 할 수 있습니다.

`run_cleaner_shader` sysfs 인터페이스는 cleaner shader를 수동으로 실행하고, `enforce_isolation`은 process isolation 기능을 제어합니다.

Process isolation 구성요소
항목역할
접근 직렬화GPU를 사용하는 graphics 및 compute process가 graphics engine을 순차적으로 사용
Cleaner shaderjob 사이에 LDS와 GPR 상태를 지움
enforce_isolationprocess isolation과 process 사이의 자동 shader cleanup 제어
run_cleaner_shadercleaner shader를 수동 실행

자동 격리와 수동 정리 인터페이스의 역할을 구분합니다.

자동 process isolation
GPU process가 graphics 또는 compute 작업 제출graphics engine 접근을 process 단위로 직렬화process 또는 job 경계에서 cleaner shader 실행LDS와 GPR 상태 정리다음 GPU 작업 진행

기능이 활성화된 동안 job과 process 사이에서 적용되는 순서입니다.

.. SPDX-License-Identifier: GPL-2.0

=========================
 AMDGPU Process Isolation
=========================

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.

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.

Process Isolation
=================

The `run_cleaner_shader` and `enforce_isolation` sysfs interfaces allow users to manually execute the cleaner shader and control the process isolation feature, respectively.

여러 partition의 isolation 설정

15-29

sysfs의 `enforce_isolation` 파일을 사용하면 process isolation과 process 사이의 자동 shader cleanup을 활성화할 수 있습니다. graphics engine partitioning을 지원하는 GPU에서는 partition별로 설정할 수 있습니다.

sysfs에서 partition과 현재 설정을 읽을 수 있으며 `0`은 비활성, `1`은 활성 상태입니다. graphics engine partitioning을 지원하지 않는 GPU에서는 partition 하나만 나타납니다. 각 partition 위치에 `1`을 쓰면 enforce isolation이 활성화되고 `0`을 쓰면 비활성화됩니다.

다음 예제는 네 partition의 설정을 `1 0 1 0`으로 기록합니다. 출력도 같은 배열이며 0번과 2번 partition은 활성, 1번과 3번 partition은 비활성임을 뜻합니다.

$ echo 1 0 1 0 > /sys/class/drm/card0/device/enforce_isolation
$ cat /sys/class/drm/card0/device/enforce_isolation
1 0 1 0
Partition 위치별 의미
Partition indexenforce isolation
01활성
10비활성
21활성
30비활성

`1 0 1 0` 예제의 위치와 상태를 그대로 해석합니다.

여러 partition 설정 절차
enforce_isolation에 partition별 0 또는 1 배열 쓰기같은 sysfs 파일 읽기각 위치의 0 또는 1 상태 확인0번과 2번은 활성, 1번과 3번은 비활성으로 적용

쓰기 값과 읽기 결과의 위치가 같은 partition index에 대응합니다.


Partition Handling
------------------

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.

Example of enabling enforce isolation on a GPU with multiple partitions:

.. code-block:: console

    $ echo 1 0 1 0 > /sys/class/drm/card0/device/enforce_isolation
    $ cat /sys/class/drm/card0/device/enforce_isolation
    1 0 1 0

The output indicates that enforce isolation is enabled on zeroth and second partition and disabled on first and third partition.

단일 partition 설정

30-37

partition이 하나인 장치 또는 partition을 지원하지 않는 장치에서는 `enforce_isolation`에 원소 하나만 표시됩니다. `1`을 쓰고 다시 읽었을 때 `1`이 출력되면 해당 단일 partition의 isolation이 활성화된 상태입니다.

$ echo 1 > /sys/class/drm/card0/device/enforce_isolation
$ cat /sys/class/drm/card0/device/enforce_isolation
1
단일 partition 인터페이스
조건쓰기 값읽기 결과
단일 partition 또는 partition 미지원11, isolation 활성
단일 partition 또는 partition 미지원00, isolation 비활성

원소 수와 값의 의미를 여러 partition 장치와 혼동하지 않도록 구분합니다.


For devices with a single partition or those that do not support partitions, there will be only one element:

.. code-block:: console

    $ echo 1 > /sys/class/drm/card0/device/enforce_isolation
    $ cat /sys/class/drm/card0/device/enforce_isolation
    1

Cleaner shader 수동 실행

38-59

드라이버는 graphics engine의 LDS와 GPR 상태를 정리하기 위해 cleaner shader를 실행할 수 있습니다. process isolation이 활성화되어 있으면 process 사이에서 자동으로 실행되며, sysfs 파일을 통해 수동 실행할 수도 있습니다.

cleaner shader를 수동 실행하려면 `run_cleaner_shader` sysfs 파일에 `0`을 씁니다. partition이 여러 개인 장치에서는 실행할 partition index를 이 파일에 쓸 수 있습니다.

$ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader
$ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 0
$ echo 1 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 1
$ echo 2 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 2
# ... and so on for each partition
run_cleaner_shader 쓰기 값
쓰기 값대상
0partition 0
1partition 1
2partition 2
이후 index각 해당 partition

여러 partition 장치에서는 값이 대상 partition index를 뜻합니다.

수동 cleaner shader 실행
run_cleaner_shader에 대상 partition index 쓰기드라이버가 cleaner shader 시작graphics engine의 LDS와 GPR 상태 정리cleaner shader 실행 완료완료 후 GPU에 새 task schedule

명령을 기록한 뒤 새 task가 schedule되기 전까지의 동작입니다.


Cleaner Shader Execution
========================

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.

To manually trigger the execution of the cleaner shader, write `0` to the `run_cleaner_shader` sysfs file:

.. code-block:: console

    $ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader

For multi-partition devices, you can specify the partition index when triggering the cleaner shader:

.. code-block:: console

    $ echo 0 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 0
    $ echo 1 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 1
    $ echo 2 > /sys/class/drm/card0/device/run_cleaner_shader # For partition 2
    # ... and so on for each partition

This command initiates the cleaner shader, which will run and complete before any new tasks are scheduled on the GPU.