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

feat: Add reset tiny and optimize tail #7422

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Conversation

sirasistant
Copy link
Collaborator

Please read contributing guidelines and remove this line.

Copy link
Contributor

github-actions bot commented Jul 10, 2024

Changes to circuit sizes

Generated at commit: a27e38daad72dc191897d4e17e72502ea374d8f3, compared to commit: 2a7494baec4396b9fa62f0a9c240b4b02f23fb1d

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_tail_to_public -8,662 ✅ -12.21% -11,615 ✅ -2.29%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_tail_to_public 62,287 (-8,662) -12.21% 496,502 (-11,615) -2.29%

@AztecBot
Copy link
Collaborator

AztecBot commented Jul 10, 2024

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:transfer_public): 55.2 (+71%)
  • avm_simulation_time_ms (Token:_increase_public_balance): 16.4 (-81%)
  • protocol_circuit_proving_time_in_ms (base-parity): 1,351 (-29%)
Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Proof generation

Each column represents the number of threads used in proof generation.

Metric 1 threads 4 threads 16 threads 32 threads 64 threads
proof_construction_time_sha256_ms 5,777 (+1%) 1,557 (+1%) 706 (+1%) 747 (+1%) 773 (+1%)
proof_construction_time_sha256_30_ms 11,853 (+1%) 3,172 (+1%) 1,408 (+1%) 1,437 1,470 (+1%)
proof_construction_time_sha256_100_ms 44,130 (+1%) 11,816 5,525 (+2%) 5,411 (+1%) 5,357
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 59.0 (+2%) 88.0
proof_construction_time_poseidon_hash_30_ms 1,527 (+1%) 434 (+4%) 200 (+1%) 219 (-6%) 269
proof_construction_time_poseidon_hash_100_ms 5,654 (+1%) 1,527 (+1%) 679 (-1%) 747 (+2%) 745

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 4 txs 8 txs 16 txs
l1_rollup_calldata_size_in_bytes 708 708 708
l1_rollup_calldata_gas 6,588 6,586 6,588
l1_rollup_execution_gas 583,050 583,199 583,352
l2_block_processing_time_in_ms 760 (+1%) 1,435 (+1%) 2,697 (-1%)
l2_block_building_time_in_ms 13,125 (-1%) 26,137 50,393 (-2%)
l2_block_rollup_simulation_time_in_ms 13,125 (-1%) 26,137 50,392 (-2%)
l2_block_public_tx_process_time_in_ms 10,988 (-1%) 23,765 48,045 (-2%)

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 8 txs.

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 7,157 (+1%) 9,878 (-2%)
node_database_size_in_bytes 12,480,592 16,142,416
pxe_database_size_in_bytes 16,254 26,813

Circuits stats

Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Circuit simulation_time_in_ms witness_generation_time_in_ms input_size_in_bytes output_size_in_bytes proving_time_in_ms proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 114 (-1%) 432 (+4%) 21,737 54,085 N/A N/A N/A N/A
private-kernel-inner 229 (-7%) 755 (-4%) 81,199 54,264 N/A N/A N/A N/A
private-kernel-tail 1,123 2,585 (+2%) 61,808 61,554 N/A N/A N/A N/A
base-parity 6.66 (+2%) 831 160 96.0 ⚠️ 1,351 (-29%) 12,676 3.00 131,072
root-parity 108 107 (-2%) 64,860 96.0 44,443 12,676 3.00 4,194,304
base-rollup 4,252 5,121 (+2%) 180,315 632 44,592 (+1%) 13,476 28.0 4,194,304
root-rollup 154 112 51,261 652 37,625 13,412 26.0 4,194,304
public-kernel-setup 195 (+1%) 2,388 (+1%) 112,536 80,310 19,952 118,916 3,323 2,097,152
public-kernel-app-logic 151 3,347 (-1%) 112,536 80,310 9,165 (+4%) 118,916 3,323 1,048,576
public-kernel-tail 898 (-1%) 26,902 (+3%) 409,413 10,046 65,742 24,868 384 8,388,608
private-kernel-reset-tiny 1,286 1,059 76,994 53,954 N/A N/A N/A N/A
private-kernel-tail-to-public 6,793 (+11%) 2,958 (-3%) 777,415 (-11%) 1,632 N/A N/A N/A N/A
public-kernel-teardown 140 (+1%) 3,393 (+3%) 112,536 80,310 20,331 118,916 3,323 2,097,152
merge-rollup 58.8 N/A 33,566 632 N/A N/A N/A N/A
undefined N/A N/A N/A N/A 164,748 (+1%) N/A N/A N/A

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms proof_size_in_bytes proving_time_in_ms
ContractClassRegisterer:register 1,312 9,344 396 N/A N/A
ContractInstanceDeployer:deploy 1,376 9,344 25.4 N/A N/A
MultiCallEntrypoint:entrypoint 1,888 9,344 627 N/A N/A
GasToken:deploy 1,344 9,344 570 N/A N/A
SchnorrAccount:constructor 1,280 9,344 436 N/A N/A
SchnorrAccount:entrypoint 2,272 9,344 765 (-1%) N/A N/A
Token:privately_mint_private_note 1,248 9,344 523 N/A N/A
FPC:fee_entrypoint_public 1,312 9,344 104 (-3%) N/A N/A
Token:transfer 1,280 9,344 1,505 (+1%) N/A N/A
AuthRegistry:set_authorized (avm) 19,222 N/A N/A 95,392 2,363 (-2%)
FPC:prepare_fee (avm) 26,664 N/A N/A 95,456 3,125 (+4%)
Token:transfer_public (avm) 42,914 N/A N/A 95,456 3,390 (-1%)
AuthRegistry:consume (avm) 33,100 N/A N/A 95,424 3,059 (+2%)
FPC:pay_refund (avm) 36,829 N/A N/A 95,424 10,291
Benchmarking:create_note 1,312 9,344 426 N/A N/A
SchnorrAccount:verify_private_authwit 1,248 9,344 41.7 (+1%) N/A N/A
Token:unshield 1,344 9,344 1,185 (-1%) N/A N/A
FPC:fee_entrypoint_private 1,344 9,344 1,603 (+3%) N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 99.0 (+1%) 13,790
GasToken:set_portal 12.8 (+5%) 3,339
Token:constructor 123 (+1%) 23,692
FPC:constructor 90.9 (-3%) 13,592
GasToken:mint_public 81.9 10,158
Token:mint_public 70.0 (-29%) 19,034
Token:assert_minter_and_mint 70.5 (-2%) 12,925
AuthRegistry:set_authorized 43.5 (-8%) 7,812
FPC:prepare_fee 101 (-11%) 15,062
Token:transfer_public ⚠️ 55.2 (+71%) 31,218
FPC:pay_refund 130 (+6%) 25,260
Benchmarking:increment_balance 1,345 15,267
Token:_increase_public_balance ⚠️ 16.4 (-81%) 15,006
FPC:pay_refund_with_shielded_rebate 180 (+1%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.155 (-1%)

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 16 leaves 64 leaves 128 leaves 256 leaves 512 leaves 1024 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.5 (+1%) 16.9 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.609 (+1%) 0.517 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.4 76.0 (-1%) 130 (-1%) 251 (+2%) 469 (-1%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 287 543 1,055
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.495 0.467 (-1%) 0.449 0.455 (+2%) 0.438 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 59.8 111 (-1%) 182 (-1%) 354 691
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.505 0.499 0.483 0.480 0.474
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 73.1 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.520 N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes 1 registered classes
tx_size_in_bytes 76,837 667,838

Transaction size based on fee payment method

| Metric | |
| - | |

@sirasistant sirasistant changed the title test some optimizations feat: Add reset tiny and optimize tail Jul 11, 2024
@sirasistant sirasistant requested a review from LeilaWang July 11, 2024 09:45
@sirasistant sirasistant marked this pull request as ready for review July 11, 2024 09:46
Copy link
Collaborator

@LeilaWang LeilaWang left a comment

Choose a reason for hiding this comment

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

🚀

@sirasistant sirasistant enabled auto-merge (squash) July 11, 2024 10:16
@sirasistant sirasistant merged commit 399917b into master Jul 11, 2024
91 of 92 checks passed
@sirasistant sirasistant deleted the arv/optimizations branch July 11, 2024 10:31
rahul-kothari pushed a commit that referenced this pull request Jul 11, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.46.3</summary>

##
[0.46.3](aztec-package-v0.46.2...aztec-package-v0.46.3)
(2024-07-11)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.46.3</summary>

##
[0.46.3](barretenberg.js-v0.46.2...barretenberg.js-v0.46.3)
(2024-07-11)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.46.3</summary>

##
[0.46.3](aztec-packages-v0.46.2...aztec-packages-v0.46.3)
(2024-07-11)


### Features

* Add CLI argument for debugging comptime blocks
(noir-lang/noir#5192)
([97ecff5](97ecff5))
* Add reset tiny and optimize tail
([#7422](#7422))
([399917b](399917b))
* **avm:** Calldatacopy and return gadget
([#7415](#7415))
([ec39e4e](ec39e4e)),
closes
[#7381](#7381)
[#7211](#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](#7419))
([108fc5f](108fc5f))
* Integrate new proving systems in e2e
([#6971](#6971))
([723a0c1](723a0c1))
* Lsp rename/find-all-references for struct members
(noir-lang/noir#5443)
([97ecff5](97ecff5))
* MSM sorting
([#7351](#7351))
([5cbdc54](5cbdc54))
* **optimization:** Deduplicate more instructions
(noir-lang/noir#5457)
([97ecff5](97ecff5))
* Prefix operator overload trait dispatch
(noir-lang/noir#5423)
([97ecff5](97ecff5))
* Remove proof from L1 Rollup process
([#7347](#7347))
([2645eab](2645eab)),
closes
[#7346](#7346)
* Remove ram tables in note_getter
([#7434](#7434))
([fd67da3](fd67da3))
* Sync from aztec-packages (noir-lang/noir#5467)
([97ecff5](97ecff5))
* Typing return values of embedded_curve_ops
([#7413](#7413))
([db96077](db96077))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](#7438))
([2a7494b](2a7494b))
* Memory init with no other ops gate counting
([#7427](#7427))
([e7177ba](e7177ba))
* Pass secrets to ci-arm.yml
([#7436](#7436))
([619501d](619501d))
* Remove compile-time error for invalid indices
(noir-lang/noir#5466)
([97ecff5](97ecff5))
* Using different generators in private refund
([#7414](#7414))
([59b92ca](59b92ca)),
closes
[#7320](#7320)


### Miscellaneous

* **bb:** Fix double increment
([#7428](#7428))
([7870a58](7870a58))
* **boxes:** Adding an init command for an empty project
([#7398](#7398))
([a6a605d](a6a605d))
* Bump bb to 0.45.1 (noir-lang/noir#5469)
([97ecff5](97ecff5))
* Disable flaky cheat code test
([7b8c2ba](7b8c2ba))
* Document EmbeddedCurvePoint
(noir-lang/noir#5468)
([97ecff5](97ecff5))
* Minimize usage of get_row in inverse computation
([#7431](#7431))
([f177887](f177887))
* Private refund cleanup
([#7403](#7403))
([ebec8ff](ebec8ff))
* Replace relative paths to noir-protocol-circuits
([842f6d1](842f6d1))
* Unbundle `check_array_is_initialized`
(noir-lang/noir#5451)
([97ecff5](97ecff5))
</details>

<details><summary>barretenberg: 0.46.3</summary>

##
[0.46.3](barretenberg-v0.46.2...barretenberg-v0.46.3)
(2024-07-11)


### Features

* **avm:** Calldatacopy and return gadget
([#7415](#7415))
([ec39e4e](ec39e4e)),
closes
[#7381](#7381)
[#7211](#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](#7419))
([108fc5f](108fc5f))
* Integrate new proving systems in e2e
([#6971](#6971))
([723a0c1](723a0c1))
* MSM sorting
([#7351](#7351))
([5cbdc54](5cbdc54))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](#7438))
([2a7494b](2a7494b))
* Memory init with no other ops gate counting
([#7427](#7427))
([e7177ba](e7177ba))


### Miscellaneous

* **bb:** Fix double increment
([#7428](#7428))
([7870a58](7870a58))
* Minimize usage of get_row in inverse computation
([#7431](#7431))
([f177887](f177887))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Jul 12, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-package: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@aztec-package-v0.46.2...aztec-package-v0.46.3)
(2024-07-11)


### Miscellaneous

* **aztec-package:** Synchronize aztec-packages versions
</details>

<details><summary>barretenberg.js: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@barretenberg.js-v0.46.2...barretenberg.js-v0.46.3)
(2024-07-11)


### Miscellaneous

* **barretenberg.js:** Synchronize aztec-packages versions
</details>

<details><summary>aztec-packages: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@aztec-packages-v0.46.2...aztec-packages-v0.46.3)
(2024-07-11)


### Features

* Add CLI argument for debugging comptime blocks
(noir-lang/noir#5192)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Add reset tiny and optimize tail
([#7422](AztecProtocol/aztec-packages#7422))
([399917b](AztecProtocol/aztec-packages@399917b))
* **avm:** Calldatacopy and return gadget
([#7415](AztecProtocol/aztec-packages#7415))
([ec39e4e](AztecProtocol/aztec-packages@ec39e4e)),
closes
[#7381](AztecProtocol/aztec-packages#7381)
[#7211](AztecProtocol/aztec-packages#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](AztecProtocol/aztec-packages#7419))
([108fc5f](AztecProtocol/aztec-packages@108fc5f))
* Integrate new proving systems in e2e
([#6971](AztecProtocol/aztec-packages#6971))
([723a0c1](AztecProtocol/aztec-packages@723a0c1))
* Lsp rename/find-all-references for struct members
(noir-lang/noir#5443)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* MSM sorting
([#7351](AztecProtocol/aztec-packages#7351))
([5cbdc54](AztecProtocol/aztec-packages@5cbdc54))
* **optimization:** Deduplicate more instructions
(noir-lang/noir#5457)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Prefix operator overload trait dispatch
(noir-lang/noir#5423)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Remove proof from L1 Rollup process
([#7347](AztecProtocol/aztec-packages#7347))
([2645eab](AztecProtocol/aztec-packages@2645eab)),
closes
[#7346](AztecProtocol/aztec-packages#7346)
* Remove ram tables in note_getter
([#7434](AztecProtocol/aztec-packages#7434))
([fd67da3](AztecProtocol/aztec-packages@fd67da3))
* Sync from aztec-packages (noir-lang/noir#5467)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Typing return values of embedded_curve_ops
([#7413](AztecProtocol/aztec-packages#7413))
([db96077](AztecProtocol/aztec-packages@db96077))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](AztecProtocol/aztec-packages#7438))
([2a7494b](AztecProtocol/aztec-packages@2a7494b))
* Memory init with no other ops gate counting
([#7427](AztecProtocol/aztec-packages#7427))
([e7177ba](AztecProtocol/aztec-packages@e7177ba))
* Pass secrets to ci-arm.yml
([#7436](AztecProtocol/aztec-packages#7436))
([619501d](AztecProtocol/aztec-packages@619501d))
* Remove compile-time error for invalid indices
(noir-lang/noir#5466)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Using different generators in private refund
([#7414](AztecProtocol/aztec-packages#7414))
([59b92ca](AztecProtocol/aztec-packages@59b92ca)),
closes
[#7320](AztecProtocol/aztec-packages#7320)


### Miscellaneous

* **bb:** Fix double increment
([#7428](AztecProtocol/aztec-packages#7428))
([7870a58](AztecProtocol/aztec-packages@7870a58))
* **boxes:** Adding an init command for an empty project
([#7398](AztecProtocol/aztec-packages#7398))
([a6a605d](AztecProtocol/aztec-packages@a6a605d))
* Bump bb to 0.45.1 (noir-lang/noir#5469)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Disable flaky cheat code test
([7b8c2ba](AztecProtocol/aztec-packages@7b8c2ba))
* Document EmbeddedCurvePoint
(noir-lang/noir#5468)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
* Minimize usage of get_row in inverse computation
([#7431](AztecProtocol/aztec-packages#7431))
([f177887](AztecProtocol/aztec-packages@f177887))
* Private refund cleanup
([#7403](AztecProtocol/aztec-packages#7403))
([ebec8ff](AztecProtocol/aztec-packages@ebec8ff))
* Replace relative paths to noir-protocol-circuits
([842f6d1](AztecProtocol/aztec-packages@842f6d1))
* Unbundle `check_array_is_initialized`
(noir-lang/noir#5451)
([97ecff5](AztecProtocol/aztec-packages@97ecff5))
</details>

<details><summary>barretenberg: 0.46.3</summary>

##
[0.46.3](AztecProtocol/aztec-packages@barretenberg-v0.46.2...barretenberg-v0.46.3)
(2024-07-11)


### Features

* **avm:** Calldatacopy and return gadget
([#7415](AztecProtocol/aztec-packages#7415))
([ec39e4e](AztecProtocol/aztec-packages@ec39e4e)),
closes
[#7381](AztecProtocol/aztec-packages#7381)
[#7211](AztecProtocol/aztec-packages#7211)
* **avm:** Make ProverPolynomials::get_row return references
([#7419](AztecProtocol/aztec-packages#7419))
([108fc5f](AztecProtocol/aztec-packages@108fc5f))
* Integrate new proving systems in e2e
([#6971](AztecProtocol/aztec-packages#6971))
([723a0c1](AztecProtocol/aztec-packages@723a0c1))
* MSM sorting
([#7351](AztecProtocol/aztec-packages#7351))
([5cbdc54](AztecProtocol/aztec-packages@5cbdc54))


### Bug Fixes

* **avm:** Fixes AVM full tests and decrease timeout to 35 minutes
([#7438](AztecProtocol/aztec-packages#7438))
([2a7494b](AztecProtocol/aztec-packages@2a7494b))
* Memory init with no other ops gate counting
([#7427](AztecProtocol/aztec-packages#7427))
([e7177ba](AztecProtocol/aztec-packages@e7177ba))


### Miscellaneous

* **bb:** Fix double increment
([#7428](AztecProtocol/aztec-packages#7428))
([7870a58](AztecProtocol/aztec-packages@7870a58))
* Minimize usage of get_row in inverse computation
([#7431](AztecProtocol/aztec-packages#7431))
([f177887](AztecProtocol/aztec-packages@f177887))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

3 participants