Sample RISC-V Zephyr Tracing Report¶
This section contains a sample complete report with Zephyr tracing section on RISC-V platform, generated by Kenning using Zephelin.
Testing configuration:
Environment: Github Actions
Task: Gesture recognition on Magic Wand dataset
Tracing tool: Zephelin
Compiler framework:
TVMPlatform: SiFive HiFive Unmatched
Sample RISC-V Zephyr Tracing Report¶
General information for results.json¶
Model framework:
torch ver. 2.13.0+cu130
Used commands
This section was generated using:
python -m kenning.__init__ \
optimize \
test \
report \
--cfg \
/home/runner/work/kenning/kenning/scripts/configs/zephyr-tvm-magic-wand-hifive-unmatched-report.yml \
--measurements \
./results.json \
--report-path \
/home/runner/work/kenning/kenning/docs/source/generated/sample-riscv-zephyr-tracing-report.md \
--report-types \
classification \
performance \
renode_stats \
zephyr_traces \
model \
--root-dir \
/home/runner/work/kenning/kenning/docs/source/ \
--img-dir \
/home/runner/work/kenning/kenning/docs/source/generated/img/ \
--report-name \
Sample RISC-V Zephyr Tracing Report \
--verbosity \
INFO \
--to-html
Input scenario
{
"dataset": {
"type": "kenning.datasets.magic_wand_dataset.MagicWandDataset",
"parameters": {
"window_size": 128,
"window_shift": 128,
"noise_level": 20,
"dataset_root": "build/data",
"inference_batch_size": 1,
"download_dataset": true,
"force_download_dataset": false,
"external_calibration_dataset": null,
"split_fraction_test": 0.2,
"split_fraction_val": null,
"split_seed": 1234,
"reduce_dataset": 1.0
}
},
"dataconverter": {
"type": "kenning.dataconverters.modelwrapper_dataconverter.ModelWrapperDataConverter",
"parameters": {}
},
"optimizers": [
{
"type": "kenning.optimizers.tvm.TVMCompiler",
"parameters": {
"model_framework": "any",
"target": null,
"target_attrs": "",
"target_microtvm_board": "hifive_unmatched/fu740/u74",
"target_host": null,
"zephyr_header_template": "gh://antmicro:kenning-zephyr-runtime/lib/kenning_inference_lib/runtimes/tvm/generated/model_impl.h.template;branch=main",
"zephyr_llext_source_template": null,
"opt_level": 3,
"libdarknet_path": "/usr/local/lib/libdarknet.so",
"compile_use_vm": false,
"output_conversion_function": "default",
"conv2d_data_layout": "",
"conv2d_kernel_layout": "",
"use_fp16_precision": false,
"use_int8_precision": false,
"int8_calibrate_chunk_by": -1,
"use_tensorrt": false,
"dataset_percentage": 0.25,
"module_name": null,
"compiled_model_path": "./build/compiled-model-magic-wand.graph_data",
"location": "host"
}
}
],
"platform": {
"type": "kenning.platforms.zephyr.ZephyrPlatform",
"parameters": {
"zephyr_build_path": "build/hifive_unmatched",
"llext_binary_path": null,
"sensors": null,
"sensors_frequency": null,
"enable_zephelin_gdb": false,
"enable_zephelin": true,
"zephyr_base": null,
"uart_port": "/tmp/renode_uart_zthc9uoq/uart",
"uart_baudrate": 115200,
"uart_log_port": "/tmp/renode_uart_zthc9uoq/uart_log",
"uart_log_baudrate": 115200,
"auto_flash": false,
"openocd_path": "openocd",
"sensor": null,
"number_of_batches": 16,
"simulated": true,
"runtime_binary_path": null,
"platform_resc_path": null,
"resc_dependencies": [],
"post_start_commands": [
"logLevel 3 sysbus.uart1"
],
"disable_opcode_counters": false,
"disable_profiler": false,
"profiler_dump_path": "/tmp/renode_profiler_k38wa81h.dump",
"profiler_interval_step": 10.0,
"runtime_init_log_msg": "Inference server started",
"runtime_init_timeout": 30,
"gdb_port": 3333,
"renode_log_lines_single_read_limit": 5000,
"name": "hifive_unmatched/fu740/u74",
"platforms_definitions": [
"kenning:///platforms/platforms.yml",
"/home/runner/work/kenning/kenning/kenning/resources/platforms/platforms.yml"
]
}
},
"protocol": {
"type": "kenning.protocols.uart.UARTProtocol",
"parameters": {
"port": "/tmp/renode_uart_zthc9uoq/uart",
"baudrate": 115200,
"error_recovery": true,
"timeout": 30
}
},
"model_wrapper": {
"type": "kenning.modelwrappers.classification.pytorch_magic_wand.PyTorchMagicWandModelWrapper",
"parameters": {
"batch_size": null,
"learning_rate": null,
"num_epochs": null,
"window_size": 128,
"logdir": null,
"export_dict": false,
"model_path": "kenning:///models/classification/magic_wand.pth",
"model_name": null
}
},
"runtime": {
"type": "kenning.runtimes.tvm.TVMRuntime",
"parameters": {
"save_model_path": "./build/compiled-model-magic-wand.graph_data",
"target_device_context": "cpu",
"target_device_context_id": 0,
"runtime_use_vm": false,
"llext_binary_path": null,
"batch_size": 1,
"disable_performance_measurements": false
}
},
"runtime_builder": {
"type": "kenning.runtimebuilders.zephyr.ZephyrRuntimeBuilder",
"parameters": {
"board": "hifive_unmatched/fu740/u74",
"application_dir": "/home/runner/work/kenning/kenning/zephyr-workspace/kenning-zephyr-runtime/app",
"build_dir": "/home/runner/work/kenning/kenning/zephyr-workspace/kenning-zephyr-runtime/build",
"venv_dir": "/home/runner/work/kenning/kenning/zephyr-workspace/kenning-zephyr-runtime/.west-venv",
"extra_targets": [
"board-repl"
],
"extra_build_args": [
"-DCONFIG_KENNING_TVM_MODEL_PRE_GEN=y"
],
"use_llext": false,
"run_west_update": false,
"workspace": "/home/runner/work/kenning/kenning/zephyr-workspace/kenning-zephyr-runtime",
"output_path": "build/hifive_unmatched",
"model_framework": "tvm"
}
}
}
Inference quality metrics for results.json¶
Figure 20 Confusion matrix¶
Statistic |
Value |
|---|---|
Accuracy |
0.992857 |
Mean precision |
0.994681 |
Mean sensitivity |
0.994681 |
G-mean |
0.994638 |
Inference performance metrics for results.json¶
Inference time¶
Figure 21 Inference time¶
Figure 22 Preprocessing and postprocessing time¶
Statistic |
Time [s] |
|---|---|
First inference duration |
0.009222 |
Mean |
0.009712 |
Median |
0.009747 |
Standard deviation |
0.000315 |
Minimum |
0.009006 |
Maximum |
0.010400 |
Renode performance measurements for results.json¶
Count of instructions used during inference¶
Figure 23 Histogram of used instructions during inference¶
Executed instructions counters¶
Figure 24 Count of executed instructions per second for cpu0 during benchmark¶
Figure 25 Cumulative count of executed instructions for cpu0 during benchmark¶
Figure 26 Count of executed instructions per second for cpu1 during benchmark¶
Figure 27 Cumulative count of executed instructions for cpu1 during benchmark¶
Figure 28 Count of executed instructions per second for cpu2 during benchmark¶
Figure 29 Cumulative count of executed instructions for cpu2 during benchmark¶
Figure 30 Count of executed instructions per second for cpu3 during benchmark¶
Figure 31 Cumulative count of executed instructions for cpu3 during benchmark¶
Peripheral access counters¶
Figure 32 Count of clint reads per second during benchmark¶
Figure 33 Cumulative count of clint reads during benchmark¶
Figure 34 Count of clint writes per second during benchmark¶
Figure 35 Cumulative count of clint writes during benchmark¶
Figure 36 Count of uart0 reads per second during benchmark¶
Figure 37 Cumulative count of uart0 reads during benchmark¶
Figure 38 Count of uart0 writes per second during benchmark¶
Figure 39 Cumulative count of uart0 writes during benchmark¶
Figure 40 Count of uart1 reads per second during benchmark¶
Figure 41 Cumulative count of uart1 reads during benchmark¶
Figure 42 Count of uart1 writes per second during benchmark¶
Figure 43 Cumulative count of uart1 writes during benchmark¶
Exceptions counters¶
Figure 44 Count of raised exceptions per second during benchmark¶
Figure 45 Cumulative count of raised exceptions during benchmark¶
Instructions stats¶
Instructions counters per inference pass: 1420285
Top 10 instructions and counters per inference pass:
c.addi: 212017
flw: 160863
bne: 95863
fsw: 76555
fadd.s: 66052
addi: 62444
fmul.s: 62272
c.mv: 55975
c.flw: 37731
ld: 36721
Memory allocation stats¶
Total allocated: 3091632
Total freed: 3033712
Peak allocated: 72256
Compiled model size: 22486.0
Host memory refers to memory of the CPU controlling the accelerator, while device memory is the memory of the accelerator.
Zephyr traces¶
Input model specification for results.json¶
Model visualization¶
Basic model information¶
Model name |
Layer count |
Number of parameters |
ONNX-converted model size (in bytes) |
Model Framework (version) |
|---|---|---|---|---|
Main |
14 |
4572 |
18288 |
torch () |
Layers¶
Figure 46 Layer operation type counts¶
Layer # |
Name |
Operation type |
Parameters types |
Parameters count |
Parameters bytes |
|---|---|---|---|---|---|
1 |
input_1 |
Input |
FLOAT |
0 |
0 |
2 |
/0/Conv |
Conv |
FLOAT |
104 |
416 |
3 |
/2/Relu |
Relu |
N/A |
0 |
0 |
4 |
/3/MaxPool |
MaxPool |
N/A |
0 |
0 |
5 |
/5/Conv |
Conv |
FLOAT |
528 |
2112 |
6 |
/7/Relu |
Relu |
N/A |
0 |
0 |
7 |
/8/MaxPool |
MaxPool |
N/A |
0 |
0 |
8 |
/10/Flatten |
Flatten |
N/A |
0 |
0 |
9 |
/11/Gemm |
Gemm |
FLOAT |
3600 |
14400 |
10 |
/12/Relu |
Relu |
N/A |
0 |
0 |
11 |
/14/Gemm |
Gemm |
FLOAT |
272 |
1088 |
12 |
/15/Relu |
Relu |
N/A |
0 |
0 |
13 |
/16/Gemm |
Gemm |
FLOAT |
68 |
272 |
14 |
out_layer |
Output |
FLOAT |
0 |
0 |