From 161ef17bdb077b06fd83823743cdd73bfc00c89d Mon Sep 17 00:00:00 2001 From: fcarreiro Date: Fri, 20 Dec 2024 10:56:38 +0000 Subject: [PATCH] chore(avm): extra column information in lookups --- .../generated/relations/incl_main_tag_err.hpp | 21 +++++++--- .../generated/relations/incl_mem_tag_err.hpp | 21 +++++++--- .../relations/lookup_byte_lengths.hpp | 25 +++++++---- .../relations/lookup_byte_operations.hpp | 32 +++++++++------ .../generated/relations/lookup_cd_value.hpp | 24 +++++++---- .../relations/lookup_da_gas_rng_chk_0.hpp | 21 +++++++--- .../relations/lookup_da_gas_rng_chk_1.hpp | 21 +++++++--- .../relations/lookup_l2_gas_rng_chk_0.hpp | 21 +++++++--- .../relations/lookup_l2_gas_rng_chk_1.hpp | 21 +++++++--- .../relations/lookup_mem_rng_chk_0.hpp | 21 +++++++--- .../relations/lookup_mem_rng_chk_1.hpp | 21 +++++++--- .../relations/lookup_mem_rng_chk_2.hpp | 21 +++++++--- .../generated/relations/lookup_opcode_gas.hpp | 37 ++++++++++------- .../generated/relations/lookup_pow_2_0.hpp | 24 +++++++---- .../generated/relations/lookup_pow_2_1.hpp | 25 +++++++---- .../generated/relations/lookup_ret_value.hpp | 24 +++++++---- .../generated/relations/lookup_rng_chk_0.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_1.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_2.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_3.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_4.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_5.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_6.hpp | 21 +++++++--- .../generated/relations/lookup_rng_chk_7.hpp | 21 +++++++--- .../relations/lookup_rng_chk_diff.hpp | 21 +++++++--- .../relations/lookup_rng_chk_pow_2.hpp | 25 +++++++---- bb-pilcom/bb-pil-backend/src/file_writer.rs | 4 -- .../bb-pil-backend/src/lookup_builder.rs | 22 ++-------- .../bb-pil-backend/templates/lookup.hpp.hbs | 41 +++++++++++++++---- 29 files changed, 449 insertions(+), 212 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp index e99c219eb46..e17b895d3a3 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_main_tag_err.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class incl_main_tag_err_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::mem_tag_err; + static constexpr Column DST_SELECTOR = Column::main_tag_err; + static constexpr Column COUNTS = Column::incl_main_tag_err_counts; + static constexpr Column INVERSES = Column::incl_main_tag_err_inv; + static constexpr std::array SRC_COLUMNS = { Column::mem_clk }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_tag_err == 1 || in.main_tag_err == 1); @@ -35,15 +44,15 @@ class incl_main_tag_err_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.incl_main_tag_err_inv, - in.incl_main_tag_err_counts, - in.mem_tag_err, - in.main_tag_err, - in.mem_clk, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.incl_main_tag_err_inv, in.incl_main_tag_err_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp index d0bb035fea6..7f5d246592e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/incl_mem_tag_err.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class incl_mem_tag_err_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::main_tag_err; + static constexpr Column DST_SELECTOR = Column::mem_tag_err; + static constexpr Column COUNTS = Column::incl_mem_tag_err_counts; + static constexpr Column INVERSES = Column::incl_mem_tag_err_inv; + static constexpr std::array SRC_COLUMNS = { Column::main_clk }; + static constexpr std::array DST_COLUMNS = { Column::mem_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_tag_err == 1 || in.mem_tag_err == 1); @@ -35,15 +44,15 @@ class incl_mem_tag_err_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.incl_mem_tag_err_inv, - in.incl_mem_tag_err_counts, - in.main_tag_err, - in.mem_tag_err, - in.main_clk, - in.mem_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.incl_mem_tag_err_inv, in.incl_mem_tag_err_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp index 27d46554533..c1a91dbd3ec 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_lengths.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,16 @@ class lookup_byte_lengths_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::binary_start; + static constexpr Column DST_SELECTOR = Column::byte_lookup_sel_bin; + static constexpr Column COUNTS = Column::lookup_byte_lengths_counts; + static constexpr Column INVERSES = Column::lookup_byte_lengths_inv; + static constexpr std::array SRC_COLUMNS = { Column::binary_in_tag, + Column::binary_mem_tag_ctr }; + static constexpr std::array DST_COLUMNS = { Column::byte_lookup_table_in_tags, + Column::byte_lookup_table_byte_lengths }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.binary_start == 1 || in.byte_lookup_sel_bin == 1); @@ -35,17 +46,15 @@ class lookup_byte_lengths_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_lengths_inv, - in.lookup_byte_lengths_counts, - in.binary_start, - in.byte_lookup_sel_bin, - in.binary_in_tag, - in.binary_mem_tag_ctr, - in.byte_lookup_table_in_tags, - in.byte_lookup_table_byte_lengths); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_byte_lengths_inv, in.lookup_byte_lengths_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp index 99a66ff3c27..bd8343ecb45 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_byte_operations.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,19 @@ class lookup_byte_operations_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::binary_sel_bin; + static constexpr Column DST_SELECTOR = Column::byte_lookup_sel_bin; + static constexpr Column COUNTS = Column::lookup_byte_operations_counts; + static constexpr Column INVERSES = Column::lookup_byte_operations_inv; + static constexpr std::array SRC_COLUMNS = { + Column::binary_op_id, Column::binary_ia_bytes, Column::binary_ib_bytes, Column::binary_ic_bytes + }; + static constexpr std::array DST_COLUMNS = { Column::byte_lookup_table_op_id, + Column::byte_lookup_table_input_a, + Column::byte_lookup_table_input_b, + Column::byte_lookup_table_output }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.binary_sel_bin == 1 || in.byte_lookup_sel_bin == 1); @@ -35,21 +49,15 @@ class lookup_byte_operations_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_byte_operations_inv, - in.lookup_byte_operations_counts, - in.binary_sel_bin, - in.byte_lookup_sel_bin, - in.binary_op_id, - in.binary_ia_bytes, - in.binary_ib_bytes, - in.binary_ic_bytes, - in.byte_lookup_table_op_id, - in.byte_lookup_table_input_a, - in.byte_lookup_table_input_b, - in.byte_lookup_table_output); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_byte_operations_inv, in.lookup_byte_operations_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp index 46348b991bc..ed274d2b1b9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_cd_value.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,15 @@ class lookup_cd_value_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::slice_sel_cd_cpy; + static constexpr Column DST_SELECTOR = Column::main_sel_calldata; + static constexpr Column COUNTS = Column::lookup_cd_value_counts; + static constexpr Column INVERSES = Column::lookup_cd_value_inv; + static constexpr std::array SRC_COLUMNS = { Column::slice_col_offset, + Column::slice_val }; + static constexpr std::array DST_COLUMNS = { Column::main_clk, Column::main_calldata }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.slice_sel_cd_cpy == 1 || in.main_sel_calldata == 1); @@ -35,17 +45,15 @@ class lookup_cd_value_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_cd_value_inv, - in.lookup_cd_value_counts, - in.slice_sel_cd_cpy, - in.main_sel_calldata, - in.slice_col_offset, - in.slice_val, - in.main_clk, - in.main_calldata); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_cd_value_inv, in.lookup_cd_value_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp index 3fec11370d1..9fcb0205a25 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_0.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_da_gas_rng_chk_0_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::main_is_gas_accounted; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_da_gas_rng_chk_0_counts; + static constexpr Column INVERSES = Column::lookup_da_gas_rng_chk_0_inv; + static constexpr std::array SRC_COLUMNS = { Column::main_da_gas_u16_r0 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_is_gas_accounted == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_da_gas_rng_chk_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_da_gas_rng_chk_0_inv, - in.lookup_da_gas_rng_chk_0_counts, - in.main_is_gas_accounted, - in.main_sel_rng_16, - in.main_da_gas_u16_r0, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_da_gas_rng_chk_0_inv, in.lookup_da_gas_rng_chk_0_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp index 84c02c77c37..d3d31b1af56 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_da_gas_rng_chk_1.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_da_gas_rng_chk_1_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::main_is_gas_accounted; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_da_gas_rng_chk_1_counts; + static constexpr Column INVERSES = Column::lookup_da_gas_rng_chk_1_inv; + static constexpr std::array SRC_COLUMNS = { Column::main_da_gas_u16_r1 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_is_gas_accounted == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_da_gas_rng_chk_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_da_gas_rng_chk_1_inv, - in.lookup_da_gas_rng_chk_1_counts, - in.main_is_gas_accounted, - in.main_sel_rng_16, - in.main_da_gas_u16_r1, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_da_gas_rng_chk_1_inv, in.lookup_da_gas_rng_chk_1_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp index 87f3515ade9..b5b1750e07e 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_0.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_l2_gas_rng_chk_0_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::main_is_gas_accounted; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_l2_gas_rng_chk_0_counts; + static constexpr Column INVERSES = Column::lookup_l2_gas_rng_chk_0_inv; + static constexpr std::array SRC_COLUMNS = { Column::main_l2_gas_u16_r0 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_is_gas_accounted == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_l2_gas_rng_chk_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_l2_gas_rng_chk_0_inv, - in.lookup_l2_gas_rng_chk_0_counts, - in.main_is_gas_accounted, - in.main_sel_rng_16, - in.main_l2_gas_u16_r0, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_l2_gas_rng_chk_0_inv, in.lookup_l2_gas_rng_chk_0_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp index e8642cadc31..fcc24c097a4 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_l2_gas_rng_chk_1.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_l2_gas_rng_chk_1_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::main_is_gas_accounted; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_l2_gas_rng_chk_1_counts; + static constexpr Column INVERSES = Column::lookup_l2_gas_rng_chk_1_inv; + static constexpr std::array SRC_COLUMNS = { Column::main_l2_gas_u16_r1 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_is_gas_accounted == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_l2_gas_rng_chk_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_l2_gas_rng_chk_1_inv, - in.lookup_l2_gas_rng_chk_1_counts, - in.main_is_gas_accounted, - in.main_sel_rng_16, - in.main_l2_gas_u16_r1, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_l2_gas_rng_chk_1_inv, in.lookup_l2_gas_rng_chk_1_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp index 8c785555830..1116ce3d58d 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_0.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_mem_rng_chk_0_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::mem_sel_rng_chk; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_mem_rng_chk_0_counts; + static constexpr Column INVERSES = Column::lookup_mem_rng_chk_0_inv; + static constexpr std::array SRC_COLUMNS = { Column::mem_u16_r0 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_mem_rng_chk_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_0_inv, - in.lookup_mem_rng_chk_0_counts, - in.mem_sel_rng_chk, - in.main_sel_rng_16, - in.mem_u16_r0, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_mem_rng_chk_0_inv, in.lookup_mem_rng_chk_0_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp index 5b9a6b8e41c..82d50313a70 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_1.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_mem_rng_chk_1_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::mem_sel_rng_chk; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_mem_rng_chk_1_counts; + static constexpr Column INVERSES = Column::lookup_mem_rng_chk_1_inv; + static constexpr std::array SRC_COLUMNS = { Column::mem_u16_r1 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_mem_rng_chk_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_1_inv, - in.lookup_mem_rng_chk_1_counts, - in.mem_sel_rng_chk, - in.main_sel_rng_16, - in.mem_u16_r1, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_mem_rng_chk_1_inv, in.lookup_mem_rng_chk_1_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp index 2213ec643a5..f32173648c6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_mem_rng_chk_2.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_mem_rng_chk_2_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::mem_sel_rng_chk; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_8; + static constexpr Column COUNTS = Column::lookup_mem_rng_chk_2_counts; + static constexpr Column INVERSES = Column::lookup_mem_rng_chk_2_inv; + static constexpr std::array SRC_COLUMNS = { Column::mem_u8_r0 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.mem_sel_rng_chk == 1 || in.main_sel_rng_8 == 1); @@ -35,15 +44,15 @@ class lookup_mem_rng_chk_2_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_mem_rng_chk_2_inv, - in.lookup_mem_rng_chk_2_counts, - in.mem_sel_rng_chk, - in.main_sel_rng_8, - in.mem_u8_r0, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_mem_rng_chk_2_inv, in.lookup_mem_rng_chk_2_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp index 661a9d1dfe9..166c570367c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_opcode_gas.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,22 @@ class lookup_opcode_gas_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::main_is_gas_accounted; + static constexpr Column DST_SELECTOR = Column::gas_sel_gas_cost; + static constexpr Column COUNTS = Column::lookup_opcode_gas_counts; + static constexpr Column INVERSES = Column::lookup_opcode_gas_inv; + static constexpr std::array SRC_COLUMNS = { Column::main_opcode_val, + Column::main_base_l2_gas_op_cost, + Column::main_base_da_gas_op_cost, + Column::main_dyn_l2_gas_op_cost, + Column::main_dyn_da_gas_op_cost }; + static constexpr std::array DST_COLUMNS = { Column::main_clk, + Column::gas_base_l2_gas_fixed_table, + Column::gas_base_da_gas_fixed_table, + Column::gas_dyn_l2_gas_fixed_table, + Column::gas_dyn_da_gas_fixed_table }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.main_is_gas_accounted == 1 || in.gas_sel_gas_cost == 1); @@ -35,23 +52,15 @@ class lookup_opcode_gas_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_opcode_gas_inv, - in.lookup_opcode_gas_counts, - in.main_is_gas_accounted, - in.gas_sel_gas_cost, - in.main_opcode_val, - in.main_base_l2_gas_op_cost, - in.main_base_da_gas_op_cost, - in.main_dyn_l2_gas_op_cost, - in.main_dyn_da_gas_op_cost, - in.main_clk, - in.gas_base_l2_gas_fixed_table, - in.gas_base_da_gas_fixed_table, - in.gas_dyn_l2_gas_fixed_table, - in.gas_dyn_da_gas_fixed_table); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_opcode_gas_inv, in.lookup_opcode_gas_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp index d80fc14e3bd..74999ea5a60 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_0.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,15 @@ class lookup_pow_2_0_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::alu_sel_shift_which; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_8; + static constexpr Column COUNTS = Column::lookup_pow_2_0_counts; + static constexpr Column INVERSES = Column::lookup_pow_2_0_inv; + static constexpr std::array SRC_COLUMNS = { Column::alu_ib, Column::alu_b_pow }; + static constexpr std::array DST_COLUMNS = { Column::main_clk, + Column::powers_power_of_2 }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_shift_which == 1 || in.main_sel_rng_8 == 1); @@ -35,17 +45,15 @@ class lookup_pow_2_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_0_inv, - in.lookup_pow_2_0_counts, - in.alu_sel_shift_which, - in.main_sel_rng_8, - in.alu_ib, - in.alu_b_pow, - in.main_clk, - in.powers_power_of_2); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_pow_2_0_inv, in.lookup_pow_2_0_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp index d79ed748b26..5859b44b537 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_pow_2_1.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,16 @@ class lookup_pow_2_1_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::alu_sel_shift_which; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_8; + static constexpr Column COUNTS = Column::lookup_pow_2_1_counts; + static constexpr Column INVERSES = Column::lookup_pow_2_1_inv; + static constexpr std::array SRC_COLUMNS = { Column::alu_max_bits_sub_b_bits, + Column::alu_max_bits_sub_b_pow }; + static constexpr std::array DST_COLUMNS = { Column::main_clk, + Column::powers_power_of_2 }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.alu_sel_shift_which == 1 || in.main_sel_rng_8 == 1); @@ -35,17 +46,15 @@ class lookup_pow_2_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_pow_2_1_inv, - in.lookup_pow_2_1_counts, - in.alu_sel_shift_which, - in.main_sel_rng_8, - in.alu_max_bits_sub_b_bits, - in.alu_max_bits_sub_b_pow, - in.main_clk, - in.powers_power_of_2); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_pow_2_1_inv, in.lookup_pow_2_1_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp index 1b666ddb921..1d4d546e8af 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_ret_value.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,15 @@ class lookup_ret_value_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::slice_sel_return; + static constexpr Column DST_SELECTOR = Column::main_sel_returndata; + static constexpr Column COUNTS = Column::lookup_ret_value_counts; + static constexpr Column INVERSES = Column::lookup_ret_value_inv; + static constexpr std::array SRC_COLUMNS = { Column::slice_col_offset, + Column::slice_val }; + static constexpr std::array DST_COLUMNS = { Column::main_clk, Column::main_returndata }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.slice_sel_return == 1 || in.main_sel_returndata == 1); @@ -35,17 +45,15 @@ class lookup_ret_value_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_ret_value_inv, - in.lookup_ret_value_counts, - in.slice_sel_return, - in.main_sel_returndata, - in.slice_col_offset, - in.slice_val, - in.main_clk, - in.main_returndata); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_ret_value_inv, in.lookup_ret_value_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp index 7e4210a15d5..cfc1c8721c9 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_0.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_0_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_0; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_0_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_0_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r0 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_0 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_0_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_0_inv, - in.lookup_rng_chk_0_counts, - in.range_check_sel_lookup_0, - in.main_sel_rng_16, - in.range_check_u16_r0, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_0_inv, in.lookup_rng_chk_0_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp index 0e8e763f677..3e968f49731 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_1.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_1_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_1; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_1_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_1_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r1 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_1 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_1_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_1_inv, - in.lookup_rng_chk_1_counts, - in.range_check_sel_lookup_1, - in.main_sel_rng_16, - in.range_check_u16_r1, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_1_inv, in.lookup_rng_chk_1_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp index c0490636474..fd1fbe25e27 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_2.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_2_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_2; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_2_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_2_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r2 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_2 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_2_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_2_inv, - in.lookup_rng_chk_2_counts, - in.range_check_sel_lookup_2, - in.main_sel_rng_16, - in.range_check_u16_r2, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_2_inv, in.lookup_rng_chk_2_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp index d1b2ab9900b..740cdd242e6 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_3.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_3_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_3; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_3_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_3_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r3 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_3 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_3_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_3_inv, - in.lookup_rng_chk_3_counts, - in.range_check_sel_lookup_3, - in.main_sel_rng_16, - in.range_check_u16_r3, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_3_inv, in.lookup_rng_chk_3_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp index 3fcdbaba548..ce257b6ec38 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_4.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_4_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_4; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_4_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_4_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r4 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_4 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_4_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_4_inv, - in.lookup_rng_chk_4_counts, - in.range_check_sel_lookup_4, - in.main_sel_rng_16, - in.range_check_u16_r4, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_4_inv, in.lookup_rng_chk_4_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp index 9ce59cca5df..efcba04f434 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_5.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_5_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_5; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_5_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_5_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r5 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_5 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_5_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_5_inv, - in.lookup_rng_chk_5_counts, - in.range_check_sel_lookup_5, - in.main_sel_rng_16, - in.range_check_u16_r5, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_5_inv, in.lookup_rng_chk_5_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp index 5c800f79431..5bceaaf1617 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_6.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_6_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_lookup_6; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_6_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_6_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r6 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_lookup_6 == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_6_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_6_inv, - in.lookup_rng_chk_6_counts, - in.range_check_sel_lookup_6, - in.main_sel_rng_16, - in.range_check_u16_r6, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_6_inv, in.lookup_rng_chk_6_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp index e9398951571..3c4425f46da 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_7.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_7_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_rng_chk; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_7_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_7_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_u16_r7 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_7_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_7_inv, - in.lookup_rng_chk_7_counts, - in.range_check_sel_rng_chk, - in.main_sel_rng_16, - in.range_check_u16_r7, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_7_inv, in.lookup_rng_chk_7_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp index 5cd7dcceaa8..59808d1f0ef 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_diff.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,14 @@ class lookup_rng_chk_diff_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_rng_chk; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_16; + static constexpr Column COUNTS = Column::lookup_rng_chk_diff_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_diff_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_dyn_diff }; + static constexpr std::array DST_COLUMNS = { Column::main_clk }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_rng_chk == 1 || in.main_sel_rng_16 == 1); @@ -35,15 +44,15 @@ class lookup_rng_chk_diff_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_diff_inv, - in.lookup_rng_chk_diff_counts, - in.range_check_sel_rng_chk, - in.main_sel_rng_16, - in.range_check_dyn_diff, - in.main_clk); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_diff_inv, in.lookup_rng_chk_diff_counts, diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp index 3a3e641c91c..cf966db21b5 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/lookup_rng_chk_pow_2.hpp @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,16 @@ class lookup_rng_chk_pow_2_lookup_settings { static constexpr size_t READ_TERM_DEGREE = 0; static constexpr size_t WRITE_TERM_DEGREE = 0; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::range_check_sel_rng_chk; + static constexpr Column DST_SELECTOR = Column::main_sel_rng_8; + static constexpr Column COUNTS = Column::lookup_rng_chk_pow_2_counts; + static constexpr Column INVERSES = Column::lookup_rng_chk_pow_2_inv; + static constexpr std::array SRC_COLUMNS = { Column::range_check_dyn_rng_chk_bits, + Column::range_check_dyn_rng_chk_pow_2 }; + static constexpr std::array DST_COLUMNS = { Column::main_clk, + Column::powers_power_of_2 }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.range_check_sel_rng_chk == 1 || in.main_sel_rng_8 == 1); @@ -35,17 +46,15 @@ class lookup_rng_chk_pow_2_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple(in.lookup_rng_chk_pow_2_inv, - in.lookup_rng_chk_pow_2_counts, - in.range_check_sel_rng_chk, - in.main_sel_rng_8, - in.range_check_dyn_rng_chk_bits, - in.range_check_dyn_rng_chk_pow_2, - in.main_clk, - in.powers_power_of_2); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple(in.lookup_rng_chk_pow_2_inv, in.lookup_rng_chk_pow_2_counts, diff --git a/bb-pilcom/bb-pil-backend/src/file_writer.rs b/bb-pilcom/bb-pil-backend/src/file_writer.rs index 478455a372e..37123485b2e 100644 --- a/bb-pilcom/bb-pil-backend/src/file_writer.rs +++ b/bb-pilcom/bb-pil-backend/src/file_writer.rs @@ -9,10 +9,6 @@ pub struct BBFiles { } impl BBFiles { - pub fn default(vm_name: &str) -> Self { - Self::new(vm_name, None, None) - } - #[allow(clippy::too_many_arguments)] pub fn new(vm_name: &str, base_dir: Option<&str>, relations: Option<&str>) -> Self { let base_dir = base_dir diff --git a/bb-pilcom/bb-pil-backend/src/lookup_builder.rs b/bb-pilcom/bb-pil-backend/src/lookup_builder.rs index 028e74b2698..43888ee5cb1 100644 --- a/bb-pilcom/bb-pil-backend/src/lookup_builder.rs +++ b/bb-pilcom/bb-pil-backend/src/lookup_builder.rs @@ -138,23 +138,6 @@ fn create_lookup_settings_data(lookup: &Lookup, vm_name: &str) -> Json { "Lookup columns lhs must be the same length as rhs" ); - // 0. The polynomial containing the inverse products -> taken from the attributes - // 1. The polynomial with the counts! - // 2. lhs selector - // 3. rhs selector - // 4.. + columns per set. lhs cols - // 4 + columns per set.. . rhs cols - let mut lookup_entities: Vec = [ - lookup.inverse.clone(), - lookup.counts_poly.clone(), - lhs_selector.clone(), - rhs_selector.clone(), - ] - .to_vec(); - - lookup_entities.extend(lhs_cols); - lookup_entities.extend(rhs_cols); - // NOTE: these are hardcoded as 1 for now until more optimizations are required let read_terms = 1; let write_terms = 1; @@ -172,6 +155,10 @@ fn create_lookup_settings_data(lookup: &Lookup, vm_name: &str) -> Json { "lookup_name": lookup.name, "lhs_selector": lhs_selector, "rhs_selector": rhs_selector, + "lhs_cols": lhs_cols, + "rhs_cols": rhs_cols, + "inverses_col": lookup.inverse.clone(), + "counts_col": lookup.counts_poly, "read_terms": read_terms, "write_terms": write_terms, "lookup_tuple_size": lookup_tuple_size, @@ -180,7 +167,6 @@ fn create_lookup_settings_data(lookup: &Lookup, vm_name: &str) -> Json { "write_term_degree": write_term_degree, "read_term_types": read_term_types, "write_term_types": write_term_types, - "lookup_entities": lookup_entities, }) } diff --git a/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs index 3d97be8ee8d..ecb6945b268 100644 --- a/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/lookup.hpp.hbs @@ -1,6 +1,7 @@ // AUTOGENERATED FILE #pragma once +#include "../columns.hpp" #include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp" #include @@ -19,6 +20,22 @@ class {{lookup_name}}_lookup_settings { static constexpr size_t READ_TERM_DEGREE = {{read_term_degree}}; static constexpr size_t WRITE_TERM_DEGREE = {{write_term_degree}}; + // Columns using the Column enum. + static constexpr Column SRC_SELECTOR = Column::{{lhs_selector}}; + static constexpr Column DST_SELECTOR = Column::{{rhs_selector}}; + static constexpr Column COUNTS = Column::{{counts_col}}; + static constexpr Column INVERSES = Column::{{inverses_col}}; + static constexpr std::array SRC_COLUMNS = { + {{#each lhs_cols as |col|}} + Column::{{col}}{{#unless @last}},{{/unless}} + {{/each}} + }; + static constexpr std::array DST_COLUMNS = { + {{#each rhs_cols as |col|}} + Column::{{col}}{{#unless @last}},{{/unless}} + {{/each}} + }; + template static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in) { return (in.{{lhs_selector}} == 1 || in.{{rhs_selector}} == 1); @@ -35,19 +52,27 @@ class {{lookup_name}}_lookup_settings { template static inline auto get_const_entities(const AllEntities& in) { - return std::forward_as_tuple( - {{#each lookup_entities as |ent|}} - in.{{ent}}{{#unless @last}},{{/unless}} - {{/each}} - ); + return get_entities(in); } template static inline auto get_nonconst_entities(AllEntities& in) + { + return get_entities(in); + } + + template static inline auto get_entities(AllEntities&& in) { return std::forward_as_tuple( - {{#each lookup_entities as |ent|}} - in.{{ent}}{{#unless @last}},{{/unless}} - {{/each}} + in.{{inverses_col}}, + in.{{counts_col}}, + in.{{lhs_selector}}, + in.{{rhs_selector}}, + {{#each lhs_cols as |col|}} + in.{{col}}, + {{/each}} + {{#each rhs_cols as |col|}} + in.{{col}}{{#unless @last}},{{/unless}} + {{/each}} ); } };