-
Notifications
You must be signed in to change notification settings - Fork 332
Description
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
- https://github.com/riscv-software-src/riscv-isa-sim
- https://github.com/riscv-software-src/riscv-pk
- 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
- 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:
- Is this a known behavior with Spike and PK?
- Does PK intercept or hide the instruction logs from the user program?
- Should I consider using Spike in pure bare-metal mode without PK, or using a minimal custom loader?
- Are there any additional settings needed to enable complete instruction logging during execution?
- 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.