This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
forked from arkworks-rs/snark
-
Notifications
You must be signed in to change notification settings - Fork 4
Alg Opt with GLV #4
Closed
Closed
Changes from all commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
a64d7fb
First draft affine batch ops & wnaf
jon-chuang b7024dd
changes to mutability and lifetimes
jon-chuang 40ef5d7
delete superfluous files
jon-chuang 0fa5eeb
crazy direction: Passing a FnMut to generate an iterator locally
jon-chuang eebb12b
unsuccessful further attempts
jon-chuang 4d22acf
compile sucess using index approach
jon-chuang bbbec75
fixes for mutable borrows
jon-chuang 3a6e45c
Successfully passed scalar mul test
jon-chuang 5c65917
benchmarks + prefetching
jon-chuang 3bf2bc1
stash
jon-chuang 4bb5ad5
generic impl of batch arith for all affinecurves
jon-chuang 67da071
batched affine formulas for TE - too expensive
jon-chuang 2e54f67
improved TE affine
jon-chuang 62df27d
cleanup batch inversion
jon-chuang e6d28b6
fmt...
jon-chuang 74d9bb7
fix minor error
jon-chuang 908fb73
remove debugging scaffolding
jon-chuang c0a5a07
fmt...
jon-chuang 5c89660
delete batch arith bench as not suitable for criterion or bench
jon-chuang 6359f7c
fix bench removal errors
jon-chuang 56b8181
fmt...
jon-chuang ec2decd
added missing coeff_a
jon-chuang bad37bd
refactor BatchGroupArithmetic to be separate trait
jon-chuang 5b9cae9
Batch verification with radix sort
jon-chuang cbf8e49
Cache-locality & parallelisation
jon-chuang 200f5fa
Successfully impl batch verify
jon-chuang ed7c4a7
added tests and bench for batch_ver, parallel_random_gen, ^ thread util
jon-chuang 0e612e4
fmt
jon-chuang 8819290
enabled missing test
jon-chuang a8e9c18
remove voracious_radix_sort
jon-chuang f6a2392
commented unneeded Instant::now()
jon-chuang 2390243
Fixed batch_ver tests for curves of small or unit cofactor
jon-chuang cbee6a2
split recursive and non-recursive, tidy up shared functionality
jon-chuang 0811a0f
reduce max_logn
jon-chuang 2cbff4d
adjust max_logn further
jon-chuang c138904
Batch MSM, speedup only for bw6 due to poor cache performance
jon-chuang 5068e74
fmt...
jon-chuang e886a38
GLV iBiginteger
jon-chuang 1235117
stash
jon-chuang a60bedc
stash
jon-chuang 31690ce
Merge branch 'jonch/batch_ver' into jonch/glv
jon-chuang ae69a9f
GLV with Parameter-based specialisation
jon-chuang 1cb7e65
GLV lattice basis script success
jon-chuang f68cf6e
Successfully passed tests and benched
jon-chuang cee0204
Improvments to MSM with and bucketed adds using lightweight index sort
jon-chuang 0c3bde5
changed rng to be external parameter for non-parallel batch veri
jon-chuang a87db71
remove bench print scaffolding
jon-chuang 1909a4b
remove old batch_bucketed_add using vectors instead of fixed offsets
jon-chuang 9bfd683
retain parallel batch_add_split
jon-chuang 24fcd36
Comments for batch arith
jon-chuang ed201c0
remove need for hashmap for no std for batch_bucketed_add
jon-chuang 517df11
minor changes
jon-chuang 22a48d3
cleanup
jon-chuang b5852b4
cleanup
jon-chuang af70e80
fmt + use no_std Vec
jon-chuang 4421820
removed std::
jon-chuang 7962c8c
add scratch space
jon-chuang 9318e37
Add GLV for non-batched SW mul
jon-chuang a9c951a
fix for glv_scalar_decomposition when k == MODULUS (subgroup check)
jon-chuang a90dfa5
Fixed performance BUG: unnecessary table generation
jon-chuang 3a70376
GLV -> has_glv(), bigint slice bd check, refactor batch loops, u32 index
jon-chuang e9027c0
clean remove of batch_verify
jon-chuang f65bdef
fix mistake with elems indexing, unused arg for future recursion PR
jon-chuang e5b1182
trivial errors
jon-chuang c0a53df
more minor fixes
jon-chuang 344fbd3
fix issues with batch_ver (.is_zero(), TE affine->proj mul)
jon-chuang 646260b
fix issue with batch_bucketed_add_split
jon-chuang ecdd939
misname
jon-chuang 7ba3688
Success in test and bench \(*v*)/
jon-chuang 9ec6727
tmp commit to cache experimental batch_add_write_shift_..
jon-chuang 1810368
remove batch_add_write_shift..
jon-chuang 58e46b4
optional dep, fmt...
jon-chuang 6a6e2fd
undo accidental deletion of dlsd sort
jon-chuang 9ec0eb7
fmt...
jon-chuang 493626d
cleanup batch bucket add, unify impl
jon-chuang 56bf4f9
no std...
jon-chuang a5640a4
fixed tests
jon-chuang 6b39608
fixed unimplemented for TE, swapped wnaf table row/col for batchaddwrite
jon-chuang 4cf6c5f
wnaf table generation uses fewer copies, remove timing instrumentation
jon-chuang 1a928b0
Minor Cleanup
jon-chuang 5964b4b
Add feature-activated timing instrumentation, reduce code bloat (wnaf)
jon-chuang d9de7b6
unused var, no_std
jon-chuang 5b0872f
Make timing macros defined globally, instrument more code
jon-chuang abad582
instrument w/ tid, better num_rounds est. f64, timing black/whitelisting
jon-chuang 1eacd89
Minor changes
jon-chuang 204ffa5
refactor tests, generic MSM test
jon-chuang 9efaae4
2D test matrix :)
jon-chuang bd82f31
batchaffine
jon-chuang e5cb574
tests
jon-chuang 3ed5d9f
additive features
jon-chuang 2fc20e4
big_n feature for test-benching
jon-chuang f21f40a
prefetch unroll
jon-chuang c605894
minor adjustments
jon-chuang 6a70b67
extension(s -> "")_fields
jon-chuang c83b29d
remove artifacts, fix asm
jon-chuang 3a8e853
uncomment subgroup checks, glv param sources
jon-chuang d8c5d08
Clean up GLV murkiness and add comments
jon-chuang a5f4521
Set defaults for glv_window_size
jon-chuang 6b65eda
refactor glv to use examples
jon-chuang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
macro_rules! batch_arith { | ||
() => { | ||
#[bench] | ||
fn bench_g1_batch_mul_affine(b: &mut ::test::Bencher) { | ||
const SAMPLES: usize = 5000; | ||
|
||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64); | ||
|
||
let mut g: Vec<G1Affine> = (0..SAMPLES) | ||
.map(|_| G1::rand(&mut rng).into_affine()) | ||
.collect(); | ||
|
||
let s: Vec<FrRepr> = (0..SAMPLES) | ||
.map(|_| Fr::rand(&mut rng).into_repr()) | ||
.collect(); | ||
|
||
let now = std::time::Instant::now(); | ||
println!("Start"); | ||
b.iter(|| { | ||
g[..].batch_scalar_mul_in_place::<FrRepr>(&mut s.to_vec()[..], 4); | ||
println!("G1 scalar mul batch affine {:?}", now.elapsed().as_micros()); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn bench_g1_batch_mul_projective(b: &mut ::test::Bencher) { | ||
const SAMPLES: usize = 5000; | ||
|
||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64); | ||
|
||
let mut g: Vec<G1> = (0..SAMPLES).map(|_| G1::rand(&mut rng)).collect(); | ||
|
||
let s: Vec<Fr> = (0..SAMPLES).map(|_| Fr::rand(&mut rng)).collect(); | ||
|
||
let now = std::time::Instant::now(); | ||
b.iter(|| { | ||
g.iter_mut().zip(&s).for_each(|(p, sc)| p.mul_assign(*sc)); | ||
println!("G1 scalar mul proj {:?}", now.elapsed().as_micros()); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn bench_g2_batch_mul_affine(b: &mut ::test::Bencher) { | ||
const SAMPLES: usize = 5000; | ||
|
||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64); | ||
|
||
let mut g: Vec<G2Affine> = (0..SAMPLES) | ||
.map(|_| G2::rand(&mut rng).into_affine()) | ||
.collect(); | ||
|
||
let s: Vec<FrRepr> = (0..SAMPLES) | ||
.map(|_| Fr::rand(&mut rng).into_repr()) | ||
.collect(); | ||
|
||
let now = std::time::Instant::now(); | ||
println!("Start"); | ||
b.iter(|| { | ||
g[..].batch_scalar_mul_in_place::<FrRepr>(&mut s.to_vec()[..], 4); | ||
println!("G2 scalar mul batch affine {:?}", now.elapsed().as_micros()); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn bench_g2_batch_mul_projective(b: &mut ::test::Bencher) { | ||
const SAMPLES: usize = 5000; | ||
|
||
let mut rng = XorShiftRng::seed_from_u64(1231275789u64); | ||
|
||
let mut g: Vec<G2> = (0..SAMPLES).map(|_| G2::rand(&mut rng)).collect(); | ||
|
||
let s: Vec<Fr> = (0..SAMPLES).map(|_| Fr::rand(&mut rng)).collect(); | ||
|
||
let now = std::time::Instant::now(); | ||
b.iter(|| { | ||
g.iter_mut().zip(&s).for_each(|(p, sc)| p.mul_assign(*sc)); | ||
println!("G2 scalar mul proj {:?}", now.elapsed().as_micros()); | ||
}); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ mod pairing; | |
|
||
#[macro_use] | ||
mod utils; | ||
|
||
#[macro_use] | ||
mod batch_arith; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ edition = "2018" | |
|
||
[dependencies] | ||
mince = { path = "../mince" } | ||
paste = "0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?