Skip to content

Activate DureMark as a benchmark - #15

Merged
jserv merged 1 commit into
mainfrom
duremark-benchmark
Aug 3, 2026
Merged

Activate DureMark as a benchmark#15
jserv merged 1 commit into
mainfrom
duremark-benchmark

Conversation

@jserv

@jserv jserv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

DureMark was build-only: "rvopt mux" could not lower it because libgcc's soft div/mod return through a "jr t0" runtime JALR, and GCC hoisted the ecall syscall number out of each ecall's own basic block (rvopt resolves it only from in-block constants). Fix both at the source:

  • soft.c supplies self-contained __mulsi3/__udivsi3/__umodsi3/__modsi3 (jal/ret only, shift/subtract so they cannot recurse into libgcc). It is linked before libgcc, so its four helpers win and the "jr t0" millicode is never pulled; libgcc trails only as a fallback for any other pure-RV32I helper a future codegen might emit.
  • run.c loads a7 inside the ecall asm template with an a7 clobber, so the syscall number materializes in the ecall's own block.
  • ITERATIONS 1 -> 500 makes the run a substantial (~15 s) benchmark; the count feeds the checksum, re-pinned to 1069216870 and gated by rv32i-check.

Add benchmark targets: bench-forth times seven compute-bound eForth kernels, bench-rv32i delegates to the duremark sub-make run target (build

  • lower + bounded VM run + checksum assert) with a TIME_P prefix so the benchmark times exactly the gated path, and bench runs both. Timing uses /usr/bin/time -p; runs are bounded by timeout. Wire make bench into the CI rv32i job (and install GNU time there).

Summary by cubic

Activate DureMark as a timed benchmark by making it fully lowerable with rvopt mux and wiring new bench targets into CI. This adds a deterministic checksum gate and measures both eForth kernels and the rvopt‑lowered DureMark path.

  • New Features
    • DureMark now runs end to end: added soft.c with RV32I __mulsi3/__udivsi3/__umodsi3/__modsi3 (no libgcc JALR), and run.c loads a7 inside the ecall template. Iterations set to 500; checksum pinned to 1069216870.
    • Makefile: new bench-forth (7 compute kernels) and bench-rv32i (delegates to tests/rv32i/duremark run), plus bench to run both. Uses /usr/bin/time -p; runs are bounded by timeout.
    • rv32i-check now lowers and runs DureMark alongside demo and unopt programs.
    • CI installs time and runs make bench in the RV32I job.

Written for commit 6a17d01. Summary will update on new commits.

Review in cubic

DureMark was build-only: "rvopt mux" could not lower it because libgcc's
soft div/mod return through a "jr t0" runtime JALR, and GCC hoisted the
ecall syscall number out of each ecall's own basic block (rvopt resolves
it only from in-block constants). Fix both at the source:
- soft.c supplies self-contained __mulsi3/__udivsi3/__umodsi3/__modsi3
  (jal/ret only, shift/subtract so they cannot recurse into libgcc). It
  is linked before libgcc, so its four helpers win and the "jr t0"
  millicode is never pulled; libgcc trails only as a fallback for any
  other pure-RV32I helper a future codegen might emit.
- run.c loads a7 inside the ecall asm template with an a7 clobber, so the
  syscall number materializes in the ecall's own block.
- ITERATIONS 1 -> 500 makes the run a substantial (~15 s) benchmark; the
  count feeds the checksum, re-pinned to 1069216870 and gated by
  rv32i-check.

Add benchmark targets: bench-forth times seven compute-bound eForth
kernels, bench-rv32i delegates to the duremark sub-make run target (build
+ lower + bounded VM run + checksum assert) with a TIME_P prefix so the
benchmark times exactly the gated path, and bench runs both. Timing uses
/usr/bin/time -p; runs are bounded by timeout. Wire make bench into the CI
rv32i job (and install GNU time there).

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 11 files

Re-trigger cubic

@jserv
jserv merged commit b92d090 into main Aug 3, 2026
11 checks passed
@jserv
jserv deleted the duremark-benchmark branch August 3, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant