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

fix: allow passing rayon threads when building aztec images #9096

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

just-mitch
Copy link
Contributor

also, do not do parallel vk generation for mock circuits

do not do parallel vk generation for mock circuits
@just-mitch just-mitch enabled auto-merge (squash) October 8, 2024 20:42
Copy link
Contributor

github-actions bot commented Oct 8, 2024

Changes to public function bytecode sizes

Generated at commit: 5ae00ce4e58a4b6a876bcf5c96198393341a1ce1, compared to commit: 0bda0a4d71ae0fb4352de0746f7d96b63b787888

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
AuthWitTest::consume_public +32 ❌ +3.64%
AuthWitTest::public_dispatch +32 ❌ +1.45%
NFT::transfer_in_public +32 ❌ +0.58%
Token::burn_public +32 ❌ +0.44%
Token::shield +37 ❌ +0.42%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 +37 ❌ +0.39%
Token::transfer_public +32 ❌ +0.33%
TokenBlacklist::shield +37 ❌ +0.31%
TokenBlacklist::burn_public +32 ❌ +0.31%
Uniswap::swap_public +37 ❌ +0.24%
TokenBlacklist::transfer_public +32 ❌ +0.21%
Uniswap::public_dispatch +37 ❌ +0.11%
NFT::public_dispatch +37 ❌ +0.09%
Token::public_dispatch +37 ❌ +0.06%
TokenBlacklist::public_dispatch +37 ❌ +0.03%
AvmTest::public_dispatch -1,241 ✅ -1.33%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
AuthWitTest::consume_public 910 (+32) +3.64%
AuthWitTest::public_dispatch 2,233 (+32) +1.45%
NFT::transfer_in_public 5,597 (+32) +0.58%
Token::burn_public 7,351 (+32) +0.44%
Token::shield 8,920 (+37) +0.42%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 9,430 (+37) +0.39%
Token::transfer_public 9,766 (+32) +0.33%
TokenBlacklist::shield 11,884 (+37) +0.31%
TokenBlacklist::burn_public 10,315 (+32) +0.31%
Uniswap::swap_public 15,359 (+37) +0.24%
TokenBlacklist::transfer_public 15,600 (+32) +0.21%
Uniswap::public_dispatch 33,525 (+37) +0.11%
NFT::public_dispatch 39,970 (+37) +0.09%
Token::public_dispatch 67,222 (+37) +0.06%
TokenBlacklist::public_dispatch 130,933 (+37) +0.03%
AvmTest::public_dispatch 92,360 (-1,241) -1.33%

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Changes to circuit sizes

Generated at commit: 5ae00ce4e58a4b6a876bcf5c96198393341a1ce1, compared to commit: 0bda0a4d71ae0fb4352de0746f7d96b63b787888

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
parity_root 0 ➖ 0.00% -14 ✅ -0.00%
rollup_base -1 ✅ -0.00% -20 ✅ -0.00%
public_kernel_tail -2 ✅ -0.00% -21 ✅ -0.00%
rollup_block_merge -2 ✅ -0.00% -27 ✅ -0.00%
rollup_root -2 ✅ -0.00% -27 ✅ -0.00%
public_kernel_merge -2 ✅ -0.00% -21 ✅ -0.00%
public_kernel_inner -3 ✅ -0.00% -17 ✅ -0.00%
private_kernel_reset -2 ✅ -0.00% -19 ✅ -0.00%
rollup_block_root -2 ✅ -0.05% -179 ✅ -0.01%
rollup_merge -2 ✅ -0.05% -179 ✅ -0.01%
private_kernel_reset_4_4_4_4_4_4_4_4_1 -2 ✅ -0.01% -20 ✅ -0.03%
private_kernel_tail_to_public -2 ✅ -0.01% -18 ✅ -0.05%
parity_base 0 ➖ 0.00% -15 ✅ -0.05%
private_kernel_tail -2 ✅ -0.04% -18 ✅ -0.20%
private_kernel_empty -1 ✅ -0.15% -18 ✅ -0.52%
rollup_block_root_empty -1 ✅ -0.79% -16 ✅ -0.55%
private_kernel_inner -110 ✅ -0.25% -449 ✅ -0.86%
private_kernel_init -110 ✅ -0.44% -448 ✅ -1.39%
empty_nested 0 ➖ +∞% -17 ✅ -80.95%
empty_nested_simulated 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_empty_simulated 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_init_simulated 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_inner_simulated 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_reset_simulated 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_reset_simulated_4_4_4_4_4_4_4_4_1 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_tail_simulated 0 ➖ 0.00% -17 ✅ -80.95%
private_kernel_tail_to_public_simulated 0 ➖ 0.00% -17 ✅ -80.95%
public_kernel_inner_simulated 0 ➖ 0.00% -15 ✅ -93.75%
public_kernel_merge_simulated 0 ➖ 0.00% -15 ✅ -93.75%
public_kernel_tail_simulated 0 ➖ 0.00% -15 ✅ -93.75%
rollup_base_simulated 0 ➖ 0.00% -15 ✅ -93.75%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
parity_root 5,399 (0) 0.00% 3,775,111 (-14) -0.00%
rollup_base 671,887 (-1) -0.00% 3,525,974 (-20) -0.00%
public_kernel_tail 258,422 (-2) -0.00% 2,270,239 (-21) -0.00%
rollup_block_merge 41,535 (-2) -0.00% 1,983,356 (-27) -0.00%
rollup_root 41,519 (-2) -0.00% 1,983,340 (-27) -0.00%
public_kernel_merge 53,488 (-2) -0.00% 1,103,539 (-21) -0.00%
public_kernel_inner 268,756 (-3) -0.00% 516,561 (-17) -0.00%
private_kernel_reset 91,931 (-2) -0.00% 467,711 (-19) -0.00%
rollup_block_root 4,186 (-2) -0.05% 2,837,152 (-179) -0.01%
rollup_merge 3,671 (-2) -0.05% 1,896,067 (-179) -0.01%
private_kernel_reset_4_4_4_4_4_4_4_4_1 34,895 (-2) -0.01% 74,459 (-20) -0.03%
private_kernel_tail_to_public 29,826 (-2) -0.01% 39,492 (-18) -0.05%
parity_base 5,371 (0) 0.00% 32,278 (-15) -0.05%
private_kernel_tail 4,742 (-2) -0.04% 9,023 (-18) -0.20%
private_kernel_empty 670 (-1) -0.15% 3,468 (-18) -0.52%
rollup_block_root_empty 125 (-1) -0.79% 2,907 (-16) -0.55%
private_kernel_inner 43,932 (-110) -0.25% 51,905 (-449) -0.86%
private_kernel_init 24,893 (-110) -0.44% 31,835 (-448) -1.39%
empty_nested 0 (0) +∞% 4 (-17) -80.95%
empty_nested_simulated 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_empty_simulated 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_init_simulated 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_inner_simulated 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_reset_simulated 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_reset_simulated_4_4_4_4_4_4_4_4_1 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_tail_simulated 1 (0) 0.00% 4 (-17) -80.95%
private_kernel_tail_to_public_simulated 1 (0) 0.00% 4 (-17) -80.95%
public_kernel_inner_simulated 1 (0) 0.00% 1 (-15) -93.75%
public_kernel_merge_simulated 1 (0) 0.00% 1 (-15) -93.75%
public_kernel_tail_simulated 1 (0) 0.00% 1 (-15) -93.75%
rollup_base_simulated 1 (0) 0.00% 1 (-15) -93.75%

@@ -36,7 +36,7 @@ build:
BUILD ../barretenberg/cpp/+build
BUILD ../barretenberg/ts/+build
BUILD ../noir/+nargo
BUILD ../noir-projects/+build
BUILD ../noir-projects/+build --RAYON_NUM_THREADS=$RAYON_NUM_THREADS
Copy link
Member

Choose a reason for hiding this comment

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

damn it really be like that huh

Copy link
Collaborator

Choose a reason for hiding this comment

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

It shouldn't be

Copy link
Collaborator

@ludamad ludamad Oct 8, 2024

Choose a reason for hiding this comment

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

Ah yeah I guess they are only automatically passed in the same earthfile, annoying caveat

Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be cleaner to use --pass-args

@Maddiaa0
Copy link
Member

Maddiaa0 commented Oct 8, 2024

image I just ran `earthly build ./yarn-project/+export-e2e-test-images` on this branch and got threads at 1

@just-mitch
Copy link
Contributor Author

I just ran earthly build ./yarn-project/+export-e2e-test-images on this branch and got threads at 1

You still need to set --RAYON_NUM_THREADS=1 or export EARTHLY_BUILD_ARGS="RAYON_NUM_THREADS=32"

@just-mitch just-mitch merged commit 05de539 into master Oct 9, 2024
50 checks passed
@just-mitch just-mitch deleted the mt/more-earthly-noir-fixes branch October 9, 2024 09:27
for pathname in "./target"/*.json; do
BB_HASH=$BB_HASH node ../scripts/generate_vk_json.js "$pathname" "./target/keys"
done
fi

for job in $(jobs -p); do
wait $job || exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this when running sequentially?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, indeed. I missed this bit. Shouldn't hurt though.

@@ -56,11 +56,10 @@ build-mock-protocol-circuits:

ENV RAYON_NUM_THREADS=$RAYON_NUM_THREADS
RUN echo "building with num threads $RAYON_NUM_THREADS"
RUN cd mock-protocol-circuits && BB_HASH=$bb_source_hash NARGO=nargo ./bootstrap.sh
RUN cd mock-protocol-circuits && BB_HASH=$bb_source_hash NARGO=nargo PARALLEL_VK=false ./bootstrap.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

We never want to build in parallel here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. For some reason, when it is in container (bootstrap_docker or earthly) parallel generation gives non-deterministic errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants