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

chore: migrate from Bn256Engine to Bn256EngineKGZ #1093

Merged
merged 4 commits into from
Feb 6, 2024

Conversation

arthurpaulino
Copy link
Contributor

@arthurpaulino arthurpaulino commented Feb 5, 2024

Closes #1079 by following the instructions from #1039 (comment)
Closes #1022
Addresses benchmarks mentioned in #1078

@arthurpaulino arthurpaulino requested a review from a team as a code owner February 5, 2024 15:06
@huitseeker
Copy link
Contributor

This is great, but I'd love to make sure we have benchmarks on Lurk switched to the correct curve cycle before we further change the PCS.

@arthurpaulino arthurpaulino force-pushed the ap/migrate-to-Bn256EngineKGZ branch from c7b9342 to d8ec7b7 Compare February 5, 2024 22:35
@arthurpaulino arthurpaulino requested a review from a team as a code owner February 5, 2024 22:47
@arthurpaulino
Copy link
Contributor Author

!gpu-benchmark

Copy link
Contributor

github-actions bot commented Feb 5, 2024

Benchmark for 222255f

Click to view benchmark
Test Base PR %
LEM Fibonacci Prove - rc = 100/fib/num-100 1719.7±3.90ms 1822.2±6.15ms +5.96%
LEM Fibonacci Prove - rc = 100/fib/num-200 3.3±0.01s 3.5±0.01s +6.06%
LEM Fibonacci Prove - rc = 600/fib/num-100 2.1±0.01s 2.1±0.01s 0.00%
LEM Fibonacci Prove - rc = 600/fib/num-200 3.4±0.01s 3.6±0.02s +5.88%

@arthurpaulino
Copy link
Contributor Author

!gpu-benchmark

@arthurpaulino arthurpaulino force-pushed the ap/migrate-to-Bn256EngineKGZ branch from 13c0e68 to db4c5fd Compare February 6, 2024 14:26
@arthurpaulino
Copy link
Contributor Author

!gpu-benchmark

@arthurpaulino
Copy link
Contributor Author

!gpu-benchmark

Copy link
Contributor

github-actions bot commented Feb 6, 2024

Benchmark for 222255f

Click to view benchmark
Test Base PR %
LEM Fibonacci Prove - rc = 100/fib/num-100 1743.1±5.05ms 1485.5±8.59ms -14.78%
LEM Fibonacci Prove - rc = 100/fib/num-200 3.4±0.01s 2.8±0.01s -17.65%
LEM Fibonacci Prove - rc = 600/fib/num-100 2.1±0.00s 1850.1±18.65ms -11.90%
LEM Fibonacci Prove - rc = 600/fib/num-200 3.4±0.01s 3.1±0.02s -8.82%

Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

Thanks a lot, this LGTM : a few non-blocking comments, leaving this as comment to give you an opportunity to address them, ping me if you want an approval.

@@ -96,12 +96,12 @@ fn compute_coeffs<F: LurkField>(store: &Store<F>) -> (usize, usize) {
}

pub(crate) fn test_coeffs() {
let store = Store::<pasta_curves::Fq>::default();
let store = Store::<halo2curves::bn256::Fr>::default();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: we have a clippy config to refer to the field types of our main fields in https://github.com/lurk-lab/lurk-rs/blob/main/.clippy.toml and we should adapt this to bn254/grumpkin (or open an issue to do it later)

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 want to open an issue but I don't know the names we want to actually use to refer to them. I don't see the equivalent *::Scalar/*::Base aliases in halo2curves. What do you suggest?

Copy link
Contributor

@huitseeker huitseeker Feb 6, 2024

Choose a reason for hiding this comment

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

Here's how we create that alias on Arecibo:
https://github.com/lurk-lab/arecibo/blob/788e8788dc190c1875f0b37faccd6a7b13e51d76/src/provider/bn256_grumpkin.rs#L21-L32
I'd suggest copying those lines in a sensible place in Lurk.

@@ -188,25 +182,25 @@ fn eval_benchmark(c: &mut Criterion) {
// .sample_size(60);

// let limit = 1_000_000_000;
// let _lang_pallas = Lang::<Fq, Coproc<Fq>>::new();
// let lang_pallas = Lang::<Fq, Coproc<Fq>>::new();
// let _lang = Lang::<Bn, Coproc<Bn>>::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would leave the todo and try uncommenting, so that this function does not bit-rot. As long as this function is not included in a criterion_main! invocation, it won't be run. We can open an issue and assign to whomever git blame is pointing at for leaving this around.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function doesn't contain key code we'd want to maintain in order to eventually implement a circuit generation benchmark. So I'd rather to just delete it and then open an issue for this task.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm OK with deleting, we already have an issue (#283)

@arthurpaulino arthurpaulino added this pull request to the merge queue Feb 6, 2024
Merged via the queue into main with commit 50e977c Feb 6, 2024
11 checks passed
@arthurpaulino arthurpaulino deleted the ap/migrate-to-Bn256EngineKGZ branch February 6, 2024 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants