NPU Utilization

The Programmers Reference Manual for v68 in the Hexagon Tools has a section on PMU events and the SDK has the QuRT User Guide with the APPs used below. You will need both of these handy if you want add some measurements to your code.

You can find the above docs here:

  • QuRT : $HEXAGON_SDK_ROOT/docs/pdf/80-VB419-178_D_Qualcomm_Hexagon_QuRT_RTOS_User_Guide_SDK.pdf
  • PRM: HEXAGON_Tools\21.0\Documents\v68 Programmer Reference Manual.pdf

Here is a bare bones example that counts the number of nop instructions:

qurt_pmu_set(QURT_PMUEVTCFG, 0x33);
qurt_pmu_enable(1);
for (int i=0; i<100; i++) {
    asm volatile ("nop");
}
qurt_pmu_enable(0);
fprintf (fp, "Should be more than 100 nops, nops counted:  %d\n", qurt_pmu_get(QURT_PMUCNT0));

From the PRM check the section on PMU Events, 0x33 counts the number of nops committed.

I posted a simple qurt example here: Using QuRT API’s in Standalone Hexagon Programs and amended it with the above.