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

Add Nova Public Parameter benchmark for SDK #267

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Add Nova Public Parameter benchmark for SDK #267

merged 1 commit into from
Aug 21, 2024

Conversation

duc-nx
Copy link
Contributor

@duc-nx duc-nx commented Aug 8, 2024

Copy link

vercel bot commented Aug 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nexus-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 6:00pm

@@ -70,3 +70,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: bnjbvr/cargo-machete@main

bench-riscv:
Copy link
Contributor

Choose a reason for hiding this comment

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

Benches for every small commit is too much, for example we don't run nova benchmarks as a workflow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I run this part in my local and it's fast enough to run on CI. It takes 5 minutes CI, I think it's alright.
Because I want to have continuous benchmarking flow on CI.
I can add a label feature, whenever the benchmark label is added, the CI workflow benchmark will be executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added in #265

@duc-nx duc-nx added the benchmark Enable benchmark CI label Aug 9, 2024
@duc-nx duc-nx marked this pull request as ready for review August 9, 2024 22:44
@duc-nx duc-nx requested a review from slumber August 19, 2024 15:40
Copy link
Contributor

@sjudson sjudson left a comment

Choose a reason for hiding this comment

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

Benching public parameter generation should live in nova-benches/, not sdk/.

@duc-nx
Copy link
Contributor Author

duc-nx commented Aug 21, 2024

I had a hard time moving from sdk to nova-benches, mainly because of the type PP is defined in sdk. I would need to duplicate the PP type and trait in nova-benches similar to sdk, this is redundant work.
Can I let the benchmark run under sdk?

@sjudson
Copy link
Contributor

sjudson commented Aug 21, 2024

You don't need to use the PP type from sdk, you can use the nova specific parameter types (as is used, e.g., in nova-benches/ at present: https://github.com/nexus-xyz/nexus-zkvm/blob/main/nova-benches/benches/nova.rs#L20).

@@ -4,6 +4,7 @@ use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError};
use nexus_nova::StepCircuit;
use std::marker::PhantomData;

#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be dead code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is a shared code, it is used in other benches, however I don't use the NUM_WARMUP_STEPS in my code, so I turn off the clippy warning in compilation.

Copy link
Contributor

Choose a reason for hiding this comment

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

True I guess it is dead for that individual build... I mean it's all test code so I guess that's fine...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

coincidently, the value of NUM_WARMUP_STEPS is 10, the minimum I need in criterion sample size is 10, I can plug in this value in my code and get rid of the allow[dead_code], but the variable name doesn't quite describe what the situation.

@duc-nx
Copy link
Contributor Author

duc-nx commented Aug 21, 2024

moved to nova-benches/ in b7d1403

@@ -90,3 +90,13 @@ jobs:
run: |
cargo bench --bench riscv_machine

bench-nova-public-params:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not also benchmark the provers themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I tried, criterion need 10 samples at least, one prover run on CI takes 4-6 minutes, which lead to at least 40 to 60 minutes to benchmark Prover.
I have plan to move all CI tasks, including benchmark prover to self-host Github Action in near future.

Copy link
Contributor

@sjudson sjudson left a comment

Choose a reason for hiding this comment

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

Would be nice to run all of the Nova related benchmarks but this seems like a reasonable start for now.

@duc-nx duc-nx merged commit c703c59 into main Aug 21, 2024
20 checks passed
@duc-nx duc-nx deleted the pr267 branch August 21, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Enable benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants