AI Engine Simulation Debug Walkthrough - 2024.1 English

Vitis Tutorials: AI Engine

Document ID
XD100
Release Date
2024-06-19
Version
2024.1 English

AI Engine Simulation Debug Walkthrough

Introduction

The AI Engine simulator (aiesimulator) models the timing and resources of the AI Engine array, while using transaction-level SystemC models for the NoC and double-data rate (DDR) memory. This allows for faster performance analysis of your AI Engine applications and accurate estimation of the AI Engine resource use with cycle-approximate timing information. This takes into account the hardware constraints, such as heap/stack sizes and proram memory size, for verifying the design and keeping track of those detailed timing information that makes the simulation slow and resource intensive.

The AI Engine simulator allows stepping through the AI Engine compiler-generated assembly code which aids in code optimization; however, source level visibility could be limited due to compiler optimization. This section discusses about some important features (listed below) that ease the debugging of the design at AIE Simulation level.

Before starting this tutorial:

  • It is expected that you have run the steps to set the environment variables as described in Introduction.

  • Create a system project manually using the steps mentioned in Port the Command Line project to the Vitis IDE System Project

  • Open the Vitis IDE tool by typing vitis in the console, set the workspace, and the IDE opens. Click File->Import, select the Vitis exported project zip file, browse to the above zip file, and click Next. Enable the check box, System Projects, and click Finish.

Features

Build and Simulate in the Vitis IDE Demonstrates how to use the Vitis IDE to build and simulate an AI Engine design.
Debug Using printf Explains how to add `printf` statement, and view the output in the console.
Debug Using the Vitis IDE Debugger Explores different debugging techniques that uses the Vitis IDE debugger.
Enabling Profile and Trace Options Explains how to enable profile and trace options in the Vitis IDE. Explores different event trace dump options like VCD and WDB.
Deadlock Detection Shows a practical deadlock scenario and some simulator options to identify the deadlock.
Visualizing Deadlock in the Vitis Analyzer Explains how to visualize deadlock using trace information in the Vitis Analyzer, and identify the root cause.
Debugging Memory Access Violations Introduces an Out of Bound read access and explains how to identify the violations using the AI Engine simulator options.
Kernel Debug Explains how to debug a single kernel design using a pipeline view in the Vitis IDE.
Design Performance Debug Shows how to calculate kernel latency and throughput using profile information.
Determine Average Throughput of PLIO Determine the average throughput of input and output PLIO.

Section 1

Build and Simulate in the Vitis IDE

  1. From the left pane in the Vitis IDE, select the AI Engine Component, and expand to locate and select the aiecompiler.cfg file to open the compiler configuration settings.

  2. Select the XLOpt settings and under the Kernel optimization setting, select the 0 - None from the drop-down. This gives greater visibility during the AI Engine debug. build setting build target

  3. Right-click the [aiengine] domain project, select C/C++ Build Settings, choose Miscellaneous -> Optimization -> from the drop down choose No Optimizations(xlopt=0). This option helps IDE debugging capability by disabling any kernel optimizations.

  4. Now, in the Flow navigator window, select the Build option under AIE SIMULATOR/HARDWARE. This builds the AI Engine component for AIE Simulation target. Once the build completes, you see the Compilation Complete and Build Finished Successfully messages in the console and a green tick mark as highlighted below. build output

  5. In the Flow navigator window, under AIE SIMULATION/HARDWARE, select the Run option. If there is no existing launch configuration, you need to create one by clicking Create Configuration -> New Launch Configuration -> AIESim. Create_Configuration

  6. You can change the Launch Config Name, and click the Run button to start the simulation for the AIE simulation target. When the simulation completes, the following output in the console is displayed. aiesimulator_output

  7. Right-click the [aiengine] domain project, and select the Run As → Launch AIE Emulator option to start the simulation for the aiesimulation target. When the simulation completes, the following output in the console is displayed: