Using Vitis Unified IDE and Reports - 2023.2 English - UG1079

AI Engine Kernel and Graph Programming Guide (UG1079)

Document ID
UG1079
Release Date
2023-12-04
Version
2023.2 English

Vitis Unified IDE manages the AI Engine components and system project. The Vitis Unified IDE provides views for AI Engine kernel development, and it is essential in the kernel development, debugging, and analysis.

Vitis Unified IDE has a debug view which displays registers, variables, available breakpoints, variables to register/memory mapping, internal/external memory contents, Disassembly view, and Pipeline view for instructions.

When launching the simulation, if Enable Profile is selected in launch configurations, it will show the printf output in console. The Enable Trace check box in launch configurations is for generating event trace data which helps better understand when and how events such as memory stall and stream stall have occurred. Event trace is helpful in performance tuning.

When launching the debug perspective, if Enable Pipeline View is selected in launch configurations, the AI ENGINE PIPELINE view can be shown.

Figure 1. Debug Configurations

In the debug perspective, debug commands enable you to resume, step into, and step over. The AI Engine source code is shown, and it is possible to set breakpoints by double-clicking lines. The windows Variables, Breakpoints, and Register Inspector are available to look into data memory or register status. The Disassembly view is helpful in understanding how instructions are used, especially how they are scheduled in the pipeline. The Pipeline view allows you to correlate instructions executed in a specific clock cycle with the labels in the Disassembly view.

Figure 2. Debug Perspective

The generated code for an AI Engine (Col_Row.cc) includes the AI Engine kernels in the core and wrapper code. From the AI Engine wrapper code, you can step into the AI Engine kernel code by clicking multiple step-in buttons. Alternatively, you can open the AI Engine kernel source file from the design perspective, and set breakpoints in the file. Multiple views, such as the Disassembly view, Pipeline view, Memory Inspector, Register Inspector, and Variables view can be used for debug, and performance tuning.

Note: The number of breakpoints are limited to four for each tile. To set new breakpoints, beyond the number allowed, you must clear existing breakpoints. The tool will issue error messages if you try and set breakpoints beyond the number allowed.

The Disassembly view displays the compiler generated instruction target to the hardware. C/C++ source code can also be embedded between the lines for source code referencing. The instruction helps understand the compiled result, especially the loop pipelining result. By scrolling or stepping in the Disassembly view, the loop in the kernel can be found. The loop iterates from zero-overhead loop start (ZLS) to zero-overhead loop end (ZLE). It can be seen how load instructions and MAC instructions are placed to be pipelined. The preamble and postamble instructions are placed before and after the zero-overhead loop body to fill and flush the pipeline stages.

The Microcode view provides a static view of compiled kernel instructions. It can be opened via AI Engine components or links in Tile view in the analysis view in the Vitis IDE. By right-click the Microcode view, set the option to Enable AIE Cross Probing. Cross probing occurs between the Microcode view and source code.

Figure 3. Microcode View with Cross-Probing

Linker memory map reports for AI Engines cores can be found in Work/aie/core_ID/Release/core_id.map. This file lists the locations of the program and data memories by functions, static variables, and the software stack. From these reports, the stack size, program memory size, global buffers, and their sizes can be extracted. An XML version of the linker report (core_id.map.xml) can be generated by specifying the option -Xchess=\"main:bridge.xargs=-fB\" to the AI Engine compiler.

Work/<name>.aiecompile_summary is the compilation summary that can be opened in the Vitis IDE. Work/reports contains multiple reports for the graph compilation result such as, kernels and buffers mapping result. Refer to the AI Engine Tools and Flows User Guide (UG1076) for additional information about AI Engine compiler outputs.