Skip to content

Empty log problem when running a simple mini CNN model on Spike #346

@Nouhaila12-khachtaoui

Description

@Nouhaila12-khachtaoui

Hello,

I am currently working on an academic project where I need to:

Compile a simple CNN model (Convolution + ReLU) written in C to RISC-V.

Run this model using spike with the --log option to analyze the executed instructions (e.g., mul, lw, sw) using spike_log.txt.

Perform optimizations based on the log analysis (energy consumption, latency, memory...).
Context:

  • I have successfully executed a Hello World program using Spike + PK, and the output is correctly displayed (Bonjour, RISC-V !).

  • I am using SiFive GCC 8.3.0-2019.08.0 toolchain, and Spike compiled from the official repository.

  • My simple CNN model compiles and runs successfully on Spike with PK.

Problem: although the execution completes, the spike_log.txt file remains empty (0 lines), even though the terminal shows bbl loader.
Commands used:
riscv64-unknown-elf-gcc -static -march=rv64imac -mabi=lp64 -O0 -o cnn_simple.riscv cnn_simple.c
spike --log=spike_log.txt /usr/local/riscv64-unknown-elf/bin/pk cnn_simple.riscv
grep "mul" spike_log.txt | wc -l
Result:

spike_log.txt is empty.

No instructions (mul, lw, sw) are visible, making any analysis impossible.

Attempts already made:
Tried different toolchain versions (10.2.0 and 8.3.0).

Built and used PK manually.

Tried running in pure bare-metal mode using a link.ld linker script (similar issues).
the links

  1. https://github.com/riscv-software-src/riscv-isa-sim
  2. https://github.com/riscv-software-src/riscv-pk
  3. https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
  4. https://static.dev.sifive.com/dev-tools/freedom-tools/v2019.08/riscv64-unknown-elf-toolchain-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz

Questions:

  1. Is this a known behavior with Spike and PK?
  2. Does PK intercept or hide the instruction logs from the user program?
  3. Should I consider using Spike in pure bare-metal mode without PK, or using a minimal custom loader?
  4. Are there any additional settings needed to enable complete instruction logging during execution?
  5. What is the recommended best practice to obtain valid logs from a simple CNN C model running on Spike?

Thank you very much for your support.
Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions