요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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 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.
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 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.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
AMDGPU process isolation 개요
1-14AMDGPU 드라이버에는 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 기능을 제어합니다.
자동 격리와 수동 정리 인터페이스의 역할을 구분합니다.
기능이 활성화된 동안 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-29sysfs의 `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
`1 0 1 0` 예제의 위치와 상태를 그대로 해석합니다.
쓰기 값과 읽기 결과의 위치가 같은 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-37partition이 하나인 장치 또는 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 장치와 혼동하지 않도록 구분합니다.
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
여러 partition 장치에서는 값이 대상 partition index를 뜻합니다.
명령을 기록한 뒤 새 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.
요약·해설
process-isolation.rst:1-59AMDGPU process isolation은 graphics engine 접근을 직렬화하고 job 사이에 cleaner shader로 LDS와 GPR을 정리합니다. `enforce_isolation`은 partition별 자동 격리를 설정하고, `run_cleaner_shader`는 지정한 partition에서 정리 shader를 수동 실행합니다. 수동 실행은 완료된 뒤에야 GPU의 새 task가 schedule됩니다.
값의 의미가 서로 다르므로 파일별로 해석합니다.