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: merge avm main #3874

Merged
merged 10 commits into from
Jan 8, 2024
Merged

chore: merge avm main #3874

merged 10 commits into from
Jan 8, 2024

Conversation

Maddiaa0
Copy link
Member

@Maddiaa0 Maddiaa0 commented Jan 8, 2024

Merges feature branch avm-main into master

note: this was turned into a feature branch as bb interfaces were under alot of change, but they have been stable for some time so we shall merge

jeanmon and others added 10 commits December 8, 2023 17:57
#3612)

Resolves #3546 
Resolves #3548

### Description

This PR introduces the following opcodes for the finite field type:

- SUB: subtraction
- MUL: multiplication
- DIV: division

For division, error is raised whenever the numerator is zero. A boolean
column op_err was introduced for this purpose.
Resolves #3632 

### Description
A list of positive and negative unit tests for the arithmetic operations
of finite field type.
Each operation (add, sub, mul, div) is positively and negatively tested.
Replacing the toy_avm with a pil version that defines a permutation in
pil.

```
    pol commit q_tuple_set;

    // Set 1
    pol commit set_1_column_1;
    pol commit set_1_column_2;
    // Set 2
    pol commit set_2_column_1;
    pol commit set_2_column_2;

    // This is a column based tuple permutation
    
    #[two_column_perm] // the name of the inverse polynomial
    q_tuple_set { set_1_column_1, set_1_column_2 } is { set_2_column_1, set_2_column_2 };
```

Syntax is as shown.
- Add missing check that program counter advanced in call opcode ( oops
)
    - Moved return storing to intermediate register b 
    - jump dest goes on register a
- Implement trivial jump opcode ( subset of call )
Resolves #3834 

Moving all AVM memory related trace building functions into a dedicated
class.
Furthermore, all AVM related trace files were moved into a dedicated
folder in vm.
The following files:

- AvmMini_common.hpp
- AvmMini_helper.cpp
- AvmMini_helper.hpp
- AvmMini_mem_trace.cpp
- AvmMini_mem_trace.hpp
- AvmMini_trace.cpp
- AvmMini_trace.hpp
were moved from 

barretenberg/cpp/src/barretenberg/proof_system/circuit_builder/

to

barretenberg/cpp/src/barretenberg/vm/avm_trace/

Finally, the namespace for these files were migrating from proof_system
to avm_trace.
@AztecBot
Copy link
Collaborator

AztecBot commented Jan 8, 2024

Benchmark results

Metrics with a significant change:

  • note_successful_decrypting_time_in_ms (8): 362 (-31%)
  • note_trial_decrypting_time_in_ms (8): 74.0 (+125%)
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.

Values are compared against data from master at commit 009f66d9 and shown if the difference exceeds 1%.

L2 block published to L1

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

Metric 8 txs 32 txs 128 txs
l1_rollup_calldata_size_in_bytes 45,444 179,588 716,132
l1_rollup_calldata_gas 222,996 868,220 3,449,588
l1_rollup_execution_gas 867,105 3,746,273 23,306,353
l2_block_processing_time_in_ms 1,339 5,142 (-3%) 21,226
note_successful_decrypting_time_in_ms ⚠️ 362 (-31%) 1,130 (-2%) 4,196 (+1%)
note_trial_decrypting_time_in_ms ⚠️ 74.0 (+125%) 38.5 (-9%) 141 (+4%)
l2_block_building_time_in_ms 14,937 59,389 238,576
l2_block_rollup_simulation_time_in_ms 10,616 42,276 170,256
l2_block_public_tx_process_time_in_ms 4,290 17,037 67,892

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 14,903 (-3%) 28,758 (-1%)
note_history_successful_decrypting_time_in_ms 2,857 (+5%) 5,450 (-1%)
note_history_trial_decrypting_time_in_ms 94.5 (-31%) 144 (-4%)
node_database_size_in_bytes 3,616,225 3,719,841
pxe_database_size_in_bytes 29,923 59,478

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 210 44,709 25,561
private-kernel-ordering 136 30,953 14,809
base-rollup 1,075 128,374 881
root-rollup 82.3 4,088 889
private-kernel-inner 286 71,236 25,561
public-kernel-private-input 202 31,891 25,561
public-kernel-non-first-iteration 200 31,933 25,561
merge-rollup 9.67 2,608 881

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 15,487 31,878

@jeanmon jeanmon self-requested a review January 8, 2024 16:12
Copy link
Contributor

@jeanmon jeanmon left a comment

Choose a reason for hiding this comment

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

LGTM

@Maddiaa0 Maddiaa0 merged commit 83acd50 into master Jan 8, 2024
82 of 83 checks passed
@Maddiaa0 Maddiaa0 deleted the md/avm-main-sync branch January 8, 2024 16:14
michaelelliot pushed a commit to Swoir/noir_rs that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants