-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Changing finite field arithmetic in wasm to 29 bits for multipl…
…ications (#5435) Now when we compile for wasm we use 9 29-bit limbs to perform all multiplications. In wasmtime this results in -10% for multiplication benchmark and -35% in squaring. This makes a -7% impact on wasm client_ivc. Other changes: 1. Most of the changes are just additions to tests to handle the new montgomery form, because we have a lot of hardcoded internal representations. If we get a new one, we should rewrite those to use non-montgomery form. Also we need to recompute all parameters. 2. Added squarings to univariate and used in some relations 3. Added a script to run wasmer instead of wasmtime on the benchmark (but you need to change arguments slightly to add "--") 4. For some reason wasm build has become really slow (especially on relations and protogalaxy). 5. Added docs ![image](https://github.com/AztecProtocol/aztec-packages/assets/4798775/d5135995-c318-406d-a65a-587bdd3baae1)
- Loading branch information
Showing
37 changed files
with
1,813 additions
and
419 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
# This script automates the process of benchmarking WASM on a remote EC2 instance. | ||
# Prerequisites: | ||
# 1. Define the following environment variables: | ||
# - BB_SSH_KEY: SSH key for EC2 instance, e.g., '-i key.pem' | ||
# - BB_SSH_INSTANCE: EC2 instance URL | ||
# - BB_SSH_CPP_PATH: Path to barretenberg/cpp in a cloned repository on the EC2 instance | ||
set -eu | ||
|
||
BENCHMARK=${1:-goblin_bench} | ||
COMMAND=${2:-./$BENCHMARK} | ||
HARDWARE_CONCURRENCY=${HARDWARE_CONCURRENCY:-16} | ||
|
||
# Move above script dir. | ||
cd $(dirname $0)/.. | ||
|
||
# Configure and build. | ||
cmake --preset wasm-threads | ||
cmake --build --preset wasm-threads --parallel --target $BENCHMARK | ||
|
||
source scripts/_benchmark_remote_lock.sh | ||
|
||
cd build-wasm-threads | ||
# ensure folder structure | ||
ssh $BB_SSH_KEY $BB_SSH_INSTANCE "mkdir -p $BB_SSH_CPP_PATH/build-wasm-threads" | ||
# copy build wasm threads | ||
scp $BB_SSH_KEY ./bin/$BENCHMARK $BB_SSH_INSTANCE:$BB_SSH_CPP_PATH/build-wasm-threads | ||
# run wasm benchmarking | ||
ssh $BB_SSH_KEY $BB_SSH_INSTANCE \ | ||
"cd $BB_SSH_CPP_PATH/build-wasm-threads ; /home/ubuntu/.wasmer/bin/wasmer run --dir=$BB_SSH_CPP_PATH --enable-threads --env HARDWARE_CONCURRENCY=$HARDWARE_CONCURRENCY $COMMAND" |
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
Oops, something went wrong.