Skip to content

Commit

Permalink
chore(avm): migrate lookups and permutations
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Jul 4, 2024
1 parent 694cebc commit 7dd6a30
Show file tree
Hide file tree
Showing 59 changed files with 375 additions and 860 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class incl_main_tag_err_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.mem_tag_err == 1 || in.main_tag_err == 1);
Expand All @@ -99,7 +96,6 @@ class incl_main_tag_err_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class incl_main_tag_err_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(in.incl_main_tag_err,
in.incl_main_tag_err_counts,
in.mem_tag_err,
Expand All @@ -147,10 +141,8 @@ class incl_main_tag_err_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(in.incl_main_tag_err,
in.incl_main_tag_err_counts,
in.mem_tag_err,
Expand All @@ -164,4 +156,4 @@ template <typename FF_>
using incl_main_tag_err_relation = GenericLookupRelation<incl_main_tag_err_lookup_settings, FF_>;
template <typename FF_> using incl_main_tag_err = GenericLookup<incl_main_tag_err_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class incl_mem_tag_err_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.main_tag_err == 1 || in.mem_tag_err == 1);
Expand All @@ -99,7 +96,6 @@ class incl_mem_tag_err_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class incl_mem_tag_err_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(
in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk);
}
Expand All @@ -143,10 +137,8 @@ class incl_mem_tag_err_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(
in.incl_mem_tag_err, in.incl_mem_tag_err_counts, in.main_tag_err, in.mem_tag_err, in.main_clk, in.mem_clk);
}
Expand All @@ -155,4 +147,4 @@ class incl_mem_tag_err_lookup_settings {
template <typename FF_> using incl_mem_tag_err_relation = GenericLookupRelation<incl_mem_tag_err_lookup_settings, FF_>;
template <typename FF_> using incl_mem_tag_err = GenericLookup<incl_mem_tag_err_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class kernel_output_lookup_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.main_sel_q_kernel_output_lookup == 1 || in.kernel_q_public_input_kernel_out_add_to_table == 1);
Expand All @@ -99,7 +96,6 @@ class kernel_output_lookup_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class kernel_output_lookup_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(in.kernel_output_lookup,
in.kernel_output_lookup_counts,
in.main_sel_q_kernel_output_lookup,
Expand All @@ -153,10 +147,8 @@ class kernel_output_lookup_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(in.kernel_output_lookup,
in.kernel_output_lookup_counts,
in.main_sel_q_kernel_output_lookup,
Expand All @@ -176,4 +168,4 @@ template <typename FF_>
using kernel_output_lookup_relation = GenericLookupRelation<kernel_output_lookup_lookup_settings, FF_>;
template <typename FF_> using kernel_output_lookup = GenericLookup<kernel_output_lookup_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class lookup_byte_lengths_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.binary_start == 1 || in.byte_lookup_sel_bin == 1);
Expand All @@ -99,7 +96,6 @@ class lookup_byte_lengths_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class lookup_byte_lengths_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(in.lookup_byte_lengths,
in.lookup_byte_lengths_counts,
in.binary_start,
Expand All @@ -149,10 +143,8 @@ class lookup_byte_lengths_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(in.lookup_byte_lengths,
in.lookup_byte_lengths_counts,
in.binary_start,
Expand All @@ -168,4 +160,4 @@ template <typename FF_>
using lookup_byte_lengths_relation = GenericLookupRelation<lookup_byte_lengths_lookup_settings, FF_>;
template <typename FF_> using lookup_byte_lengths = GenericLookup<lookup_byte_lengths_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class lookup_byte_operations_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.binary_sel_bin == 1 || in.byte_lookup_sel_bin == 1);
Expand All @@ -99,7 +96,6 @@ class lookup_byte_operations_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class lookup_byte_operations_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(in.lookup_byte_operations,
in.lookup_byte_operations_counts,
in.binary_sel_bin,
Expand All @@ -153,10 +147,8 @@ class lookup_byte_operations_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(in.lookup_byte_operations,
in.lookup_byte_operations_counts,
in.binary_sel_bin,
Expand All @@ -176,4 +168,4 @@ template <typename FF_>
using lookup_byte_operations_relation = GenericLookupRelation<lookup_byte_operations_lookup_settings, FF_>;
template <typename FF_> using lookup_byte_operations = GenericLookup<lookup_byte_operations_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class lookup_div_u16_0_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1);
Expand All @@ -99,7 +96,6 @@ class lookup_div_u16_0_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class lookup_div_u16_0_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(in.lookup_div_u16_0,
in.lookup_div_u16_0_counts,
in.alu_sel_div_rng_chk,
Expand All @@ -147,10 +141,8 @@ class lookup_div_u16_0_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(in.lookup_div_u16_0,
in.lookup_div_u16_0_counts,
in.alu_sel_div_rng_chk,
Expand All @@ -163,4 +155,4 @@ class lookup_div_u16_0_lookup_settings {
template <typename FF_> using lookup_div_u16_0_relation = GenericLookupRelation<lookup_div_u16_0_lookup_settings, FF_>;
template <typename FF_> using lookup_div_u16_0 = GenericLookup<lookup_div_u16_0_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#pragma once

#include "barretenberg/relations/generic_lookup/generic_lookup_relation.hpp"
Expand Down Expand Up @@ -84,7 +82,6 @@ class lookup_div_u16_1_lookup_settings {
* @details If this is true then the lookup takes place in this row
*
*/

template <typename AllEntities> static inline auto inverse_polynomial_is_computed_at_row(const AllEntities& in)
{
return (in.alu_sel_div_rng_chk == 1 || in.main_sel_rng_16 == 1);
Expand All @@ -99,7 +96,6 @@ class lookup_div_u16_1_lookup_settings {
* @param in Value/Univariate of all entities at row/edge
* @return Accumulator
*/

template <typename Accumulator, typename AllEntities>
static inline auto compute_inverse_exists(const AllEntities& in)
{
Expand Down Expand Up @@ -129,10 +125,8 @@ class lookup_div_u16_1_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_const_entities(const AllEntities& in)
{

return std::forward_as_tuple(in.lookup_div_u16_1,
in.lookup_div_u16_1_counts,
in.alu_sel_div_rng_chk,
Expand All @@ -147,10 +141,8 @@ class lookup_div_u16_1_lookup_settings {
*
* @return All the entities needed for the lookup
*/

template <typename AllEntities> static inline auto get_nonconst_entities(AllEntities& in)
{

return std::forward_as_tuple(in.lookup_div_u16_1,
in.lookup_div_u16_1_counts,
in.alu_sel_div_rng_chk,
Expand All @@ -163,4 +155,4 @@ class lookup_div_u16_1_lookup_settings {
template <typename FF_> using lookup_div_u16_1_relation = GenericLookupRelation<lookup_div_u16_1_lookup_settings, FF_>;
template <typename FF_> using lookup_div_u16_1 = GenericLookup<lookup_div_u16_1_lookup_settings, FF_>;

} // namespace bb
} // namespace bb
Loading

0 comments on commit 7dd6a30

Please sign in to comment.