From 60ebc0d907b0095c756d0b49977307890aa6ea4e Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Wed, 22 Apr 2020 17:05:48 +0800 Subject: [PATCH 1/8] readme asm instructions --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e6032d..142ca76 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ cargo build --release This library comes with unit tests for each of the provided crates. Run the tests with: ```bash cargo test -``` +``` -Lastly, this library comes with benchmarks for the following crates: +This library comes with benchmarks for the following crates: - [`algebra`](algebra) - [`dpc`](dpc) @@ -76,6 +76,16 @@ These benchmarks require the nightly Rust toolchain; to install this, run `rustu cargo +nightly bench ``` +To make use of `adcxq`, `adoxq` and `mulxq` available on most modern `x86_64` platforms (at least starting from Haswell): +```bash +RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm +``` + +To run with multiple features, make sure to double quote the features. E.g. +```bash +RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test --features "asm bls12_381" +``` + ## License ZEXE is licensed under either of the following licenses, at your discretion. From 2d0f2943e09f1566d23cd803a456f2f2e4c4a559 Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Wed, 22 Apr 2020 17:10:08 +0800 Subject: [PATCH 2/8] More detailed readme instructions --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 142ca76..eaf08e4 100644 --- a/README.md +++ b/README.md @@ -76,12 +76,12 @@ These benchmarks require the nightly Rust toolchain; to install this, run `rustu cargo +nightly bench ``` -To make use of `adcxq`, `adoxq` and `mulxq` available on most modern `x86_64` platforms (at least starting from Haswell): +To make use of `adcxq`, `adoxq` and `mulxq` available on most modern `x86_64` platforms (Broadwell onwards for Intel and Ryzen onwards for AMD), leading to a 30-70% speedup, run the following: ```bash RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm ``` -To run with multiple features, make sure to double quote the features. E.g. +To run with multiple features, make sure to double quote the features. e.g. ```bash RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test --features "asm bls12_381" ``` From 33583be17a21f442db365cca430bf624db53bf64 Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Wed, 22 Apr 2020 17:14:40 +0800 Subject: [PATCH 3/8] more readme edits --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eaf08e4..6445730 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ These benchmarks require the nightly Rust toolchain; to install this, run `rustu cargo +nightly bench ``` -To make use of `adcxq`, `adoxq` and `mulxq` available on most modern `x86_64` platforms (Broadwell onwards for Intel and Ryzen onwards for AMD), leading to a 30-70% speedup, run the following: +Compiling with `adcxq`, `adoxq` and `mulxq` instructions can lead to a 30-70% speedup. These are available on most `x86_64` platforms (Broadwell onwards for Intel and Ryzen onwards for AMD). Run the following command: ```bash RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm ``` From 4e85a68d0f10d95d13cbee0d54d024db01f7e006 Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Wed, 22 Apr 2020 23:33:40 +0800 Subject: [PATCH 4/8] update readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6445730..77d37ca 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,12 @@ To run with multiple features, make sure to double quote the features. e.g. RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test --features "asm bls12_381" ``` +To bench `algebra-benches` with greater accuracy, especially for functions with execution times on the order of nanoseconds, use the `n_fold` feature +```bash +cargo +nightly bench --features "n_fold bls12_381" +``` + + ## License ZEXE is licensed under either of the following licenses, at your discretion. From 0b85f5cfa13f16e259ca72760e3bc6d4f09c8b86 Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Wed, 22 Apr 2020 23:34:17 +0800 Subject: [PATCH 5/8] update readme --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 77d37ca..c9a7295 100644 --- a/README.md +++ b/README.md @@ -81,12 +81,7 @@ Compiling with `adcxq`, `adoxq` and `mulxq` instructions can lead to a 30-70% sp RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm ``` -To run with multiple features, make sure to double quote the features. e.g. -```bash -RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test --features "asm bls12_381" -``` - -To bench `algebra-benches` with greater accuracy, especially for functions with execution times on the order of nanoseconds, use the `n_fold` feature +To bench `algebra-benches` with greater accuracy, especially for functions with execution times on the order of nanoseconds, use the `n_fold` feature. To run with multiple features, make sure to double quote the features. ```bash cargo +nightly bench --features "n_fold bls12_381" ``` From a919e8658c0f2422872f92147dea010f376b1e49 Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Wed, 22 Apr 2020 23:35:34 +0800 Subject: [PATCH 6/8] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9a7295..5ebbdf2 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Compiling with `adcxq`, `adoxq` and `mulxq` instructions can lead to a 30-70% sp RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm ``` -To bench `algebra-benches` with greater accuracy, especially for functions with execution times on the order of nanoseconds, use the `n_fold` feature. To run with multiple features, make sure to double quote the features. +To bench `algebra-benches` with greater accuracy, especially for functions with execution times on the order of nanoseconds, use the `n_fold` feature to run selected functions 1000x per iteration. To run with multiple features, make sure to double quote the features. ```bash cargo +nightly bench --features "n_fold bls12_381" ``` From 535f93d3784e0fdd11dbba4ee224ab9cf6aed682 Mon Sep 17 00:00:00 2001 From: jon-chuang <9093549+jon-chuang@users.noreply.github.com> Date: Thu, 23 Apr 2020 01:11:28 +0800 Subject: [PATCH 7/8] --emit=asm seemed to be hurting performance significantly... So lets not recommend it for now. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ebbdf2..e46b5c9 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,9 @@ cargo +nightly bench Compiling with `adcxq`, `adoxq` and `mulxq` instructions can lead to a 30-70% speedup. These are available on most `x86_64` platforms (Broadwell onwards for Intel and Ryzen onwards for AMD). Run the following command: ```bash -RUSTFLAGS="--emit=asm -C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm +RUSTFLAGS="-C target-feature=+bmi2,+adx" cargo +nightly test/build/bench --features asm ``` +Tip: If optimising for performance, your mileage may vary with passing `--emit=asm` to `RUSTFLAGS`. To bench `algebra-benches` with greater accuracy, especially for functions with execution times on the order of nanoseconds, use the `n_fold` feature to run selected functions 1000x per iteration. To run with multiple features, make sure to double quote the features. ```bash From 11e689ddc0cb106b6e6e4240e460effe8c2c012c Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Mon, 4 May 2020 05:15:26 -0700 Subject: [PATCH 8/8] Clean up features, and make nightly detection robust --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e46b5c9..38f67ac 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ Informally, the library provides the ability to create transactions that run arb This repository contains several Rust crates that implement the different building blocks of ZEXE. The high-level structure of the repository is as follows. -* [`algebra`](algebra): Rust crate that provides finite fields and elliptic curves +* [`algebra-core`](algebra-core): Rust crate that provides generic arithmetic for finite fields and elliptic curves +* [`algebra`](algebra): Rust crate that provides concrete instantiations of some finite fields and elliptic curves * [`crypto-primitives`](crypto-primitives): Rust crate that implements some useful cryptographic primitives (and constraints for them) * [`dpc`](dpc): Rust crate that implements DPC schemes (the main cryptographic primitive in this repository) * [`ff-fft`](ff-fft): Rust crate that provides efficient finite field polynomial arithmetic based on finite field FFTs