Skip to content

Commit

Permalink
chore(avm): remove avm prefix from pil and executor (#7099)
Browse files Browse the repository at this point in the history
## Overview

Removes the avm_ prefix from the pil files and from all generated code,
its noisy
  • Loading branch information
Maddiaa0 authored Jun 19, 2024
1 parent 210fc92 commit b502fcd
Show file tree
Hide file tree
Showing 100 changed files with 11,616 additions and 11,882 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include "avm_main.pil";
include "main.pil";

namespace avm_alu(256);
namespace alu(256);

// ========= Table ALU-TR =================================================

Expand Down Expand Up @@ -246,7 +246,7 @@ namespace avm_alu(256);

// ========= EQUALITY Operation Constraints ===============================
// TODO: Note this method differs from the approach taken for "equality to zero" checks
// in handling the error tags found in avm_main and avm_mem files. The predicted relation difference
// in handling the error tags found in main and mem files. The predicted relation difference
// is minor and when we optimise we will harmonise the methods based on actual performance.

// Equality of two elements is found by performing an "equality to zero" check.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

include "avm_byte_lookup.pil";
include "avm_main.pil";
include "byte_lookup.pil";
include "main.pil";

namespace avm_binary(256);
namespace binary(256);

pol commit clk;

Expand Down Expand Up @@ -30,7 +30,7 @@ namespace avm_binary(256);
(op_id' - op_id) * mem_tag_ctr = 0;

// Little Endian bitwise decomposition of accumulators (which are processed top-down),
// constrained to be U8 given by the lookup to the avm_byte_lookup
// constrained to be U8 given by the lookup to the byte_lookup
pol commit ia_bytes;
pol commit ib_bytes;
pol commit ic_bytes;
Expand Down Expand Up @@ -65,12 +65,12 @@ namespace avm_binary(256);
#[LOOKUP_BYTE_LENGTHS]
start {in_tag, mem_tag_ctr}
in
avm_byte_lookup.bin_sel {avm_byte_lookup.table_in_tags, avm_byte_lookup.table_byte_lengths};
byte_lookup.bin_sel {byte_lookup.table_in_tags, byte_lookup.table_byte_lengths};

#[LOOKUP_BYTE_OPERATIONS]
bin_sel {op_id, ia_bytes, ib_bytes, ic_bytes}
in
avm_byte_lookup.bin_sel {avm_byte_lookup.table_op_id, avm_byte_lookup.table_input_a, avm_byte_lookup.table_input_b, avm_byte_lookup.table_output};
byte_lookup.bin_sel {byte_lookup.table_op_id, byte_lookup.table_input_a, byte_lookup.table_input_b, byte_lookup.table_output};

#[ACC_REL_A]
(acc_ia - ia_bytes - 256 * acc_ia') * mem_tag_ctr = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace avm_byte_lookup(256);
namespace byte_lookup(256);
// These columns are commited for now, but will be migrated to constant/fixed when
// we support more *exotic* code generation options
pol commit table_op_id; // identifies if operation is AND/OR/XOR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include "../avm_main.pil";
include "../main.pil";

namespace avm_conversion(256);
namespace conversion(256);

pol commit clk;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include "../avm_main.pil";
include "../main.pil";

namespace avm_keccakf1600(256);
namespace keccakf1600(256);

pol commit clk;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

include "../avm_main.pil";
include "../main.pil";

namespace avm_pedersen(256);
namespace pedersen(256);

pol commit clk;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include "../avm_main.pil";
include "../main.pil";

namespace avm_poseidon2(256);
namespace poseidon2(256);

pol commit clk;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include "../avm_main.pil";
include "../main.pil";

namespace avm_sha256(256);
namespace sha256(256);

pol commit clk;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace avm_gas(256);
namespace gas(256);
// TODO: WILL BE FIXED - we should be able to have this be a fixed column / the lookup tables are fixed so require no selectors
// TODO: All the columns here will have to be constant (when supported by our powdr fork and proving system)
pol commit gas_cost_sel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include "avm_main.pil";
include "main.pil";
include "constants.pil";

namespace avm_kernel(256);
namespace kernel(256);
pol public(/*idx=*/0) kernel_inputs;

pol public(/*idx=*/1) kernel_value_out;
Expand Down Expand Up @@ -58,29 +58,29 @@ namespace avm_kernel(256);
pol commit emit_l2_to_l1_msg_write_offset;


pol NOT_LAST = (1 - avm_main.last);
pol NOT_LAST = (1 - main.last);

// Constraints to increase the offsets when the opcodes are found
#[NOTE_HASH_EXISTS_INC_CONSISTENCY_CHECK]
NOT_LAST * (note_hash_exist_write_offset' - (note_hash_exist_write_offset + avm_main.sel_op_note_hash_exists)) = 0;
NOT_LAST * (note_hash_exist_write_offset' - (note_hash_exist_write_offset + main.sel_op_note_hash_exists)) = 0;
#[EMIT_NOTE_HASH_INC_CONSISTENCY_CHECK]
NOT_LAST * (emit_note_hash_write_offset' - (emit_note_hash_write_offset + avm_main.sel_op_emit_note_hash)) = 0;
// if avm_main.ib is set on op_nullifier_exists, then the nullifier_exists_write_offset will be incremented by 1, otherwise non_exists will be incremented
NOT_LAST * (emit_note_hash_write_offset' - (emit_note_hash_write_offset + main.sel_op_emit_note_hash)) = 0;
// if main.ib is set on op_nullifier_exists, then the nullifier_exists_write_offset will be incremented by 1, otherwise non_exists will be incremented
#[NULLIFIER_EXISTS_INC_CONSISTENCY_CHECK]
NOT_LAST * (nullifier_exists_write_offset' - (nullifier_exists_write_offset + (avm_main.sel_op_nullifier_exists * avm_main.ib))) = 0;
NOT_LAST * (nullifier_exists_write_offset' - (nullifier_exists_write_offset + (main.sel_op_nullifier_exists * main.ib))) = 0;
#[NULLIFIER_NON_EXISTS_INC_CONSISTENCY_CHECK]
NOT_LAST * (nullifier_non_exists_write_offset' - (nullifier_non_exists_write_offset + (avm_main.sel_op_nullifier_exists * (1 - avm_main.ib)))) = 0;
NOT_LAST * (nullifier_non_exists_write_offset' - (nullifier_non_exists_write_offset + (main.sel_op_nullifier_exists * (1 - main.ib)))) = 0;
#[EMIT_NULLIFIER_INC_CONSISTENCY_CHECK]
NOT_LAST * (emit_nullifier_write_offset' - (emit_nullifier_write_offset + avm_main.sel_op_emit_nullifier)) = 0;
NOT_LAST * (emit_nullifier_write_offset' - (emit_nullifier_write_offset + main.sel_op_emit_nullifier)) = 0;
#[L1_TO_L2_MSG_EXISTS_INC_CONSISTENCY_CHECK]
NOT_LAST * (l1_to_l2_msg_exists_write_offset' - (l1_to_l2_msg_exists_write_offset + avm_main.sel_op_l1_to_l2_msg_exists)) = 0;
NOT_LAST * (l1_to_l2_msg_exists_write_offset' - (l1_to_l2_msg_exists_write_offset + main.sel_op_l1_to_l2_msg_exists)) = 0;
#[EMIT_UNENCRYPTED_LOG_INC_CONSISTENCY_CHECK]
NOT_LAST * (emit_unencrypted_log_write_offset' - (emit_unencrypted_log_write_offset + avm_main.sel_op_emit_unencrypted_log)) = 0;
NOT_LAST * (emit_unencrypted_log_write_offset' - (emit_unencrypted_log_write_offset + main.sel_op_emit_unencrypted_log)) = 0;
#[EMIT_L2_TO_L1_MSG_INC_CONSISTENCY_CHECK]
NOT_LAST * (emit_l2_to_l1_msg_write_offset' - (emit_l2_to_l1_msg_write_offset + avm_main.sel_op_emit_l2_to_l1_msg)) = 0;
NOT_LAST * (emit_l2_to_l1_msg_write_offset' - (emit_l2_to_l1_msg_write_offset + main.sel_op_emit_l2_to_l1_msg)) = 0;


#[SLOAD_INC_CONSISTENCY_CHECK]
NOT_LAST * (sload_write_offset' - (sload_write_offset + avm_main.sel_op_sload)) = 0;
NOT_LAST * (sload_write_offset' - (sload_write_offset + main.sel_op_sload)) = 0;
#[SSTORE_INC_CONSISTENCY_CHECK]
NOT_LAST * (sstore_write_offset' - (sstore_write_offset + avm_main.sel_op_sstore)) = 0;
NOT_LAST * (sstore_write_offset' - (sstore_write_offset + main.sel_op_sstore)) = 0;
Loading

1 comment on commit b502fcd

@AztecBot
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: b502fcd Previous: 2716e04 Ratio
nativeClientIVCBench/Full/6 16237.120369999986 ms/iter 15453.290522000003 ms/iter 1.05

This comment was automatically generated by workflow using github-action-benchmark.

CC: @ludamad @codygunton

Please sign in to comment.