Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CVA6 Return-Address-Stack depth vs IPC

Measures the IPC impact of the RAS depth in CVA6 (cv64a6_imafdc_sv39) on Verilator. RAS depth is the only variable: the sweep edits one localparam (CVA6ConfigRASDepth), logs the exact config line per build, and rebuilds from clean. Everything is counted in hardware, not estimated: retired instructions/cycles from the RVFI commit ports, RAS mispredictions from resolved mispredicted Return control flows in the frontend (patches/0003).

Results (deterministic — repeated runs are bit-identical)

benchmark kernel IPC gain vs depth-2 saturates at RAS misses, 2 → 16
dhrystone +1.58% depth 4 717 → 210 (−71%)
callheavy (recursive fib + ackermann) +0.44% @16, still rising 44,852 → 34,079 (−24%)
coremark (10 iter) +0.02% depth 4 2,476 → 2,388 (−3.6%)

Depth 4 captures essentially all return history for conventional call trees — dhrystone and coremark are bit-identical at depths 4/8/16. Beyond 4 only deep recursion pays, and little: the measured return-mispredict penalty is ≈6–7 cycles (derived independently from both dhrystone and callheavy deltas). Each RAS entry costs 65 flops (64-bit RA + valid; shift-register stack in core/frontend/ras.sv). Sweet spot: depth 4 (+130 flops).

Full data: out/results.csv (whole-run counters) · per-run logs in out/ · rendered report in report.html.

Reproduce

Prereqs: Docker, git, ~8 GB free. Everything RISC-V (toolchain, spike, Verilator v5.008) lives in the container image.

./build.sh                                     # pinned clone -> image -> verilate -> smoke-run
docker/dock.sh 'cd /bench && bash build_benches.sh'   # dhrystone, callheavy, coremark
mkdir -p out && cp run_sweep.sh out/ && docker/dock.sh 'cd /tmp && bash /out/run_sweep.sh'

out/results.csv appears with (ras_depth, benchmark, instrs, cycles, ipc, ras_mispredicts).

Layout

  • build.sh — one-command bring-up, fail-fast at every stage
  • setup_cva6.sh — CVA6 @ ed2efa5 + exact submodules + tracked patches, idempotent
  • patches/0001,0002 — build fixes this CVA6 commit needs (elfloader link + missing DPI fns)
  • patches/0003 — instrumentation: RAS-miss/instr/cycle counters, top->final(), RVFI trace gated behind +rvfi_trace
  • docker/ — Ubuntu 24.04 image (riscv gcc + picolibc, spike, Verilator v5.008+patch), dock.sh mount wrapper
  • bench/ — callheavy source + build script; riscv-tests / riscv-coremark cloned pinned by build.sh
  • run_sweep.sh — the sweep: edit depth → verilate → run set → append CSV; resumable, retries flaky sim-startup segfaults

Gotchas encoded in the scripts

  • Verilator final blocks (the counter dumps) only run if the C++ harness calls top->final().
  • rvfi_tracer writes GB-scale .dasm traces; unconditional writes onto a virtiofs mount segfault the sim — run sims from container-local /tmp, traces now opt-in via +rvfi_trace.
  • CoreMark's bundled bare-metal runtime faults CVA6's AXI; it's linked against the riscv-tests runtime instead. Its "Errors detected" output is only the ≥10-wall-clock-seconds official-reporting rule (all algorithm CRCs validate).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages