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

WASI-20. Low memory prover (512k possible). Native pthread support (15s wasm time). #434

Merged
merged 111 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
40245cc
Rm foundation
charlielye Apr 9, 2023
807882e
Remove foundation submodule, add build-system
charlielye Apr 9, 2023
c9922f1
Initial bindgen work.
charlielye Apr 9, 2023
9ebd5e0
Schnorr and blake2s binds/tests.
charlielye Apr 10, 2023
a1d0e9b
Tidy.
charlielye Apr 10, 2023
70d5c74
GPT4 created rust bindgen.
charlielye Apr 10, 2023
e758776
Improve.
charlielye Apr 12, 2023
53e5df7
Merge remote-tracking branch 'origin/master' into cl/ts
charlielye Apr 13, 2023
7bba67a
Broken initial
charlielye Apr 13, 2023
f8c4f85
Almost.£
charlielye Apr 14, 2023
74ef953
Fix test after master merge.
charlielye Apr 14, 2023
a3aca68
Debug build preset wasm-dbg for stack traces etc.
charlielye Apr 15, 2023
aaa97da
Async call support. Refactor binds. Common is module. WASM stubs unus…
charlielye Apr 16, 2023
0ef69cd
Move some c_bind to module root and make use new abi.
charlielye Apr 17, 2023
fee3263
Think things pass.
charlielye Apr 18, 2023
68055c2
Poly store returns value.
charlielye Apr 22, 2023
8ca5058
Wasm build
charlielye Apr 22, 2023
efbc030
Debugging...
charlielye Apr 23, 2023
8fc4eb8
Debugging
charlielye Apr 23, 2023
5158866
Fix bootstrap errors.
suyash67 Apr 24, 2023
2d9d65d
hacky fix (still to get to the bottom of this).
suyash67 Apr 24, 2023
028ed58
Fiddling with threads.
charlielye Apr 25, 2023
0fa9271
Fix (other address should also be "unsigned", thanks to Charlie)
suyash67 Apr 25, 2023
d934377
Merge branch 'cl/poly_store' into cl/wasm_pthread
charlielye Apr 25, 2023
1e4cbf2
Initial working pthreads.
charlielye Apr 26, 2023
b3b7662
Cond var example.
charlielye Apr 27, 2023
b15338a
Threading work.
charlielye Apr 29, 2023
29c43e0
Some cleanup/fixes
charlielye Apr 29, 2023
930d8b6
More threading.
charlielye Apr 29, 2023
3d4d636
Cheapen some polynomial copies. Remove more openmp.
charlielye Apr 30, 2023
a887501
Polynomial cache
charlielye Apr 30, 2023
cdffae8
Some cleanup
charlielye May 2, 2023
c58be5f
Custom poly allocator. Prealloc.
charlielye May 3, 2023
8bada76
Working.
charlielye May 4, 2023
ebade1f
Yarn release
charlielye May 4, 2023
e0b671a
Rename mem_slab_get and comments.
charlielye May 4, 2023
446f558
Merge branch 'master' into cl/wasm_pthread
charlielye May 5, 2023
98d19e2
Fix.
charlielye May 6, 2023
c8b7c38
Move env into common as there's dependencies both ways (logstr).
charlielye May 6, 2023
ee087ca
Merge remote-tracking branch 'origin/master' into cl/wasm_pthread
charlielye May 6, 2023
45814b2
Bump
charlielye May 6, 2023
7dfb814
Removing openmp
charlielye May 6, 2023
c270487
Worker threads.
charlielye May 6, 2023
fc81035
Revert "Removing openmp"
charlielye May 6, 2023
2611241
omp
charlielye May 6, 2023
444abb4
Cleanup. Several parallel_for solutions. Might be worth keeping them …
charlielye May 8, 2023
62619d2
Improve mem usage by slab allocating large parts of pippenger runtime…
charlielye May 8, 2023
e3b8541
Don't need binaryen.
charlielye May 8, 2023
e17d273
Clean
charlielye May 8, 2023
71747c6
Clean£
charlielye May 8, 2023
75d7b10
Clean
charlielye May 8, 2023
22fc7e9
WASI stuff.
charlielye May 9, 2023
c719062
Initial
charlielye May 13, 2023
93e99f0
This is getting seriously on point.
charlielye May 13, 2023
15acac9
Bindgen tweaks
charlielye May 13, 2023
e7a2969
Tests pass
charlielye May 13, 2023
7321153
Logging cleanup etc.
charlielye May 14, 2023
559e220
Merge remote-tracking branch 'origin/master' into cl/wasm_pthread_bro…
charlielye May 14, 2023
33debd9
Fix bootstrap.
charlielye May 14, 2023
9ce65c7
Fix
charlielye May 15, 2023
9f8030e
Bump alpine to get clang 16
charlielye May 15, 2023
913da64
Fixes.
charlielye May 15, 2023
d5a42bc
Fix.
charlielye May 15, 2023
ac86b44
Fix.
charlielye May 15, 2023
349d11b
Some fixes.
charlielye May 15, 2023
9cc038a
Fixes.
charlielye May 16, 2023
0447d76
Fix
charlielye May 16, 2023
516185f
Backwards compatible cbinds.
charlielye May 16, 2023
b55f644
Backout the shallow copying of polynomials, and ensure we take ref/ptrs.
charlielye May 16, 2023
7633f20
Fix
charlielye May 16, 2023
2da14f1
Move slab allocator to common. Init slab allocator just before creati…
charlielye May 16, 2023
31073cf
Merge remote-tracking branch 'origin/master' into cl/wasm_pthread
charlielye May 17, 2023
0a4213d
Merge remote-tracking branch 'origin/master' into cl/wasm_pthread
charlielye May 20, 2023
ebc582b
Slab allocator cleanup fix.
charlielye May 20, 2023
99d18fb
Stablise.
charlielye May 20, 2023
1b36d18
Fix
charlielye May 20, 2023
aaa0f96
Dont need bleeding edge fork of libc anymore
charlielye May 20, 2023
3be0eb6
Someone didn't format msgpack so im reverting and using --no-verify t…
charlielye May 20, 2023
f9bfbe7
bb.js is standalone prover that handles noir constraint/witness outpu…
charlielye Jun 1, 2023
d3e5d0a
Merge remote-tracking branch 'origin/master' into cl/wasm_pthread
charlielye Jun 1, 2023
65dffba
Fixes
charlielye Jun 2, 2023
a4045cc
wip
charlielye Jun 4, 2023
877c12c
Remove && refs.
charlielye Jun 4, 2023
fbc6da5
playing with caches.
charlielye Jun 4, 2023
edbf8ed
Fast cache
charlielye Jun 4, 2023
3f5a26b
Back out some conatiner slab stuff. Cleanup. Fixes.
charlielye Jun 4, 2023
701dbed
README.
charlielye Jun 5, 2023
14ac983
bb.js improv.
charlielye Jun 5, 2023
ed15f99
Bump
charlielye Jun 5, 2023
ea026aa
Merge remote-tracking branch 'origin/master' into cl/wasm_pthread
charlielye Jun 5, 2023
16b203b
Merge branch 'cl/wasm_pthread_swap_mem_working' into cl/wasm_pthread
charlielye Jun 5, 2023
3a4fd7c
Fix horrific nasty memory bug.
charlielye Jun 6, 2023
c569502
cbind stuff. size hint stuff.
charlielye Jun 6, 2023
487b9c2
Out-of-scope fix
Rumata888 Jun 6, 2023
9c006d8
Second fix
Rumata888 Jun 6, 2023
ef400d4
Same fixes for standard and turbo
Rumata888 Jun 6, 2023
e1ea4e5
rename tests
vezenovm Jun 6, 2023
b861429
Lots of goodness. Initial attempt to test in ci.
charlielye Jun 6, 2023
5034a96
ci
charlielye Jun 7, 2023
91f92cf
Fix
charlielye Jun 7, 2023
0fd4310
header update.
charlielye Jun 7, 2023
9eaee43
Test readme
charlielye Jun 7, 2023
b5393e3
Init global crs from string.
codygunton Jun 7, 2023
5838174
Bump packages commit (circuits tests should pass)
codygunton Jun 8, 2023
1cdf4f5
Use global SRS in tests
codygunton Jun 8, 2023
38d6e6e
Fix file crs wasm.
charlielye Jun 8, 2023
53b8b06
Merge branch 'cl/wasm_pthread' of github.com:aztecprotocol/barretenbe…
charlielye Jun 8, 2023
6d842f3
Fix loc and get the srs
codygunton Jun 8, 2023
8f38a00
Fix.
charlielye Jun 8, 2023
b488545
Merge branch 'cl/wasm_pthread' of github.com:aztecprotocol/barretenbe…
charlielye Jun 8, 2023
7608038
Fix recursion tests
codygunton Jun 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 0 additions & 13 deletions .circleci/cond_spot_run_test_script

This file was deleted.

39 changes: 31 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#
# The docker executor uses a custom image build in `build_image`. It's specifically streamlined for fast download
# with just enough tools to execute the build system, and launch EC2 instances etc.
#
# There are some `join` steps that are just noops. They are just used to produce cleaner graph rendering in CCI.

version: 2.1

Expand All @@ -37,11 +35,6 @@ checkout: &checkout
chmod 0700 .ssh
ssh-keyscan -t rsa github.com >> .ssh/known_hosts

# A read only key for cloning the repository.
echo $GIT_CHECKOUT_KEY | base64 -d > .ssh/id_rsa

chmod 0600 .ssh/id_rsa

# IF YOU'RE CHANGING THIS, YOU ALSO WANT TO CHANGE: build-system/remote_build/remote_build
# Shallow checkout this commit.
mkdir -p project
Expand Down Expand Up @@ -246,6 +239,28 @@ jobs:
name: "Test"
command: store_test_benchmark_logs barretenberg-x86_64-linux-clang-assert

bb-js:
machine:
image: ubuntu-2004:202010-01
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: "Build"
command: build bb.js

bb-js-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests bb.js

###################################
# Aztec integration tests
circuits-wasm-linux-clang-builder-runner:
Expand Down Expand Up @@ -348,8 +363,16 @@ workflows:
only:
- master
<<: *defaults
- bb-js:
requires:
- wasm-linux-clang
<<: *defaults
- bb-js-tests:
requires:
- bb-js
<<: *defaults
- circuits-wasm-linux-clang-builder-runner: *notmaster
- circuits-x86_64-linux-clang-builder-runner: *notmaster
- circuits-x86_64-linux-clang-builder-runner: *notmaster
- circuits-wasm-tests:
requires:
- circuits-wasm-linux-clang-builder-runner
Expand Down
6 changes: 0 additions & 6 deletions .gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "foundation"]
path = foundation
url = git@github.com:AztecProtocol/foundation.git
[submodule "sol/lib/forge-std"]
path = sol/lib/forge-std
url = https://github.com/foundry-rs/forge-std
Expand Down
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/cpp/src/aztec"
"${workspaceFolder}/cpp/src/barretenberg"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
Expand Down
11 changes: 7 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,21 @@
"charconv": "cpp",
"span": "cpp",
"*.inc": "cpp",
"*.macros": "cpp"
"*.macros": "cpp",
"cuchar": "cpp"
},
"solidity.compileUsingRemoteVersion": "v0.6.10+commit.00c0fcaf",
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
"**/.pnp.*": true,
"**/msgpack-c/**": true
},
"typescript.tsdk": "ts/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"eslint.nodePath": "ts/.yarn/sdks",
"prettier.prettierPath": "ts/.yarn/sdks/prettier/index.js",
"[cpp]": { // doesn't conflict with barratenberg.code-workspace settings.
"[cpp]": {
// doesn't conflict with barratenberg.code-workspace settings.
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
"[terraform]": {
Expand All @@ -128,4 +131,4 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cmake.sourceDirectory": "${workspaceFolder}/cpp"
}
}
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions .yarnrc.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ CMake can be passed various build options on its command line:
- `-DCMAKE_BUILD_TYPE=Debug | Release | RelWithAssert`: Build types.
- `-DDISABLE_ASM=ON | OFF`: Enable/disable x86 assembly.
- `-DDISABLE_ADX=ON | OFF`: Enable/disable ADX assembly instructions (for older cpu support).
- `-DMULTITHREADING=ON | OFF`: Enable/disable multithreading using OpenMP.
- `-DMULTITHREADING=ON | OFF`: Enable/disable multithreading.
- `-DOMP_MULTITHREADING=ON | OFF`: Enable/disable multithreading that uses OpenMP.
- `-DTESTING=ON | OFF`: Enable/disable building of tests.
- `-DBENCHMARK=ON | OFF`: Enable/disable building of benchmarks.
- `-DFUZZING=ON | OFF`: Enable building various fuzzers.
Expand Down
52 changes: 0 additions & 52 deletions bootstrap_docker.sh

This file was deleted.

5 changes: 5 additions & 0 deletions build_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@
"dockerfile": "dockerfiles/Dockerfile.circuits-wasm-linux-clang-builder-runner",
"rebuildPatterns": ["^cpp/"],
"dependencies": []
},
"bb.js": {
"buildDir": "ts",
"rebuildPatterns": ["^ts/"],
"dependencies": ["barretenberg-wasm-linux-clang"]
}
}
2 changes: 1 addition & 1 deletion cpp/.aztec-packages-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
84754bbb47e32c722a9c13de17c328ae15e58f01
1dbca53b4cf6c83d1a25be66bb7b7f4a9d5e484b
4 changes: 0 additions & 4 deletions cpp/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
build*
docker*
scripts
.*
src/wasi-sdk*
src/barretenberg/rollup/proofs/root_*/fixtures/account
src/barretenberg/rollup/proofs/root_*/fixtures/join_split
src/barretenberg/rollup/proofs/root_*/fixtures/**/proving_key
srs_db/ignition/transcript*
srs_db/lagrange
srs_db/coset_lagrange
srs_db/modified_lagrange
8 changes: 3 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ project(
option(DISABLE_ASM "Disable custom assembly" OFF)
option(DISABLE_ADX "Disable ADX assembly variant" OFF)
option(MULTITHREADING "Enable multi-threading" ON)
option(OMP_MULTITHREADING "Enable OMP multi-threading" ON)
option(TESTING "Build tests" ON)
option(BENCHMARKS "Build benchmarks" ON)
option(FUZZING "Build fuzzing harnesses" OFF)
Expand All @@ -23,8 +24,6 @@ option(ENABLE_ASAN "Address sanitizer for debugging tricky memory corruption" OF
option(ENABLE_HEAVY_TESTS "Enable heavy tests when collecting coverage" OFF)
option(INSTALL_BARRETENBERG "Enable installation of barretenberg. (Projects embedding barretenberg may want to turn this OFF.)" ON)

message(STATUS "Building barretenberg for UltraPlonk Composer.")

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
message(STATUS "Compiling for ARM.")
set(ARM ON)
Expand Down Expand Up @@ -74,7 +73,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "wasm32")
message(STATUS "Compiling for WebAssembly.")
set(WASM ON)
set(DISABLE_ASM ON)
set(MULTITHREADING OFF)
set(OMP_MULTITHREADING OFF)
set(BENCHMARKS OFF)
set(DISABLE_TBB 1)
add_compile_definitions(_WASI_EMULATED_PROCESS_CLOCKS=1)
Expand All @@ -99,7 +98,6 @@ else()
endif()

if(COVERAGE)

# We've only set up LLVM coverage
if(NOT(CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
message(FATAL_ERROR "Creating coverage is only available for clang")
Expand Down Expand Up @@ -141,4 +139,4 @@ include(cmake/threading.cmake)
include(cmake/gtest.cmake)
include(cmake/benchmark.cmake)
include(cmake/module.cmake)
add_subdirectory(src)
add_subdirectory(src)
54 changes: 47 additions & 7 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
"inherits": "clang15",
"environment": {
"CMAKE_BUILD_TYPE": "Debug"
},
"cacheVariables": {
"ENABLE_ASAN": "OFF",
"DISABLE_ASM": "ON"
}
},
{
Expand Down Expand Up @@ -100,12 +104,12 @@
{
"name": "wasm",
"displayName": "Build for WASM",
"description": "Build with a specific wasm-sdk to create wasm",
"description": "Build with wasi-sdk to create wasm",
"binaryDir": "build-wasm",
"generator": "Ninja",
"toolchainFile": "cmake/toolchains/wasm32-wasi.cmake",
"environment": {
"WASI_SDK_PREFIX": "${sourceDir}/src/wasi-sdk-12.0",
"WASI_SDK_PREFIX": "${sourceDir}/src/wasi-sdk-20.0",
"CC": "$env{WASI_SDK_PREFIX}/bin/clang",
"CXX": "$env{WASI_SDK_PREFIX}/bin/clang++",
"AR": "$env{WASI_SDK_PREFIX}/bin/llvm-ar",
Expand All @@ -118,7 +122,31 @@
"CMAKE_FIND_ROOT_PATH_MODE_INCLUDE": "ONLY",
"CMAKE_FIND_ROOT_PATH_MODE_PACKAGE": "ONLY",
"CMAKE_C_COMPILER_WORKS": "ON",
"CMAKE_CXX_COMPILER_WORKS": "ON"
"CMAKE_CXX_COMPILER_WORKS": "ON",
"MULTITHREADING": "OFF"
}
},
{
"name": "wasm-dbg",
"displayName": "Build for debug WASM",
"description": "Build with wasi-sdk to create debug wasm",
"inherits": "wasm",
"environment": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "wasm-threads",
"displayName": "Build for pthread enabled WASM",
"description": "Build for pthread enabled WASM",
"inherits": "wasm",
"binaryDir": "build-wasm-threads",
"environment": {
"WASI_SDK_PREFIX": "${sourceDir}/src/wasi-sdk-20.0+threads",
"CMAKE_BUILD_TYPE": "Release"
},
"cacheVariables": {
"MULTITHREADING": "ON"
}
}
],
Expand Down Expand Up @@ -174,9 +202,21 @@
"configurePreset": "wasm",
"inheritConfigureEnvironment": true,
"jobs": 0,
"targets": [
"barretenberg.wasm"
]
"targets": ["barretenberg.wasm"]
},
{
"name": "wasm-dbg",
"configurePreset": "wasm-dbg",
"inheritConfigureEnvironment": true,
"jobs": 0,
"targets": ["barretenberg.wasm"]
},
{
"name": "wasm-threads",
"configurePreset": "wasm-threads",
"inheritConfigureEnvironment": true,
"jobs": 0,
"targets": ["barretenberg.wasm"]
}
],
"testPresets": [
Expand Down Expand Up @@ -231,4 +271,4 @@
"inheritConfigureEnvironment": true
}
]
}
}
12 changes: 6 additions & 6 deletions cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -eu
# Clean.
rm -rf ./build
rm -rf ./build-wasm
rm -rf ./src/wasi-sdk-*

# Install formatting git hook.
HOOKS_DIR=$(git rev-parse --git-path hooks)
Expand Down Expand Up @@ -63,12 +62,13 @@ echo "#################################"
cmake --preset $PRESET -DCMAKE_BUILD_TYPE=RelWithAssert
cmake --build --preset $PRESET ${@/#/--target }

# Install the webassembly toolchain.
WASI_VERSION=12
cd ./src
curl -s -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_VERSION/wasi-sdk-$WASI_VERSION.0-$OS.tar.gz | tar zxfv -
cd ..
# Install wasi-sdk.
./scripts/install-wasi-sdk.sh

# Build WASM.
cmake --preset wasm
cmake --build --preset wasm

# Build WASM with new threading.
cmake --preset wasm-threads
cmake --build --preset wasm-threads
Loading