Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial RIOT-rs port of the ml-kem benchmark #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaspar030
Copy link

This is an initial take on the benchmarks ported to RIOT-rs.

I only did the ml-kem for now.

The README.md provides instructions. I tested this on nrf52840dk only, it should run as-is on all the RIOT-rs Cortex-M devices (Rpi Pico, the nrf, nrf5340, some Nucleos). Cortex-M only for now because that's what we have a benchmark() implementation for.

Not that our benchmark() is currently using the SysTick. It is very accurate but tops out at 2**24 clock cycles (returning an error), so I've had to reduce the number of iterations to 1.

Interestingly, using this port compared to the libcrux-nrf52840, runtime seems to be double. That might well be my Systick US_PER_TICK factor. I was just assuming the nrf in our config runs at 80MHz, which might not actually be true. 😇

Copy link
Member

@keks keks left a comment

Choose a reason for hiding this comment

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

Thank you for the port! I haven't been able to run this so far as I don't have the hardware. I did leave two questions on things that looked "off" to me, but I am not familiar with laze and RIOT, so I might be missing some context.

Comment on lines +16 to +17
debug = true
lto = false
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we have debug info on and link time optimizations off?

info!("Generating 1 key pairs");

let ticks = benchmark(1, || {
let _ = mlkem::generate_key_pair(randomness_gen);
Copy link
Member

Choose a reason for hiding this comment

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

Should these maybe be black-boxed so the calls are not optimized away? Same for the other calls in the benchmark closures.

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.

2 participants