Counter Reference¶
This page lists the 41 hardware counter events that the device exposes and how the values shown in the trace are
computed from raw counts. Hardware counters are sampled for each kernel execution when collected in
haprof --device-trace mode. The default registration is the 20 events of core 0; other events can be specified
through the HAPTI_COUNTERS environment variable. For how
to interpret the collected counter values, see
Device Tracing: Interpreting Counters.
The "Trace description" column is copied verbatim from the catalog and matches the counter key names in the trace.
Contents¶
| Section | Objective |
|---|---|
| 1. Event Catalog | Event ids and names by block |
| 2. Display Rules | How the values in the trace are computed |
| 3. Default Registered Events | The 20 events that --device-trace collects by default |
1. Event Catalog¶
In HAPTI_COUNTERS, use the block name for <block> and a name or id below for <event>.
AXIBRG¶
The AXI bridge between the core and DRAM. Counts read and write beats and the stalls on both sides.
| Event | Name | Trace description |
|---|---|---|
| 0 | beat_rdata |
DRAM read beats |
| 1 | idle |
AXI idle cycles |
| 2 | beat_wdata |
DRAM write beats |
| 3 | rdata_stall_supply |
read stall (supply) |
| 4 | rdata_stall_demand |
read stall (demand) |
| 5 | wdata_stall_supply |
write stall (supply) |
| 6 | wdata_stall_demand |
write stall (demand) |
| 7 | ar_active |
AR active |
| 8 | aw_active |
AW active |
| 9 | wait_bresp |
write completion wait |
CDMA¶
The per-core DMA engine.
| Event | Name | Trace description |
|---|---|---|
| 0 | idle |
DMA idle |
| 1 | inrob_beat |
DRAM read beats |
| 2 | outbuf_beat |
DRAM write beats |
DMC¶
Counts SRAM bank conflicts.
| Event | Name | Trace description |
|---|---|---|
| 0 | conflict_total |
SRAM bank conflicts |
| 1 | conflict_maxbank |
hottest-bank conflicts |
UTIL¶
Per-core unit utilization sampling. Each event is the number of samples in which the unit was busy, and
sample_total is the denominator.
| Event | Name | Trace description |
|---|---|---|
| 0 | sample_total |
poll samples |
| 1 | core_active |
core busy |
| 2 | mpu_active |
matrix unit busy |
| 3 | vpu_active |
vector unit busy |
| 4 | spu_active |
special-fn unit busy |
| 5 | cdma_active |
core DMA busy |
| 6 | axibrg_active |
AXI bridge busy |
| 7 | rsh_active |
reshape unit busy |
| 8 | smp_active |
sample unit busy |
| 9 | cgbrg_active |
CG bridge busy |
CGDMA¶
The core group (CG) DMA engine. The instance number is the core group number, and the bandwidth values are derived from this block.
| Event | Name | Trace description |
|---|---|---|
| 0 | idle |
CGDMA idle cycles |
| 1 | inrob_beat |
DRAM read beats |
| 2 | outrob_beat |
DRAM write beats |
| 3 | ar_active |
AR active |
| 4 | inst_stall_supply |
inst stall (supply) |
| 5 | inst_stall_demand |
inst stall (demand) |
| 6 | ar_stall_supply |
AR stall (supply) |
| 7 | ar_stall_demand |
AR stall (demand) |
| 8 | inrob_stall_supply |
read stall (supply) |
| 9 | inrob_stall_demand |
read stall (demand) |
| 10 | outrob_stall_supply |
write stall (supply) |
| 11 | outrob_stall_demand |
write stall (demand) |
MPU¶
Work counters of the matrix unit. They count raw work, not time.
| Event | Name | Trace description |
|---|---|---|
| 0 | stripe |
matrix stripes |
| 1 | rsc_substripe |
matrix substripes |
| 2 | wne |
weight elements |
| 3 | ifm_chn |
input FM channels |
2. Display Rules¶
The trace does not show raw counter values as is. The values attached to a kernel slice are computed with the following rules, depending on the block.
| Block | Display | Key format |
|---|---|---|
| AXIBRG, CDMA, CGDMA, MPU | Per-execution delta | <block>.c<instance>.<event> (<trace description>, per launch) |
| DMC | Raw value (already per execution) | Same as above |
| UTIL | Percentage of sample_total |
UTIL.c<core>.<unit>% (<trace description>) |
| CGDMA, AXIBRG | Additional per-direction derived values | Bandwidth and Stall Breakdown |
| DMC | Additional bank skew derived value | SRAM Bank Skew |
2.1 Per-Execution Delta¶
The AXIBRG, CDMA, CGDMA, and MPU counters are free-running, and the device does not reset them. The trace subtracts the value of the previous execution from each counter, so that a row means "this execution" rather than "since boot". If a counter is lower than its previous value (because it was reset), the raw value is used as is.
The first execution has no previous value
The delta of the first execution is taken against a baseline of 0, so it includes whatever ran before profiling started. Do not trust the first execution; measure after warm-up.
2.2 Raw Values¶
The firmware resets the DMC counters for each execution, so its samples are already per execution. They are shown as is, without another subtraction.
2.3 Utilization¶
1 | |
sample_total is the number of polling samples taken during the execution, and each *_active event is the
number of those samples in which the unit was busy. sample_total itself is used only as the denominator and is
not shown, and if the sample_total of the same core is not registered, UTIL values are not shown. This is a
sampled duty cycle, not cycle-exact occupancy.
2.4 Bandwidth and Stall Breakdown¶
For each direction (read, write) of CGDMA and AXIBRG, the following are computed.
1 2 3 | |
| Block · direction | beat | supply stall | demand stall |
|---|---|---|---|
| CGDMA read | inrob_beat |
inrob_stall_supply |
inrob_stall_demand |
| CGDMA write | outrob_beat |
outrob_stall_supply |
outrob_stall_demand |
| AXIBRG read | beat_rdata |
rdata_stall_supply |
rdata_stall_demand |
| AXIBRG write | beat_wdata |
wdata_stall_supply |
wdata_stall_demand |
All three values are shown only when the beat counter and both stall counters are registered. If any one is missing, the whole direction is omitted instead of being shown with a wrong denominator.
CGDMA additionally shows a bandwidth computed by multiplying utilization by the firmware peak.
1 | |
CGDMA bandwidth is a derived value
68.0 GB/s per core group is the peak declared by the firmware. This value is utilization scaled by that
constant, not a measured byte count, so use it to compare executions and not as an absolute transfer rate.
The memory bandwidth (GB/s) on memory transfer slices is a measurement, bytes divided by time, and is a
different kind of value.
When the three AXIBRG write values are shown and wait_bresp is also registered, one more is added.
1 | |
Finally, a verdict based on the summed stalls of all CGDMA and AXIBRG directions is attached to the whole kernel.
| Key | Value |
|---|---|
bound (DMA stall: supply=mem, demand=compute) |
memory-bound if the supply sum is larger, compute-bound if the demand sum is larger, balanced if equal |
memory-bound stall% |
supply sum / (supply sum + demand sum) × 100 |
2.5 SRAM Bank Skew¶
When both DMC events are registered, the following is shown per core.
1 | |
If conflicts are spread evenly across the 16 banks, the value is 6.25%; if they concentrate on one bank, it approaches 100%.
3. Default Registered Events¶
--device-trace without HAPTI_COUNTERS registers the following 20 events. All are instance 0 (core 0).
| Block | Events |
|---|---|
| AXIBRG | beat_rdata, idle, beat_wdata, rdata_stall_supply, rdata_stall_demand, wdata_stall_supply, wdata_stall_demand, wait_bresp |
| DMC | conflict_total, conflict_maxbank |
| UTIL | All 10 |
With this set, the AXIBRG per-direction breakdown, bresp-wait%, bank-skew%, and UTIL utilization are shown.
CGDMA bandwidth is not shown by default.