Overview

In this section you will use the ExecuTorch Inspector to correlate runtime events from the .etdump with the lowered graph and backend mapping from the .etrecord. This lets you confirm that a node was delegated to XNNPACK and when eligible it was accelerated by KleidiAI micro-kernels.

The Inspector analyzes the runtime data from the ETDump file and maps it to the corresponding operators in the Edge Dialect Graph.

Analyze ETDump and ETRecord files with the Inspector script

Save the following code in a file named inspect.py and run it with the path to a .pte model. The script auto-derives .etrecord, .etdump, and an output .csv next to it.

    

        
        

import os
import sys
from executorch.devtools.inspector import Inspector

if len(sys.argv) < 2:
    print(f"Usage: python {sys.argv[0]} <model_pte>")
    sys.exit(1)

pte_file = sys.argv[1]

base = os.path.splitext(pte_file)[0]

etrecord = f"{base}.etrecord"
etdump = f"{base}.etdump"
csvfile = f"{base}.csv"

ins = Inspector(etrecord=etrecord, etdump_path=etdump)
ins.print_data_tabular(include_delegate_debug_data=True, include_units=False)

with open(csvfile, "w", encoding="utf-8") as f:
    ins.save_data_to_tsv(f)

    

Run the Inspector script and review performance results

Run the script, for example with the linear_model_pf32_gemm.pte model :

    

        
        
python3 inspect.py model/linear_model_pf32_gemm.pte

    

Next, you can examine the generated CSV file to view the execution time information for each node in the model.

Below is an example showing the runtime data corresponding to the Fully Connected node.

event_block_nameevent_namep10 (ms)p50 (ms)p90 (ms)avg (ms)min (ms)max (ms)op_typesis_delegated_opdelegate_backend_name
DefaultMethod::init33.27704633.27704633.27704633.27704633.27704633.277046[]FALSE
DefaultProgram::load_method33.30000633.30000633.30000633.30000633.30000633.300006[]FALSE
ExecuteFully Connected (NC, F32) GEMM #10.01600000000001960.01800000000000070.01900000000000550.01874490000000050.01499999999998644.244[]TRUEXnnpackBackend
ExecuteDELEGATE_CALL0.041360.044640.047920.0460820530.033724.390585[‘aten.linear.default’]FALSEXnnpackBackend
ExecuteMethod::execute0.048480.05255950.057560.05406580460.039444.404385[]FALSE

You can now iterate over FP32 vs FP16 vs INT8 vs INT4 models, confirm the exact GEMM variant used, and quantify the latency savings attributable to KleidiAI micro-kernels on your Arm device.

You can experiment with different models and matrix sizes to analyze various performance results.

Back
Next