Skip to content

feat(acir)!: BrilligCall opcode - #5709

Merged
vezenovm merged 25 commits into
masterfrom
mv/brillig-pointer
Apr 16, 2024
Merged

vezenovm merged 25 commits into
masterfrom
mv/brillig-pointer

Conversation

@vezenovm

@vezenovm vezenovm commented Apr 11, 2024 •

Copy link
Copy Markdown
Contributor

This starts work towards noir-lang/noir#3907 but is only the breaking serialization change.

Codegen and evaluation will come in a follow-up. This PR is purely additive and does not remove the current way we do Brillig gen during ACIR gen. Codegen for normal Brillig functions is working in my follow-up, however, removing the existing Brillig opcode will most likely have to come once we settle on how to handle the brillig std lib as we are currently generating code such as calculating a quotient during ACIR gen.

@vezenovm
vezenovm marked this pull request as ready for review April 12, 2024 14:04
@AztecBot

ghost commented Apr 12, 2024 •

Copy link
Copy Markdown
Collaborator

Benchmark results

Metrics with a significant change:

  • note_successful_decrypting_time_in_ms (8): 234 (-19%)
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.

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,796 6,808 6,772
l1_rollup_execution_gas 587,277 587,289 587,253
l2_block_processing_time_in_ms 1,432 5,152 (-2%) 10,232 (+1%)
note_successful_decrypting_time_in_ms ⚠️ 234 (-19%) 528 (+5%) 969 (-7%)
note_trial_decrypting_time_in_ms 33.6 (-64%) 39.0 (-65%) 86.0 (+37%)
l2_block_building_time_in_ms 9,704 (-1%) 37,868 (-2%) 76,838
l2_block_rollup_simulation_time_in_ms 9,514 (-1%) 37,173 (-2%) 75,488
l2_block_public_tx_process_time_in_ms 5,334 (-1%) 20,829 (-1%) 42,100

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,216 (-3%) 29,685 (+1%)
note_history_successful_decrypting_time_in_ms 1,248 (+4%) 2,271 (-2%)
note_history_trial_decrypting_time_in_ms 52.1 (+33%) 74.3 (-16%)
node_database_size_in_bytes 18,735,184 35,123,280
pxe_database_size_in_bytes 29,859 59,414

Circuits stats

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

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 145 (-3%) 44,561 26,424
private-kernel-inner 155 (-3%) 72,188 26,424
private-kernel-ordering 108 (-2%) 51,090 39,297
base-parity 51.8 (-4%) 128 311
root-parity 9.79 (-2%) 1,244 311
base-rollup 12,490 (-1%) 110,820 957
root-rollup 48.4 4,551 821
public-kernel-app-logic 81.5 48,151 40,933
public-kernel-tail 122 (+1%) 53,644 7,385
merge-rollup 10.7 (-1%) 2,760 957
public-kernel-teardown 79.1 48,151 40,933
public-kernel-setup 78.0 (+1%) 48,151 40,933

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.0 17.6 (-1%) 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.8 31.6 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.640 0.544 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 51.5 80.0 259 (-1%) 500 (-2%) 976 (-1%) 1,938 N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 96.0 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.526 0.495 0.473 0.468 (-2%) 0.464 (-1%) 0.465 N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 60.1 118 (-8%) 374 734 (-1%) 1,450 (-1%) 2,894 (-1%) N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 105 207 691 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.534 0.535 (-8%) 0.509 0.507 (-1%) 0.504 (-1%) 0.505 (-1%) 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 66.8 (-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 109
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.585 (-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 41,005 528,889

Transaction size based on fee payment method

Metric native fee payment method fpc_public fee payment method fpc_private fee payment method
tx_with_fee_size_in_bytes 905 1,161 1,377

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes 2 new note hashes
tx_pxe_processing_time_ms 1,177 (+1%) 778 (-3%) 3,397
Metric 1 public data writes 2 public data writes 3 public data writes 4 public data writes 5 public data writes 8 public data writes
tx_sequencer_processing_time_ms 452 (-1%) 308 822 394 (+1%) 1,362 (+1%) 464

Comment thread noir/noir-repo/acvm-repo/acir/src/circuit/opcodes.rs Outdated
Comment thread noir/noir-repo/tooling/nargo_cli/src/cli/info_cmd.rs Outdated
Comment thread noir/noir-repo/tooling/backend_interface/src/smart_contract.rs Outdated
Comment thread noir/noir-repo/acvm-repo/acir/src/circuit/mod.rs Outdated
Comment thread noir/noir-repo/acvm-repo/acir/src/circuit/mod.rs Outdated
Comment thread noir/noir-repo/tooling/nargo_cli/src/cli/info_cmd.rs Outdated

ghost left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, although I agree that we could make it so BrilligPointer looks more like acir calls (no intermediate struct, rename to BrilligCall). I think we should do it now since it will be another serialization breaking change.

Comment thread noir/noir-repo/acvm-repo/acir/src/circuit/mod.rs
@vezenovm
vezenovm requested a review from TomAFrench April 15, 2024 14:49
Comment thread noir/noir-repo/acvm-repo/acir/src/circuit/opcodes.rs
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