Vitis AI User Guide
Total Page:16
File Type:pdf, Size:1020Kb
Vitis AI User Guide UG1414 (v1.2) July 7, 2020 Revision History Revision History The following table shows the revision history for this document. Section Revision Summary 07/07/2020 Version 1.2 Entire document • Added Vitis AI Profiler topic. • Added Vitis AI unified API introduction. DPU Naming Added new topic Chapter 2: Quick Start Updated the chapter 03/23/2020 Version 1.1 DPUCAHX8H Added new topic Entire document Added contents for Alveo U50 support, U50 DPUV3 enablement, including compiler usage and model deployment description. UG1414 (v1.2) July 7, 2020Send Feedback www.xilinx.com Vitis AI User Guide 2 Table of Contents Revision History...............................................................................................................2 Chapter 1: Vitis AI Development Kit.................................................................... 5 Features........................................................................................................................................6 Components.................................................................................................................................6 Deep-Learning Processor Unit................................................................................................ 15 Vitis AI Containers..................................................................................................................... 18 System Requirements...............................................................................................................19 Chapter 2: Quick Start................................................................................................21 Downloading Vitis AI Development Kit...................................................................................21 Setting Up the Host...................................................................................................................21 Setting Up the Host (Using VART)........................................................................................... 22 Setting Up the Evaluation Board............................................................................................. 24 Setting Up the Custom Board..................................................................................................29 Running Examples.................................................................................................................... 32 Support.......................................................................................................................................40 Chapter 3: Model Deployment Overview........................................................ 41 Model Quantization.................................................................................................................. 41 Model Compilation....................................................................................................................47 Runtime Overview.....................................................................................................................48 Chapter 4: Model Quantization............................................................................ 51 Overview.....................................................................................................................................51 Vitis AI Quantizer Flow..............................................................................................................52 TensorFlow Version (vai_q_tensorflow).................................................................................. 53 Pytorch Version (vai_q_pytorch).............................................................................................. 65 Caffe Version (vai_q_caffe)....................................................................................................... 70 Chapter 5: Vitis AI Compiler....................................................................................76 Vitis AI Compiler........................................................................................................................ 76 VAI_C Usage............................................................................................................................... 76 UG1414 (v1.2) July 7, 2020Send Feedback www.xilinx.com Vitis AI User Guide 3 Cloud Flows................................................................................................................................ 77 Edge Flows................................................................................................................................. 80 XIR Based Flow for DPUCAHX8H............................................................................................. 87 Chapter 6: Deployment and Runtime................................................................91 Deploying and Running Models on Alveo U200/250............................................................ 91 Programming with Vitis AI Runtime (VART)...........................................................................91 Multi-FPGA Programming........................................................................................................ 96 Advanced Programming for Edge...........................................................................................99 Chapter 7: Accelerating Subgraph with ML Frameworks.................... 107 Partitioning Functional API Call in TensorFlow....................................................................109 Partitioner API......................................................................................................................... 109 Partitioning Support in Caffe.................................................................................................111 Chapter 8: Debugging and Profiling ............................................................... 113 Vitis AI Utilities.........................................................................................................................113 Debugging............................................................................................................................... 119 Vitis AI Profiler......................................................................................................................... 121 Profiling.................................................................................................................................... 133 Appendix A: Advanced Programming Interface....................................... 138 C++ APIs....................................................................................................................................138 Python APIs..............................................................................................................................188 Appendix B: Additional Resources and Legal Notices........................... 196 Xilinx Resources.......................................................................................................................196 Documentation Navigator and Design Hubs...................................................................... 196 References................................................................................................................................196 Please Read: Important Legal Notices................................................................................. 197 UG1414 (v1.2) July 7, 2020Send Feedback www.xilinx.com Vitis AI User Guide 4 Chapter 1: Vitis AI Development Kit Chapter 1 Vitis AI Development Kit The Vitis™ AI development environment accelerates AI inference on Xilinx® hardware platforms, including both edge devices and Alveo™ accelerator cards. It consists of optimized IP cores, tools, libraries, models, and example designs. It is designed with high efficiency and ease of use in mind, unleashing the full potential of AI acceleration on Xilinx FPGA and on adaptive compute acceleration platform (ACAP). It makes it easier for users without FPGA knowledge to develop deep-learning inference applications, by abstracting away the intricacies of the underlying FPGA and ACAP. Figure 1: Vitis AI Stack UG1414 (v1.2) July 7, 2020Send Feedback www.xilinx.com Vitis AI User Guide 5 Chapter 1: Vitis AI Development Kit Features Vitis AI includes the following features: • Supports mainstream frameworks and the latest models capable of diverse deep learning tasks. • Provides a comprehensive set of pre-optimized models that are ready to deploy on Xilinx® devices. • Provides a powerful quantizer that supports model quantization, calibration, and fine tuning. For advanced users, Xilinx also offers an optional AI optimizer that can prune a model by up to 90%. • The AI profiler provides layer by layer analysis to help with bottlenecks. • The AI library offers unified high-level C++ and Python APIs for maximum portability from edge to cloud. • Customizes efficient and scalable IP cores to meet your needs for many different applications from a throughput, latency, and power perspective. Components Deep Learning Processor Unit (DPU) DPU is a programmable engine optimized for deep neural networks. It is a group of parameterizable IP cores pre-implemented on the hardware with no place and route required. The DPU is released with the Vitis AI specialized instruction set, allowing efficient implementation of many deep learning networks. Vitis AI offers a series of different DPUs for both embedded devices such as Xilinx Zynq®-7000, Zynq® UltraScale+™ MPSoC, and Alveo™ cards such as