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

chore: simplify compilation flow to just write to file immediately #6488

Closed
wants to merge 14 commits into from

Conversation

TomAFrench
Copy link
Member

Now that we prefer to read artifacts from disk (#6279), there's no need to hold all of the compiled programs in memory. We can instead just write them to file immediately.

This PR does this so we can split up the logic related to compiling programs and contracts a bit more.

@AztecBot
Copy link
Collaborator

AztecBot commented May 16, 2024

Benchmark results

Metrics with a significant change:

  • app_circuit_proving_time_in_ms (Test:emit_nullifier): 1,776 (-35%)
  • app_circuit_proving_time_in_ms (FPC:fee_entrypoint_public): 9,334 (-43%)
  • protocol_circuit_witness_generation_time_in_ms (base-parity): 1,142 (-31%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-setup): 985 (+16%)
  • protocol_circuit_witness_generation_time_in_ms (base-rollup): 2,323 (-20%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-app-logic): 289 (+41%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-teardown): 280 (+22%)
  • protocol_circuit_witness_generation_time_in_ms (merge-rollup): 127 (-31%)
  • protocol_circuit_proving_time_in_ms (public-kernel-setup): 1,208 (+37%)
  • protocol_circuit_proving_time_in_ms (public-kernel-app-logic): 1,055 (+23%)
  • protocol_circuit_proving_time_in_ms (merge-rollup): 2,360 (+47%)
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 5,755 (+1%) 1,570 (+1%) 715 775 (+2%) 775

L2 block published to L1

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

Metric 8 txs 32 txs 64 txs
l1_rollup_calldata_size_in_bytes 772 772 772
l1_rollup_calldata_gas 6,856 6,856 6,832
l1_rollup_execution_gas 587,396 587,396 587,372
l2_block_processing_time_in_ms 1,363 5,066 (-1%) 10,110
l2_block_building_time_in_ms 33,425 131,712 (-1%) 262,605 (-1%)
l2_block_rollup_simulation_time_in_ms 33,244 131,072 (-1%) 261,349 (-1%)
l2_block_public_tx_process_time_in_ms 20,466 (-1%) 82,612 (-1%) 165,162 (-1%)

L2 chain processing

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

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms 15,189 (-1%) 28,478
node_database_size_in_bytes 21,418,064 38,129,744
pxe_database_size_in_bytes 29,868 59,425

Circuits stats

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

Circuit protocol_circuit_simulation_time_in_ms protocol_circuit_witness_generation_time_in_ms protocol_circuit_proving_time_in_ms protocol_circuit_input_size_in_bytes protocol_circuit_output_size_in_bytes protocol_circuit_proof_size_in_bytes protocol_circuit_num_public_inputs protocol_circuit_size_in_gates
private-kernel-init 160 3,641 22,764 (+5%) 19,987 61,999 86,720 2,643 1,048,576
private-kernel-inner 611 (-1%) 5,100 (+7%) 40,371 (-1%) 89,054 61,999 86,720 2,643 2,097,152
private-kernel-reset-small 579 2,353 (-1%) 23,122 117,961 61,999 86,720 2,643 1,048,576
private-kernel-tail 534 3,819 (-5%) 37,726 86,849 79,454 10,688 267 2,097,152
base-parity 7.62 ⚠️ 1,142 (-31%) 3,367 (+11%) 128 64.0 2,208 2.00 131,072
root-parity 49.8 (-2%) 155 (+15%) 39,885 (-6%) 27,064 64.0 2,720 18.0 2,097,152
base-rollup 776 (-2%) ⚠️ 2,323 (-20%) 43,213 (-1%) 111,158 957 3,136 31.0 2,097,152
root-rollup 94.0 114 (-5%) 8,275 11,518 821 3,456 41.0 524,288
public-kernel-app-logic 245 ⚠️ 289 (+41%) ⚠️ 1,055 (+23%) 96,979 85,095 116,448 3,572 4,096
public-kernel-tail 874 680 (+1%) 899 (-12%) 388,207 7,755 10,176 251 512
public-kernel-setup 230 ⚠️ 985 (+16%) ⚠️ 1,208 (+37%) 138,310 85,095 116,448 3,572 4,096
public-kernel-teardown 237 (+8%) ⚠️ 280 (+22%) 1,011 (+13%) 143,321 85,095 116,448 3,572 4,096
merge-rollup 6.57 ⚠️ 127 (-31%) ⚠️ 2,360 (+47%) 2,760 957 3,136 31.0 65,536
private-kernel-tail-to-public N/A 9,562 (-2%) 72,925 (+1%) N/A N/A 116,960 3,588 4,194,304

Stats on running time collected for app circuits

Function app_circuit_proof_size_in_bytes app_circuit_proving_time_in_ms app_circuit_size_in_gates app_circuit_num_public_inputs
SchnorrAccount:entrypoint 16,128 47,453 (-1%) 2,097,152 437
Test:emit_nullifier 16,128 ⚠️ 1,776 (-35%) 65,536 437
FPC:fee_entrypoint_public 16,128 ⚠️ 9,334 (-43%) 524,288 437
FPC:fee_entrypoint_private 16,128 8,890 (-1%) 524,288 437
Token:unshield 16,128 50,255 (+5%) 2,097,152 437
SchnorrAccount:spend_private_authwit 16,128 2,709 (+1%) 131,072 437
Token:transfer 16,128 34,937 2,097,152 437

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 512 leaves 1024 leaves 2048 leaves 4096 leaves 32 leaves
batch_insert_into_append_only_tree_16_depth_ms 11.3 18.4 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.7 31.8 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.659 0.565 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 52.4 81.0 262 505 (-1%) 986 1,958 N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 543 1,055 2,079 4,127 N/A
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.536 0.500 0.476 0.471 (-1%) 0.468 0.467 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 62.5 (-2%) 119 (-1%) 377 742 (-1%) 1,469 2,936 N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 106 208 692 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.543 (-1%) 0.536 0.512 0.510 (-1%) 0.509 0.510 N/A
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A N/A N/A N/A N/A 67.7 (-1%)
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A N/A N/A N/A N/A 108
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A N/A N/A N/A N/A 0.593 (-1%)

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 84,743 673,221

Transaction size based on fee payment method

| Metric | |
| - | |

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes 2 new note hashes
tx_pxe_processing_time_ms 29,722 4,276 100,284 (+1%)
Metric 0 public data writes 1 public data writes 2 public data writes 4 public data writes 8 public data writes
tx_sequencer_processing_time_ms 1,472 (-10%) 2,691 2,079 (+2%) 3,382 (+3%) 1,995

@TomAFrench TomAFrench force-pushed the tf/simplify-compilation branch 2 times, most recently from f2653da to bfaca85 Compare May 21, 2024 10:06
@TomAFrench TomAFrench requested a review from guipublic May 21, 2024 10:07
@TomAFrench TomAFrench enabled auto-merge (squash) May 21, 2024 16:38
@TomAFrench TomAFrench disabled auto-merge May 22, 2024 13:26
@TomAFrench TomAFrench enabled auto-merge (squash) May 24, 2024 16:11
@TomAFrench TomAFrench closed this Jun 17, 2024
auto-merge was automatically disabled June 17, 2024 14:32

Pull request was closed

github-merge-queue bot pushed a commit to noir-lang/noir that referenced this pull request Jun 18, 2024
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

This PR pulls across the changes from
AztecProtocol/aztec-packages#6488 to avoid
making changes in aztec-packages unnecessarily and get around the CI
issues over there.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
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