The event API provides functions to configure AI Engine hardware resources for performance profiling and event tracing. In this release, a subset of performance profiling use cases are supported.
Enumeration
enum io_profiling_option
{
io_total_stream_running_to_idle_cycles,
io_stream_start_to_bytes_transferred_cycles,
io_stream_start_difference_cycles,
io_stream_running_event_count
};
The io_profiling_option
contains the
enumerated options for performance profiling using PLIO and GMIO objects. The
io_total_stream_running_to_idle_cycles
option
represents the total accumulated clock cycles in between stream running event and
stream idle event of the corresponding stream port in the shim tile. This option can
be used to profile platform I/O bandwidth.
The io_stream_start_to_bytes_transferred_cycles
option represents the
clock cycles in between the first stream running event to the event that the
specified number of bytes are transferred through the stream port in the shim tile.
This option can be used to profile graph throughput.
The io_stream_start_difference_cycles
option represents the clock cycles
elapsed between the first stream running events of the two platform I/O objects.
This option can be used to profile graph latency.
The io_stream_running_event_count
option represents the number of stream running events. This option can be used to
profile graph throughput during a period of time for streaming applications.
Member Functions
static handle start_profiling(IoAttr& io, io_profiling_option option, uint32 value = 0);
This function configures the performance counters in the AI Engine and starts profiling. io
is the platform GMIO or PLIO object. option
is one of the io_profiling_option
enumerations described above. If the io_stream_start_to_bytes_transferred_cycles
option is
used, the number of bytes can be specified in the value
parameter. This function should be called after graph::init()
. It returns a handle
to be used by read_profiling
and stop_profiling
. If the specification is
incorrect or there is insufficient hardware resources to perform the profiling, an
invalid_handle
is returned.
static handle start_profiling(IoAttr& io1, IoAttr& io2, io_profiling_option option, uint32 value = 0);
This function configures the performance counters in the AI Engine and starts profiling for the option represents the number of stream running events. This
option can be used toio_stream_start_difference_cycles
option.
Parameters io1
and io2
specify the two platform I/O objects. This function should be
called after graph::init()
. It returns a handle
to be used by read_profiling
and stop_profiling
. If
the specification is incorrect or there is insufficient hardware resources to
perform the profiling, an invalid_handle
is
returned.
static long long read_profiling(handle h);
This function returns the current performance counter value
associated with the handle
.
static void stop_profiling(handle h);
This function stops the performance profiling associated with the
handle
and releases the corresponding hardware
resources.
Enumeration
enum kernel_profiling_option
{
kernel_between_pc_cycles /// Number of accumulated cycles between two specified program counters for a kernel object
};
The kernel_profiling_option
contains
the enumerated options for performance profiling the numbers of cycles between two
program counters of kernel objects.
The kernel_between_pc_cycles
option represents the
number of accumulated cycles between two specified program counters for a kernel
object.
Member Functions
static handle start_profiling(kernel& k, kernel_profiling_option option, uint16 pc1, uint16 pc2);
This function configures performance counters in an AI Engine to record the number of accumulated cycles between two specified program counters (pc1 and pc2) for a kernel object (k).