← Documents Documentation/accel/amdxdna/amdnpu.rst GitHub 원문 ↗

Linux 6.18.37 · Compute accelerators / AMD XDNA

AMD NPU

AMD XDNA Array, ERT·MERT firmware contexts, PCIe/mailbox, mixed scheduling, application binaries와 workload 실행·boot·error 흐름을 설명합니다.

Source pathDocumentation/accel/amdxdna/amdnpu.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

XDNA hardware

amdnpu.rst:1-118

Tile array와 shared L2, microcontroller, ERT·MERT mailbox, PCIe BAR와 PASID 기반 process isolation을 설명합니다.

Scheduling과 workload

amdnpu.rst:119-209

Resource Solver가 spatial·temporal partition을 배치하고 overlay·ctrlcode·special buffer를 이용해 workload를 실행합니다.

Boot와 runtime service

amdnpu.rst:210-281

Signed firmware boot, compiler·XRT stack, DMA opcode, privileged error capture와 telemetry를 정리합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0-only
2
3 .. include:: <isonum.txt>
4
5 =========
6 AMD NPU
7 =========
8
9 :Copyright: |copy| 2024 Advanced Micro Devices, Inc.
10 :Author: Sonal Santan <sonal.santan@amd.com>
11
12 Overview
13 ========
14
15 AMD NPU (Neural Processing Unit) is a multi-user AI inference accelerator
16 integrated into AMD client APU. NPU enables efficient execution of Machine
17 Learning applications like CNN, LLM, etc. NPU is based on
18 `AMD XDNA Architecture`_. NPU is managed by **amdxdna** driver.
19
20
21 Hardware Description
22 ====================
23
24 AMD NPU consists of the following hardware components:
25
26 AMD XDNA Array
27 --------------
28
29 AMD XDNA Array comprises of 2D array of compute and memory tiles built with
30 `AMD AI Engine Technology`_. Each column has 4 rows of compute tiles and 1
31 row of memory tile. Each compute tile contains a VLIW processor with its own
32 dedicated program and data memory. The memory tile acts as L2 memory. The 2D
33 array can be partitioned at a column boundary creating a spatially isolated
34 partition which can be bound to a workload context.
35
36 Each column also has dedicated DMA engines to move data between host DDR and
37 memory tile.
38
39 AMD Phoenix and AMD Hawk Point client NPU have a 4x5 topology, i.e., 4 rows of
40 compute tiles arranged into 5 columns. AMD Strix Point client APU have 4x8
41 topology, i.e., 4 rows of compute tiles arranged into 8 columns.
42
43 Shared L2 Memory
44 ----------------
45
46 The single row of memory tiles create a pool of software managed on chip L2
47 memory. DMA engines are used to move data between host DDR and memory tiles.
48 AMD Phoenix and AMD Hawk Point NPUs have a total of 2560 KB of L2 memory.
49 AMD Strix Point NPU has a total of 4096 KB of L2 memory.
50
51 Microcontroller
52 ---------------
53
54 A microcontroller runs NPU Firmware which is responsible for command processing,
55 XDNA Array partition setup, XDNA Array configuration, workload context
56 management and workload orchestration.
57
58 NPU Firmware uses a dedicated instance of an isolated non-privileged context
59 called ERT to service each workload context. ERT is also used to execute user
60 provided ``ctrlcode`` associated with the workload context.
61
62 NPU Firmware uses a single isolated privileged context called MERT to service
63 management commands from the amdxdna driver.
64
65 Mailboxes
66 ---------
67
68 The microcontroller and amdxdna driver use a privileged channel for management
69 tasks like setting up of contexts, telemetry, query, error handling, setting up
70 user channel, etc. As mentioned before, privileged channel requests are
71 serviced by MERT. The privileged channel is bound to a single mailbox.
72
73 The microcontroller and amdxdna driver use a dedicated user channel per
74 workload context. The user channel is primarily used for submitting work to
75 the NPU. As mentioned before, a user channel requests are serviced by an
76 instance of ERT. Each user channel is bound to its own dedicated mailbox.
77
78 PCIe EP
79 -------
80
81 NPU is visible to the x86 host CPU as a PCIe device with multiple BARs and some
82 MSI-X interrupt vectors. NPU uses a dedicated high bandwidth SoC level fabric
83 for reading or writing into host memory. Each instance of ERT gets its own
84 dedicated MSI-X interrupt. MERT gets a single instance of MSI-X interrupt.
85
86 The number of PCIe BARs varies depending on the specific device. Based on their
87 functions, PCIe BARs can generally be categorized into the following types.
88
89 * PSP BAR: Expose the AMD PSP (Platform Security Processor) function
90 * SMU BAR: Expose the AMD SMU (System Management Unit) function
91 * SRAM BAR: Expose ring buffers for the mailbox
92 * Mailbox BAR: Expose the mailbox control registers (head, tail and ISR
93 registers etc.)
94 * Public Register BAR: Expose public registers
95
96 On specific devices, the above-mentioned BAR type might be combined into a
97 single physical PCIe BAR. Or a module might require two physical PCIe BARs to
98 be fully functional. For example,
99
100 * On AMD Phoenix device, PSP, SMU, Public Register BARs are on PCIe BAR index 0.
101 * On AMD Strix Point device, Mailbox and Public Register BARs are on PCIe BAR
102 index 0. The PSP has some registers in PCIe BAR index 0 (Public Register BAR)
103 and PCIe BAR index 4 (PSP BAR).
104
105 Process Isolation Hardware
106 --------------------------
107
108 As explained before, XDNA Array can be dynamically divided into isolated
109 spatial partitions, each of which may have one or more columns. The spatial
110 partition is setup by programming the column isolation registers by the
111 microcontroller. Each spatial partition is associated with a PASID which is
112 also programmed by the microcontroller. Hence multiple spatial partitions in
113 the NPU can make concurrent host access protected by PASID.
114
115 The NPU FW itself uses microcontroller MMU enforced isolated contexts for
116 servicing user and privileged channel requests.
117
118
119 Mixed Spatial and Temporal Scheduling
120 =====================================
121
122 AMD XDNA architecture supports mixed spatial and temporal (time sharing)
123 scheduling of 2D array. This means that spatial partitions may be setup and
124 torn down dynamically to accommodate various workloads. A *spatial* partition
125 may be *exclusively* bound to one workload context while another partition may
126 be *temporarily* bound to more than one workload contexts. The microcontroller
127 updates the PASID for a temporarily shared partition to match the context that
128 has been bound to the partition at any moment.
129
130 Resource Solver
131 ---------------
132
133 The Resource Solver component of the amdxdna driver manages the allocation
134 of 2D array among various workloads. Every workload describes the number
135 of columns required to run the NPU binary in its metadata. The Resource Solver
136 component uses hints passed by the workload and its own heuristics to
137 decide 2D array (re)partition strategy and mapping of workloads for spatial and
138 temporal sharing of columns. The FW enforces the context-to-column(s) resource
139 binding decisions made by the Resource Solver.
140
141 AMD Phoenix and AMD Hawk Point client NPU can support 6 concurrent workload
142 contexts. AMD Strix Point can support 16 concurrent workload contexts.
143
144
145 Application Binaries
146 ====================
147
148 A NPU application workload is comprised of two separate binaries which are
149 generated by the NPU compiler.
150
151 1. AMD XDNA Array overlay, which is used to configure a NPU spatial partition.
152 The overlay contains instructions for setting up the stream switch
153 configuration and ELF for the compute tiles. The overlay is loaded on the
154 spatial partition bound to the workload by the associated ERT instance.
155 Refer to the
156 `Versal Adaptive SoC AIE-ML Architecture Manual (AM020)`_ for more details.
157
158 2. ``ctrlcode``, used for orchestrating the overlay loaded on the spatial
159 partition. ``ctrlcode`` is executed by the ERT running in protected mode on
160 the microcontroller in the context of the workload. ``ctrlcode`` is made up
161 of a sequence of opcodes named ``XAie_TxnOpcode``. Refer to the
162 `AI Engine Run Time`_ for more details.
163
164
165 Special Host Buffers
166 ====================
167
168 Per-context Instruction Buffer
169 ------------------------------
170
171 Every workload context uses a host resident 64 MB buffer which is memory
172 mapped into the ERT instance created to service the workload. The ``ctrlcode``
173 used by the workload is copied into this special memory. This buffer is
174 protected by PASID like all other input/output buffers used by that workload.
175 Instruction buffer is also mapped into the user space of the workload.
176
177 Global Privileged Buffer
178 ------------------------
179
180 In addition, the driver also allocates a single buffer for maintenance tasks
181 like recording errors from MERT. This global buffer uses the global IOMMU
182 domain and is only accessible by MERT.
183
184
185 High-level Use Flow
186 ===================
187
188 Here are the steps to run a workload on AMD NPU:
189
190 1. Compile the workload into an overlay and a ``ctrlcode`` binary.
191 2. Userspace opens a context in the driver and provides the overlay.
192 3. The driver checks with the Resource Solver for provisioning a set of columns
193 for the workload.
194 4. The driver then asks MERT to create a context on the device with the desired
195 columns.
196 5. MERT then creates an instance of ERT. MERT also maps the Instruction Buffer
197 into ERT memory.
198 6. The userspace then copies the ``ctrlcode`` to the Instruction Buffer.
199 7. Userspace then creates a command buffer with pointers to input, output, and
200 instruction buffer; it then submits command buffer with the driver and goes
201 to sleep waiting for completion.
202 8. The driver sends the command over the Mailbox to ERT.
203 9. ERT *executes* the ``ctrlcode`` in the instruction buffer.
204 10. Execution of the ``ctrlcode`` kicks off DMAs to and from the host DDR while
205 AMD XDNA Array is running.
206 11. When ERT reaches end of ``ctrlcode``, it raises an MSI-X to send completion
207 signal to the driver which then wakes up the waiting workload.
208
209
210 Boot Flow
211 =========
212
213 amdxdna driver uses PSP to securely load signed NPU FW and kick off the boot
214 of the NPU microcontroller. amdxdna driver then waits for the alive signal in
215 a special location on BAR 0. The NPU is switched off during SoC suspend and
216 turned on after resume where the NPU FW is reloaded, and the handshake is
217 performed again.
218
219
220 Userspace components
221 ====================
222
223 Compiler
224 --------
225
226 Peano is an LLVM based open-source single core compiler for AMD XDNA Array
227 compute tile. Peano is available at:
228 https://github.com/Xilinx/llvm-aie
229
230 IRON is an open-source array compiler for AMD XDNA Array based NPU which uses
231 Peano underneath. IRON is available at:
232 https://github.com/Xilinx/mlir-aie
233
234 Usermode Driver (UMD)
235 ---------------------
236
237 The open-source XRT runtime stack interfaces with amdxdna kernel driver. XRT
238 can be found at:
239 https://github.com/Xilinx/XRT
240
241 The open-source XRT shim for NPU is can be found at:
242 https://github.com/amd/xdna-driver
243
244
245 DMA Operation
246 =============
247
248 DMA operation instructions are encoded in the ``ctrlcode`` as
249 ``XAIE_IO_BLOCKWRITE`` opcode. When ERT executes ``XAIE_IO_BLOCKWRITE``, DMA
250 operations between host DDR and L2 memory are effected.
251
252
253 Error Handling
254 ==============
255
256 When MERT detects an error in AMD XDNA Array, it pauses execution for that
257 workload context and sends an asynchronous message to the driver over the
258 privileged channel. The driver then sends a buffer pointer to MERT to capture
259 the register states for the partition bound to faulting workload context. The
260 driver then decodes the error by reading the contents of the buffer pointer.
261
262
263 Telemetry
264 =========
265
266 MERT can report various kinds of telemetry information like the following:
267
268 * L1 interrupt counter
269 * DMA counter
270 * Deep Sleep counter
271 * etc.
272
273
274 References
275 ==========
276
277 - `AMD XDNA Architecture <https://www.amd.com/en/technologies/xdna.html>`_
278 - `AMD AI Engine Technology <https://www.xilinx.com/products/technology/ai-engine.html>`_
279 - `Peano <https://github.com/Xilinx/llvm-aie>`_
280 - `Versal Adaptive SoC AIE-ML Architecture Manual (AM020) <https://docs.amd.com/r/en-US/am020-versal-aie-ml>`_
281 - `AI Engine Run Time <https://github.com/Xilinx/aie-rt/tree/release/main_aig>`_
282

3. 한국어 전문 번역

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

문서 표제와 저작권

1-10

이 문서는 `GPL-2.0-only`로 배포되는 AMD NPU 설명서이며 `isonum.txt`를 포함합니다. 저작권은 2024 Advanced Micro Devices, Inc.에 있고 저자는 Sonal Santan <sonal.santan@amd.com>입니다.

.. SPDX-License-Identifier: GPL-2.0-only
.. include:: <isonum.txt>
AMD NPU
:Copyright: |copy| 2024 Advanced Micro Devices, Inc.
:Author: Sonal Santan <sonal.santan@amd.com>

개요

11-19

AMD NPU(Neural Processing Unit)는 AMD client APU에 통합된 multi-user AI inference accelerator입니다. CNN, LLM 등의 Machine Learning application을 효율적으로 실행하며 `AMD XDNA Architecture`를 기반으로 합니다. NPU는 `amdxdna` driver가 관리합니다.

AMD XDNA Array

20-42

AMD NPU의 XDNA Array는 `AMD AI Engine Technology`로 만든 compute tile과 memory tile의 2D array입니다. 각 column에는 compute tile 4개 row와 memory tile 1개 row가 있습니다. 각 compute tile에는 전용 program memory와 data memory를 가진 VLIW processor가 있고 memory tile은 L2 memory로 동작합니다.

2D array는 column 경계에서 나누어 spatially isolated partition을 만들 수 있고 partition은 workload context에 bind됩니다. 각 column의 전용 DMA engine은 host DDR와 memory tile 사이에서 data를 이동합니다. Phoenix와 Hawk Point client NPU는 compute tile 4개 row와 5개 column의 `4x5` topology이고 Strix Point client APU는 4개 row와 8개 column의 `4x8` topology입니다.

AMD XDNA Array topology
Device familyTopologyPer-column structure
Phoenix / Hawk Point4x54 compute rows + 1 memory row
Strix Point4x84 compute rows + 1 memory row

각 세대의 compute-array column 수와 공통 tile 구성을 비교합니다.

공유 L2 memory

43-50

Memory tile 한 row는 software가 관리하는 on-chip L2 memory pool을 만듭니다. DMA engine이 host DDR와 memory tile 사이의 data를 이동합니다. Phoenix와 Hawk Point NPU의 L2 memory 총량은 `2560 KB`, Strix Point NPU의 총량은 `4096 KB`입니다.

On-chip L2 capacity
NPUTotal L2 memory
Phoenix / Hawk Point2560 KB
Strix Point4096 KB

Memory-tile row가 제공하는 software-managed L2 pool입니다.

Microcontroller와 firmware context

51-64

Microcontroller에서 실행되는 NPU Firmware는 command 처리, XDNA Array partition 설정과 구성, workload context 관리와 workload orchestration을 담당합니다.

NPU Firmware는 workload context마다 isolated non-privileged context인 ERT 전용 instance를 사용합니다. ERT는 workload context와 연결된 사용자의 `ctrlcode`도 실행합니다. Management command는 하나의 isolated privileged context인 MERT가 `amdxdna` driver를 대신해 처리합니다.

Firmware execution contexts
ContextPrivilegeMultiplicityRole
ERTNon-privilegedOne per workload contextWork submission and ctrlcode
MERTPrivilegedSingleDriver management commands

User workload와 privileged management를 서로 다른 context로 격리합니다.

Privileged channel과 user channel

65-77

Microcontroller와 `amdxdna` driver는 context 설정, telemetry, query, error handling, user channel 설정 등의 management task에 privileged channel을 사용합니다. 이 request는 MERT가 처리하며 privileged channel은 mailbox 하나에 bind됩니다.

각 workload context에는 NPU work submit에 주로 쓰는 전용 user channel이 있습니다. User channel request는 해당 ERT instance가 처리하며 channel마다 고유한 mailbox 하나에 bind됩니다.

Mailbox channel routing
amdxdna management requestPrivileged channelSingle mailboxMERT
Workload commandPer-context user channelDedicated mailboxERT instance

Management와 workload traffic이 별도의 execution context와 mailbox로 향합니다.

PCIe endpoint와 BAR

78-104

NPU는 x86 host CPU에 여러 BAR와 일부 MSI-X interrupt vector를 가진 PCIe device로 보입니다. Host memory read/write에는 전용 high-bandwidth SoC fabric을 사용합니다. ERT instance마다 전용 MSI-X interrupt가 하나씩 있고 MERT에는 MSI-X interrupt instance 하나가 있습니다.

PCIe BAR 수는 device에 따라 다릅니다. 기능별 분류는 AMD PSP(Platform Security Processor)를 노출하는 PSP BAR, AMD SMU(System Management Unit)를 노출하는 SMU BAR, mailbox ring buffer를 노출하는 SRAM BAR, head·tail·ISR 등의 mailbox control register를 노출하는 Mailbox BAR, public register를 노출하는 Public Register BAR입니다.

Device에 따라 여러 BAR type이 하나의 physical PCIe BAR에 합쳐지거나 module 하나가 완전히 동작하는 데 physical BAR 두 개가 필요할 수 있습니다. Phoenix에서는 PSP, SMU, Public Register BAR가 PCIe BAR index 0에 있습니다. Strix Point에서는 Mailbox와 Public Register BAR가 index 0에 있고 PSP register 일부는 index 0(Public Register BAR), 나머지는 index 4(PSP BAR)에 있습니다.

PCIe BAR functional types
BAR typeExposed function
PSP BARAMD Platform Security Processor
SMU BARAMD System Management Unit
SRAM BARMailbox ring buffers
Mailbox BARHead, tail, ISR and control registers
Public Register BARPublic registers

Physical BAR 배치는 device별로 결합되거나 분할될 수 있습니다.

Process isolation hardware

105-118

XDNA Array는 column 하나 이상으로 이루어진 isolated spatial partition들로 동적으로 나눌 수 있습니다. Microcontroller가 column isolation register를 programming해 partition을 설정하고 각 partition에 연관된 PASID도 programming합니다. 따라서 NPU의 여러 spatial partition은 PASID로 보호된 host access를 동시에 수행할 수 있습니다.

NPU Firmware 자체는 user channel과 privileged channel request를 처리할 때 microcontroller MMU가 강제하는 isolated context를 사용합니다.

Spatial·temporal scheduling과 Resource Solver

119-144

AMD XDNA architecture는 2D array의 mixed spatial scheduling과 temporal(time sharing) scheduling을 지원합니다. 다양한 workload에 맞춰 spatial partition을 동적으로 만들고 제거할 수 있습니다. Spatial partition 하나를 workload context 하나에 exclusive하게 bind할 수도 있고, 다른 partition을 둘 이상의 workload context가 시간에 따라 잠시 공유할 수도 있습니다. Microcontroller는 일시 공유 partition의 PASID를 그 순간 bind된 context와 일치하도록 갱신합니다.

`amdxdna` driver의 Resource Solver는 workload 사이의 2D array 할당을 관리합니다. 각 workload metadata는 NPU binary 실행에 필요한 column 수를 기술합니다. Solver는 workload hint와 자체 heuristic으로 2D array (재)partition 전략, spatial·temporal column sharing을 위한 workload mapping을 결정합니다. Firmware는 Solver가 정한 context-to-column(s) resource binding을 강제합니다. Phoenix와 Hawk Point는 concurrent workload context 6개, Strix Point는 16개를 지원합니다.

Resource Solver scheduling
Read required column count from workload metadataCombine workload hints and driver heuristicsChoose repartition and spatial/temporal mappingFirmware enforces context-to-column(s) binding
Temporally shared partitionSelect currently bound contextMicrocontroller updates PASID

Workload 요구와 hint에서 partition binding까지의 결정 흐름입니다.

Application binaries

145-164

NPU compiler가 만드는 application workload는 서로 분리된 binary 두 개로 구성됩니다. 첫째, AMD XDNA Array overlay는 NPU spatial partition을 구성합니다. Overlay에는 stream switch 설정 instruction과 compute tile용 ELF가 들어 있으며 workload에 bind된 spatial partition에 연관 ERT instance가 load합니다. 자세한 내용은 `Versal Adaptive SoC AIE-ML Architecture Manual (AM020)`을 참조합니다.

둘째, `ctrlcode`는 spatial partition에 load된 overlay를 orchestration합니다. Workload context에서 microcontroller의 protected mode로 실행되는 ERT가 `ctrlcode`를 실행합니다. `ctrlcode`는 `XAie_TxnOpcode`라는 opcode sequence로 구성되며 자세한 내용은 `AI Engine Run Time`을 참조합니다.

NPU workload binaries
BinaryContentsExecution/loading
XDNA Array overlayStream-switch setup and compute-tile ELFERT loads onto spatial partition
ctrlcodeXAie_TxnOpcode sequenceERT executes in protected mode

Configuration binary와 orchestration binary의 역할을 구분합니다.

Special host buffers

165-184

각 workload context는 자신을 처리하는 ERT instance에 memory-map된 host-resident `64 MB` instruction buffer를 사용합니다. Workload의 `ctrlcode`를 이 special memory에 복사합니다. 다른 input/output buffer와 마찬가지로 PASID로 보호되며 workload userspace에도 map됩니다.

Driver는 MERT의 error 기록 같은 maintenance task를 위해 global privileged buffer 하나도 할당합니다. 이 global buffer는 global IOMMU domain을 사용하며 MERT만 접근할 수 있습니다.

Special host buffer isolation
BufferMapping/domainAccessPurpose
Instruction Buffer (64 MB)ERT + workload userspace; PASIDOne workload contextctrlcode
Global privileged bufferGlobal IOMMU domainMERT onlyMaintenance and error capture

Per-context user buffer와 global privileged buffer의 보호 범위를 비교합니다.

Workload 실행 흐름

185-209

AMD NPU workload는 다음 순서로 실행합니다. (1) workload를 overlay와 `ctrlcode` binary로 compile합니다. (2) Userspace가 driver context를 열고 overlay를 제공합니다. (3) Driver가 Resource Solver에 필요한 column provision을 요청합니다. (4) Driver가 MERT에 원하는 column을 가진 device context 생성을 요청합니다. (5) MERT가 ERT instance를 만들고 Instruction Buffer를 ERT memory에 map합니다.

(6) Userspace가 `ctrlcode`를 Instruction Buffer에 복사합니다. (7) Input, output, instruction buffer pointer를 가진 command buffer를 만들어 driver에 submit한 뒤 completion을 기다리며 sleep합니다. (8) Driver가 Mailbox로 ERT에 command를 보냅니다. (9) ERT가 instruction buffer의 `ctrlcode`를 실행합니다. (10) `ctrlcode` 실행이 AMD XDNA Array 동작 중 host DDR와의 DMA를 시작합니다. (11) ERT가 `ctrlcode` 끝에 도달하면 MSI-X로 driver에 completion signal을 보내고 driver는 기다리던 workload를 깨웁니다.

AMD NPU high-level use flow
1 Compile overlay + ctrlcode2 Open context and provide overlay3 Resource Solver provisions columns4 MERT creates device context5 MERT creates ERT and maps Instruction Buffer
6 Copy ctrlcode7 Submit command buffer and sleep8 Driver sends mailbox command9 ERT executes ctrlcode10 DMA runs with XDNA Array11 MSI-X completion wakes workload

Compilation부터 ERT completion interrupt까지의 11단계입니다.

Boot와 suspend/resume

210-219

`amdxdna` driver는 PSP를 사용해 signed NPU Firmware를 secure하게 load하고 NPU microcontroller boot를 시작합니다. 이후 BAR 0의 special location에서 alive signal을 기다립니다. SoC suspend 동안 NPU를 끄고 resume 후 다시 켜며, 이때 NPU Firmware를 다시 load하고 handshake도 다시 수행합니다.

NPU boot handshake
PSP verifies and loads signed NPU FWStart microcontrollerWait for alive signal on BAR 0
SoC suspendPower NPU offResumeReload NPU FW and repeat handshake

Initial boot와 resume가 같은 firmware load·alive handshake를 수행합니다.

Compiler와 usermode driver

220-244

Peano는 AMD XDNA Array compute tile용 LLVM 기반 open-source single-core compiler이며 `https://github.com/Xilinx/llvm-aie`에서 제공합니다. IRON은 Peano를 내부적으로 사용하는 AMD XDNA Array 기반 NPU용 open-source array compiler이며 `https://github.com/Xilinx/mlir-aie`에서 제공합니다.

Open-source XRT runtime stack은 `amdxdna` kernel driver와 interface하며 `https://github.com/Xilinx/XRT`에서 제공합니다. NPU용 open-source XRT shim은 `https://github.com/amd/xdna-driver`에서 제공합니다.

AMD NPU userspace stack
ComponentRoleRepository
PeanoLLVM-based compute-tile compilergithub.com/Xilinx/llvm-aie
IRONXDNA array compiler using Peanogithub.com/Xilinx/mlir-aie
XRTRuntime stack for amdxdnagithub.com/Xilinx/XRT
XRT NPU shimNPU userspace shimgithub.com/amd/xdna-driver

Compilation과 runtime components 및 upstream locations입니다.

DMA operation

245-252

DMA operation instruction은 `ctrlcode` 안에 `XAIE_IO_BLOCKWRITE` opcode로 encode됩니다. ERT가 `XAIE_IO_BLOCKWRITE`를 실행하면 host DDR와 L2 memory 사이의 DMA operation이 수행됩니다.

Error handling

253-262

MERT가 AMD XDNA Array error를 감지하면 해당 workload context의 실행을 pause하고 privileged channel을 통해 driver에 asynchronous message를 보냅니다. Driver는 faulting workload context에 bind된 partition의 register state를 capture하도록 MERT에 buffer pointer를 보냅니다. 이후 driver는 그 buffer 내용을 읽어 error를 decode합니다.

XDNA Array error capture
MERT detects array errorPause faulting workload contextNotify driver over privileged channelDriver supplies buffer pointerMERT captures partition registersDriver decodes buffer

Fault detection에서 register-state decoding까지의 privileged path입니다.

Telemetry

263-273

MERT는 L1 interrupt counter, DMA counter, Deep Sleep counter 등 여러 종류의 telemetry information을 보고할 수 있습니다.

  • L1 interrupt counter
  • DMA counter
  • Deep Sleep counter
  • 기타 telemetry

참고 자료

274-281