Launch the new Vitis Unified IDE to open directly your workspace $ vitis --workspace ~/myworkspace
The IDE starts from the Welcome page, you can close it if you wish. We can change the color scheme via file
> preferences
> color theme
. We used the light color theme to get the screenshots in this tutorial.
Select the component named tutorial_example
in the VITIS COMPONENTS
upper left-hand panel.
Notice [HLS] in grey, indicating an HLS component.
Hover on the C SIMULATION
line to reveal the gear icon and click it to open the settings.
The screenshot below shows that Vitis HLS Code Analyzer is enabled. Notice that when enabled, other options are disabled because they are not compatible with Code Analyzer (namely O (optimization), profile and setup).
Let’s observe the lower left-hand panel: it’s named FLOW
.
Under C SIMULATION
notice that we have 3 options: Run
, Debug
and REPORTS
, but the REPORTS option is greyed-out. Let’s click Run
to execute the C-Simulation. If you examine the console output you can read the message Executing Code Analyzer instead of classic HLS C simulation
After a few moments, the console reports C-simulation finished successfully and you can notice that the REPORTS
section is now selectable. Expand the REPORTS
and click on Code Analyzer
.
You get presented with a graph view:
This view helps you convert your design into the dataflow form and assists you in its optimization.
Your C/C++ code is represented here as a dataflow design even if it is currently written in a sequential form. Dataflow processes are deduced from the top-level statements in the selected function body and their dependencies are turned into channels. Performance estimates are computed for the presented dataflow design, ignoring potential canonicalization issues.
With this graph view you get a lot of information immediately:
Nodes represent dataflow processes with their names being function names or loops labels (unnamed loops are named “Process #N”). Estimated Transaction Intervals are also presented next to the node name. When you expand the node using the arrow-head button, you can see a snippet of the function call site or loop code.
Edges are the communication channel extracted from the variables of the design. You can see their names, the volume of data and the average throughout, expressed by default in bits per second, both estimated from the C-TB run.
Transaction Interval is the minimal delay between two executions of a process. Remember that Code Analyzer assumes that the top level region contains processes executing independently, and as such the region’s performance is limited by the slowest process, the one with the largest TI number estimate. It is the process highlighted in red.
You can select other functions to investigate by selecting the function drop-down menu in the toolbar, but you can also iteratively drill down the function calls and loops in the different processes to achieve the same effect. This can be achieved by clicking on the right-pointing arrows next to lines of codes in processes.
Below the graph, a table on the lower half of the view shows the processes and channels with more details. We will review this later in the tutorial.
The figure below illustrates how every node in the graph relates to top-level statements in the function being analyzed.
The graph also allows users to perform graph-only transformations by merging processes together so that the graph nodes and edges are recomputed, and the new performance of the merged process can be investigated. The merge operation is performed with the move icon on the process: left-click the icon, hold, and start dragging the process and the graph will show the possible target processes by changing their borders into dashed lines. The screenshot below shows that we can merge Process 2
with the process loop1
directly before, and the process loop3
directly after, but not loop4
or computeD()
.
Let’s go ahead and merge Process 2
with loop3
by releasing the mouse button. The tool computes the updated metrics and updates the graph; here notice the loop3
process is not present anymore. Now we can also try the reverse operation, the split operation, on the merged process: first, expand the process with the arrow-head icon. A horizontal dashed line shows the split location with the original code for Process 2
and loop3
on each side. A split button appears when you hover the mouse on the split line. Select the split button with the mouse to perform the split.
More complex code might have more processes on the graph than what you might expect from the source code because class constructors or initialization might be extracted as processes. In those situations, Code Analyzer estimates that they will take some clock cycles at runtime.