XRT Support for Event APIs - 2024.1 English

AI Engine Tools and Flows User Guide (UG1076)

Document ID
UG1076
Release Date
2024-06-27
Version
2024.1 English

XRT API is recommended for event profiling for hardware emulation and hardware flows. The XRT API header file xrt/xrt_aie.h defines class xrt::aie::profiling to support event profiling. The xrt::aie::profiling class member functions start, read, and stop are used to start profiling, read profiling results, and stop profiling.

The profiling modes are defined in XRT as:
enum class profiling_option : int 
  { 
    io_total_stream_running_to_idle_cycles = 0, 
    io_stream_start_to_bytes_transferred_cycles = 1,
    io_stream_start_difference_cycles = 2,
    io_stream_running_event_count = 3 
  };

The start function has the following parameters:

int start(profiling_option option, const std::string& port1_name, const std::string& port2_name, uint32_t value) const; //meaning of value depends on option.

An example host code to use XRT API to profile follows:

#include "xrt/xrt_aie.h"
......
auto ghdl=xrt::graph(device,uuid,"gr");
xrt::aie::profiling handle(device);
handle.start(xrt::aie::profiling::profiling_option::io_stream_start_to_bytes_transferred_cycles, "gr.dataout", "", output_size_in_bytes);
......
long long cycle_count = handle.read();
handle.stop();
For more information about PS host coding and compilation, see Programming the PS Host Application.