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: TVM

  • Platform: SiFive HiFive Unmatched

Sample RISC-V Zephyr Tracing Report

Commands used

Note

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

General information for results.json

Model framework:

  • torch ver. 2.13.0+cu130

Input JSON:

{
    "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_t8ssqn1d/uart",
            "uart_baudrate": 115200,
            "uart_log_port": "/tmp/renode_uart_t8ssqn1d/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_ewsnvacx.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_t8ssqn1d/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

Bokeh Plot

Figure 19 Confusion matrix

Table 10 Inference quality metrics

Statistic

Value

Accuracy

1.000000

Mean precision

1.000000

Mean sensitivity

1.000000

G-mean

1.000000

Inference performance metrics for results.json

Inference time

Bokeh Application

Figure 20 Inference time

Table 11 Inference time metrics

Statistic

Time [s]

First inference duration

0.008941

Mean

0.009581

Median

0.009567

Standard deviation

0.000339

Minimum

0.008941

Maximum

0.010706

Renode performance measurements for results.json

Count of instructions used during inference

Bokeh Plot

Figure 21 Histogram of used instructions during inference

Executed instructions counters

Bokeh Application

Figure 22 Count of executed instructions per second for cpu0 during benchmark

Bokeh Plot

Figure 23 Cumulative count of executed instructions for cpu0 during benchmark

Bokeh Application

Figure 24 Count of executed instructions per second for cpu1 during benchmark

Bokeh Plot

Figure 25 Cumulative count of executed instructions for cpu1 during benchmark

Bokeh Application

Figure 26 Count of executed instructions per second for cpu2 during benchmark

Bokeh Plot

Figure 27 Cumulative count of executed instructions for cpu2 during benchmark

Bokeh Application

Figure 28 Count of executed instructions per second for cpu3 during benchmark

Bokeh Plot

Figure 29 Cumulative count of executed instructions for cpu3 during benchmark

Peripheral access counters

Bokeh Application

Figure 30 Count of clint reads per second during benchmark

Bokeh Plot

Figure 31 Cumulative count of clint reads during benchmark

Bokeh Application

Figure 32 Count of clint writes per second during benchmark

Bokeh Plot

Figure 33 Cumulative count of clint writes during benchmark

Bokeh Application

Figure 34 Count of uart0 reads per second during benchmark

Bokeh Plot

Figure 35 Cumulative count of uart0 reads during benchmark

Bokeh Application

Figure 36 Count of uart0 writes per second during benchmark

Bokeh Plot

Figure 37 Cumulative count of uart0 writes during benchmark

Bokeh Application

Figure 38 Count of uart1 reads per second during benchmark

Bokeh Plot

Figure 39 Cumulative count of uart1 reads during benchmark

Bokeh Application

Figure 40 Count of uart1 writes per second during benchmark

Bokeh Plot

Figure 41 Cumulative count of uart1 writes during benchmark

Exceptions counters

Bokeh Application

Figure 42 Count of raised exceptions per second during benchmark

Bokeh Plot

Figure 43 Cumulative count of raised exceptions during benchmark

Instructions stats

  • Instructions counters per inference pass: 1363708

  • Top 10 instructions and counters per inference pass:

    • c.addi: 208458

    • flw: 160568

    • bne: 94620

    • fsw: 76284

    • fadd.s: 66052

    • fmul.s: 62272

    • addi: 57269

    • c.mv: 57188

    • c.flw: 34237

    • ld: 33147

Memory allocation stats

  • Total allocated: 3302560

  • Total freed: 3247928

  • Peak allocated: 68968

  • Compiled model size: 22047.0

Host memory refers to memory of the CPU controlling the accelerator, while device memory is the memory of the accelerator.

Zephyr traces

(open in a new tab)

Input model specification for results.json

Model visualization

Basic model information

Table 12 Basic model information

Model name

Layer count

Number of parameters

ONNX-converted model size (in bytes)

Model Framework (version)

Main

14

4574

18304

torch ()

Layers

Bokeh Plot

Figure 44 Layer operation type counts

Table 13 Main model layers

Layer #

Name

Operation type

Parameters types

Parameters count

Parameters bytes

1

input_1

Input

FLOAT

0

0

2

node_Conv_21

Conv

FLOAT

104

416

3

node_relu

Relu

N/A

0

0

4

node_max_pool2d

MaxPool

N/A

0

0

5

node_Conv_22

Conv

FLOAT

528

2112

6

node_relu_1

Relu

N/A

0

0

7

node_max_pool2d_1

MaxPool

N/A

0

0

8

node_view

Reshape

INT64

2

16

9

node_linear

Gemm

FLOAT

3600

14400

10

node_relu_2

Relu

N/A

0

0

11

node_linear_1

Gemm

FLOAT

272

1088

12

node_relu_3

Relu

N/A

0

0

13

node_linear_2

Gemm

FLOAT

68

272

14

out_layer

Output

FLOAT

0

0


Last update: 2026-10-01