Reference : DPU IP Details and System Integration — Vitis™ AI 3.5 documentation (xilinx.github.io)

 

안녕하세요, 벌써 11월의 마지막이 다가오고 있네요

다들 올 한해 잘 마무리 하시고 계신가요?

 

오늘은 DPU에 관련된 소식 들고왔습니다.

 

DPU Overview

DPU란?

DPU란 Deeplearning Processing Unit의 약자로써, CPU보다 더 빠르게 machine learning algorithm을 실행하게 해주는 Hardware IP입니다.

 

DPU는 3가지 종류가 있는데, 먼저 Zynq에 들어간 DPUCZ DPU부터 알아보겠습니다.

 

Zynq에 들어간 DPUCZ DPU는 PL에서 만들어 지는데요, DSP, BRAM, URAM, LUTs, Flip-Flop들로 구성된다고 합니다.

Device당 여러개의 DPU를 instance할 수 있고, DPU의 size도 사용자의 요구에 따라 조정할 수 있습니다.

 

각각의 DPU architecture는 자신의 instruction set을 가지고 있고, Vitis-AI compiler가 python이나 tensorflow 모델을 compile하여 executable .xmodel을 만들어 줍니다. 

 

DPU가 Matrix of (heterogeneous) process engine이라고 불리는 이유는, DPU는 각기 다른 layer를 위한 engine들이 있기 때문입니다. 예를 들어, CONV2D를 위한 PE와 depthwise convolution을 위한 PE가 따로 있습니다.

 

이러한 architecture의 장점은, network를 바꿔도 새로운 beatstream이나 새로운 hardware platform으로 바꿀 필요가 없다는 것입니다.

 

또한, high-speed communication, RF도메인에서 FINN&Brevitas를 이용하면 아주 빠른 sample rate를 만족시킬 수 있습니다. FINN | finn (xilinx.github.io)

 

DPU 이름 구분

DPU는 다음과 같이 이름 붙여집니다.

 

아래는 예전에 쓰였던 DPU 명명법입니다.

 

DPU 종류

2023년 11월 27일 현재 총 4가지 종류의 DPU architecture가 나와 있습니다. 각 Board에 따라 DPU 종류가 다른데요, 한번 알아보겠습니다.

 

1. DPUCV2DX8G (Versal AI Core/ AI Edge series/ Alveo V70)

: DPUCV2DX8G는 가장 최근에 나온 DPU로 CNN 에 최적화 있고, AIE-ML tile과 PL을 사용자가 programming할 수 있습니다.

Features • DPUCV2DX8G for Versal Adaptive SoCs Product Guide (PG425) • Reader • AMD Adaptive Computing Documentation Portal (xilinx.com)

 

2. DPUCVDX8G (Versal AI Core Series)

: DPUCVDX8G는 AI-Engine tile과 PL tile을 갖고 있습니다. 마찬가지로 CNN에 최적화 되 있습니다. (G=General purpose)

 

3. DPUCVDX8H (Versal AI Core Series)

: DPUCVDX8H는 high-throughput을 가진 CNN 기반 engine입니다. 마찬가지로 AI-Engine과 PL tile을 갖고 있습니다. Data center application을 타겟팅하여 나왔습니다.

Introduction • DPUCVDX8G for Versal ACAPs Product Guide (PG389) • Reader • AMD Adaptive Computing Documentation Portal (xilinx.com)

 

4. DPUCZDX8G (Zynq UltraScale+)

: DPUCZDX8G IP는 Zynq UltraScale+ MPSoC에서 사용 가능합니다. PL을 이용해 DPU를 integrate할 수 있고, PS와 연결이 가능합니다.

Introduction • DPUCZDX8G for Zynq UltraScale+ MPSoCs Product Guide (PG338) • Reader • AMD Adaptive Computing Documentation Portal (xilinx.com)

 

아래 Link로 가시면 각 DPU의 reference design을 찾아보실 수 있습니다.

DPU IP Details and System Integration — Vitis™ AI 3.5 documentation (xilinx.github.io) 

 

DPU를 보드에 integartion하는 방법

DPU를 board에 integration하는 방법은 크게 3가지가 있습니다.

 

1. Vitis Target Platform을 기초로한 Vitis-software platform을 사용합니다. 만들어진 hardware는 DPU IP와 다른 kernel을 포함합니다. Vivado flow를 사용해도 됩니다.

 

2. Vitis-AI를 사용합니다. pre-trained floating model을 input으로 넣어, Optimizer(optional), Quantizer, compiler를 이용합니다.

 

3. C++, Python로 Vitis-AI Runtime, Vitis-AI Library를 이용해 compiled model file들을 실행합니다.

 

 

먼저 Vitis를 이용한 방법을 살펴보겠습니다.

 

1. Vitis Integration

Vitis는 'xclbin' file을 이용해 모델을 보드에서 돌릴 수 있게 합니다. AMD에선 DPUCV2DX8G DPU의 reference guide로 VEK280 reference design을 제공합니다. MPSoC나 AI Core(non AIE-ML devices)를 위해선 Vitis-AI 3.0 github의 /dpu subdirectory를 제공합니다.

 

그 외에도 ZCU104에서 제공하는 Vitis-tutorial link도 남겨놓겠습니다.

Vitis-Tutorials/Vitis_Platform_Creation/Design_Tutorials/02-Edge-AI-ZCU104 at 2023.1 · Xilinx/Vitis-Tutorials (github.com)

 

2. Vivado Integration

Vivado workflow는 기존 FPGA 개발자분들을 위한 것입니다.

 

Tutorial을 다음과 같이 2개 제공하고 있습니다.

1. DPU를 Vivado design에서 integrate하는법 : Vitis-AI-Tutorials/Tutorials/Vitis-AI-Vivado-TRD at 2.0 · Xilinx/Vitis-AI-Tutorials (github.com)

2. Quick-start example about deploying VART : Vitis-AI/src/vai_runtime/quick_start_for_embedded.md at v3.5 · Xilinx/Vitis-AI (github.com)

 

 

3. Vitis AI Linux Recipes

C++, Python로 Vitis-AI Runtime, Vitis-AI Library를 이용해 compiled model file들을 돌리는 방법입니다.

 

Yocto, Petalinux user들은 target device에 compile하기 위한 Vitis AI component인 'bitbake recipes'들이 필요합니다. bitbake recipe는 아래 source code folder에 제공됩니다.

Vitis-AI/src/vai_petalinux_recipes at v3.5 · Xilinx/Vitis-AI (github.com)

 

다만 중요한 점은

Vitis-AI 2.0이상, Vivado (Zynq Ultrascale+, Kria application)은 XRT없이 VART만 compile해야 합니다.

다만, Vitis user들은 XRT와 함께 VART를 compile해야 합니다. (Vitis kernel integration에 필요합니다.)

Vitis AI를 사용하는 모든 디자인은 VART를 필요로하고, Alveo, Versal design은 compile시 XRT를 필요로 합니다.

 

Default로 Vitis AI Docker image는 XRT를 포함하고 있습니다. 

VART를 위한 Linux 'bitbake recipe'에서 가장 중요한것은 기본적으로 이 recipe는 Vitis flow를 사용하고 있는것으로 간주합니다. Vitis-AI/src/vai_petalinux_recipes/recipes-vitis-ai/vart/vart_3.5.bb at v3.5 · Xilinx/Vitis-AI (github.com)

 

만약 Linux의 Vivado에서 DPU를 사용한다면, XRT 없이 VART를 compile하기 위해 'vart_3.5_vivado.bb'를 'vart_3.5.bb'로 rename하거나, 'vart_3.5.bb'에서 'PACKAGECONFIG:append = " vitis"를 주석처리해야합니다.

 

이렇게 하지 않으면, VART API를 실행할 때 runtime error를 발생시킬 수 있습니다. 구체적으로 'xclbin' file을 load할 때 Viviado와 호환되지 않는 XRT가 error를 발생시킬 것입니다.

 

마지막으로, Petalinux build folder에 2개의 bitbake recipie들 중 하나만 include하는것을 잊지 말아야 합니다.

 

- Vitis-AI Library, Runtime을 custom design과 integrate하는 법은 2가지가 있습니다.

1. Linux image를 petalinux, 필요한 recipies들을 사용해 build합니다.

2. Run time에서 pre-built package를 사용하기 위해 target board에 Vitis-AI 3.5를 설치합니다. 더 자세한 과정은 아래의 Vitis AI Online Installation section을 참고해주세요.

DPU IP Details and System Integration — Vitis™ AI 3.5 documentation (xilinx.github.io)

 

 

그럼 다음 포스팅엔 DPU integration 후기로 찾아오겠습니다 ㅎㅎ

+ Recent posts