← Documents Documentation/gpu/amdgpu/gc/mes.rst GitHub 원문 ↗

Linux 6.18.37 · GPU

MicroEngine Scheduler (MES)

AMDGPU MES의 Kernel Queue와 User Queue mapping, preemption, priority, oversubscription 동작을 전문 번역합니다.

Source pathDocumentation/gpu/amdgpu/gc/mes.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

mes.rst:1-38

MES는 GFX pipe의 hardware queue 전환을 요청하고 MQD와 HQD의 mapping을 관리하는 마이크로컨트롤러입니다. Kernel Queue는 HQD에 정적으로 연결되는 현재 기본 legacy 방식이고, User Queue는 userspace가 직접 제출하며 HQD에 동적으로 연결됩니다. MQD가 HQD보다 많으면 MES firmware가 preemption과 time slice 배분으로 oversubscription을 처리합니다.

MES 역할 요약
단계MES 관련 동작
초기화hardware queue마다 생성된 MQD를 firmware가 전달받음
Kernel QueueHQD에 정적으로 mapping되며 preempt되지 않음
User QueueHQD에 동적으로 mapping
초과 수요다른 user queue를 preempt하여 time slice 확보
정책MQD의 mapping, unmapping, priority, oversubscription 처리

초기화, queue 모델, 동적 스케줄링의 책임을 한눈에 정리합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. _amdgpu-mes:
2
3 =============================
4 MicroEngine Scheduler (MES)
5 =============================
6
7 .. note::
8 Queue and ring buffer are used as a synonymous.
9
10 .. note::
11 This section assumes that you are familiar with the concept of Pipes, Queues, and GC.
12 If not, check :ref:`GFX, Compute, and SDMA Overall Behavior<pipes-and-queues-description>`
13 and :ref:`drm/amdgpu - Graphics and Compute (GC) <amdgpu-gc>`.
14
15 Every GFX has a pipe component with one or more hardware queues. Pipes can
16 switch between queues depending on certain conditions, and one of the
17 components that can request a queue switch to a pipe is the MicroEngine
18 Scheduler (MES). Whenever the driver is initialized, it creates one MQD per
19 hardware queue, and then the MQDs are handed to the MES firmware for mapping
20 to:
21
22 1. Kernel Queues (legacy): This queue is statically mapped to HQDs and never
23 preempted. Even though this is a legacy feature, it is the current default, and
24 most existing hardware supports it. When an application submits work to the
25 kernel driver, it submits all of the application command buffers to the kernel
26 queues. The CS IOCTL takes the command buffer from the applications and
27 schedules them on the kernel queue.
28
29 2. User Queues: These queues are dynamically mapped to the HQDs. Regarding the
30 utilization of User Queues, the userspace application will create its user
31 queues and submit work directly to its user queues with no need to IOCTL for
32 each submission and no need to share a single kernel queue.
33
34 In terms of User Queues, MES can dynamically map them to the HQD. If there are
35 more MQDs than HQDs, the MES firmware will preempt other user queues to make
36 sure each queues get a time slice; in other words, MES is a microcontroller
37 that handles the mapping and unmapping of MQDs into HQDs, as well as the
38 priorities and oversubscription of MQDs.
39

3. 한국어 전문 번역

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

용어와 사전 지식

1-13

이 절에서는 Queue와 ring buffer를 동의어로 사용합니다. 같은 대상을 가리키는 두 표현이 번갈아 나타나므로 별개의 구조로 해석하지 않아야 합니다.

또한 Pipes, Queues, GC 개념에 익숙하다는 전제에서 설명합니다. 사전 지식이 필요하면 `GFX, Compute, and SDMA Overall Behavior <pipes-and-queues-description>`와 `drm/amdgpu - Graphics and Compute (GC) <amdgpu-gc>`를 먼저 확인합니다.

MES 문서의 읽기 전제
구분내용
동의어Queue와 ring buffer
선행 개념Pipes, Queues, GC
전체 동작 참조pipes-and-queues-description
GC 참조amdgpu-gc

두 note가 정의하는 용어와 선행 문서를 보존합니다.

선행 문서 탐색
Queue와 ring buffer가 이 절에서 동의어임을 확인pipes-and-queues-description에서 GFX, Compute, SDMA 전체 동작 확인amdgpu-gc에서 Graphics and Compute 블록과 CP 관계 확인MES의 queue mapping과 scheduling 설명으로 이동

MES 세부 동작을 읽기 전에 필요한 개념을 확인하는 순서입니다.

.. _amdgpu-mes:

=============================
 MicroEngine Scheduler (MES)
=============================

.. note::
   Queue and ring buffer are used as a synonymous.

.. note::
   This section assumes that you are familiar with the concept of Pipes, Queues, and GC.
   If not, check :ref:`GFX, Compute, and SDMA Overall Behavior<pipes-and-queues-description>`
   and :ref:`drm/amdgpu - Graphics and Compute (GC) <amdgpu-gc>`.

Kernel Queue와 User Queue

14-32

각 GFX에는 하나 이상의 hardware queue를 가진 pipe 구성요소가 있습니다. Pipe는 특정 조건에 따라 queue 사이를 전환할 수 있으며, pipe에 queue 전환을 요청할 수 있는 구성요소 중 하나가 MicroEngine Scheduler(MES)입니다.

드라이버를 초기화할 때마다 hardware queue마다 하나의 MQD를 생성합니다. 그 MQD들은 mapping을 위해 MES firmware로 전달되고, Kernel Queue 또는 User Queue 방식으로 HQD와 연결됩니다.

Kernel Queue는 legacy 방식입니다. HQD에 정적으로 mapping되고 preempt되지 않습니다. legacy 기능이지만 현재 기본값이며 기존 하드웨어 대부분이 지원합니다. 애플리케이션이 kernel driver에 작업을 제출하면 모든 application command buffer를 kernel queue에 제출하며, CS IOCTL이 그 command buffer를 받아 kernel queue에 schedule합니다.

User Queue는 HQD에 동적으로 mapping됩니다. userspace application이 자신의 user queue를 만들고 그 queue에 직접 작업을 제출합니다. 따라서 제출할 때마다 IOCTL을 사용할 필요가 없고 하나의 kernel queue를 공유할 필요도 없습니다.

두 queue 모델 비교
항목Kernel Queue (legacy)User Queue
HQD mapping정적동적
Preemptionpreempt되지 않음필요할 때 MES firmware가 다른 user queue를 preempt
현재 위치legacy이지만 현재 기본값userspace가 생성하는 queue
제출 경로CS IOCTL이 command buffer를 kernel queue에 scheduleuserspace application이 user queue에 직접 제출
공유 방식애플리케이션 command buffer가 kernel queue로 제출됨하나의 kernel queue를 공유할 필요 없음

원문이 설명하는 mapping, preemption, 제출 경로를 대조합니다.

드라이버 초기화와 queue 연결
각 GFX pipe가 하나 이상의 hardware queue 제공드라이버 초기화 시 hardware queue마다 MQD 하나 생성생성된 MQD를 MES firmware에 전달Kernel Queue는 HQD에 정적으로 mappingUser Queue는 HQD에 동적으로 mapping

hardware queue에서 MES firmware의 mapping 대상으로 이어지는 흐름입니다.


Every GFX has a pipe component with one or more hardware queues. Pipes can
switch between queues depending on certain conditions, and one of the
components that can request a queue switch to a pipe is the MicroEngine
Scheduler (MES). Whenever the driver is initialized, it creates one MQD per
hardware queue, and then the MQDs are handed to the MES firmware for mapping
to:

1. Kernel Queues (legacy): This queue is statically mapped to HQDs and never
   preempted. Even though this is a legacy feature, it is the current default, and
   most existing hardware supports it. When an application submits work to the
   kernel driver, it submits all of the application command buffers to the kernel
   queues. The CS IOCTL takes the command buffer from the applications and
   schedules them on the kernel queue.

2. User Queues: These queues are dynamically mapped to the HQDs. Regarding the
   utilization of User Queues, the userspace application will create its user
   queues and submit work directly to its user queues with no need to IOCTL for
   each submission and no need to share a single kernel queue.

동적 mapping과 oversubscription

33-38

User Queue의 경우 MES가 MQD를 HQD에 동적으로 mapping할 수 있습니다. MQD 수가 HQD 수보다 많으면 MES firmware가 다른 user queue를 preempt하여 각 queue가 time slice를 받도록 합니다.

다시 말해 MES는 MQD를 HQD에 mapping하고 unmapping하는 마이크로컨트롤러입니다. 동시에 MQD의 priority와 oversubscription도 처리합니다. 따라서 MES의 역할은 단순한 queue 연결에 그치지 않고, 제한된 HQD보다 많은 MQD가 존재할 때 실행 기회를 조정하는 데까지 이어집니다.

MQD가 HQD보다 많을 때
User Queue에 대응하는 MQD가 HQD보다 많아짐MES firmware가 현재 mapping 상태와 priority를 고려필요한 경우 다른 user queue를 preemptMQD를 HQD에서 unmapping하고 다른 MQD를 mapping각 queue가 time slice를 받도록 조정

oversubscription 상황에서 MES firmware가 실행 기회를 배분하는 관계입니다.


In terms of User Queues, MES can dynamically map them to the HQD. If there are
more MQDs than HQDs, the MES firmware will preempt other user queues to make
sure each queues get a time slice; in other words, MES is a microcontroller
that handles the mapping and unmapping of MQDs into HQDs, as well as the
priorities and oversubscription of MQDs.