Skip to content

Commit

Permalink
chore(avm): nuke declare_views
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Jul 17, 2024
1 parent 103f099 commit 43b0efc
Show file tree
Hide file tree
Showing 17 changed files with 1,546 additions and 1,792 deletions.
1,085 changes: 539 additions & 546 deletions barretenberg/cpp/src/barretenberg/relations/generated/avm/alu.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,77 +55,75 @@ template <typename FF_> class binaryImpl {
[[maybe_unused]] const RelationParameters<FF>&,
[[maybe_unused]] const FF& scaling_factor)
{
// Contribution 0
{
Avm_DECLARE_VIEWS(0);
auto tmp = (binary_sel_bin * (-binary_sel_bin + FF(1)));
using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
auto tmp = (new_term.binary_sel_bin * (-new_term.binary_sel_bin + FF(1)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
std::get<0>(evals) += typename Accumulator::View(tmp);
}
// Contribution 1
{
Avm_DECLARE_VIEWS(1);
auto tmp = ((binary_op_id_shift - binary_op_id) * binary_mem_tag_ctr);
using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
auto tmp = ((new_term.binary_op_id_shift - new_term.binary_op_id) * new_term.binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<1>(evals) += tmp;
std::get<1>(evals) += typename Accumulator::View(tmp);
}
// Contribution 2
{
Avm_DECLARE_VIEWS(2);
auto tmp = (((binary_mem_tag_ctr_shift - binary_mem_tag_ctr) + FF(1)) * binary_mem_tag_ctr);
using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
auto tmp = (((new_term.binary_mem_tag_ctr_shift - new_term.binary_mem_tag_ctr) + FF(1)) *
new_term.binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<2>(evals) += tmp;
std::get<2>(evals) += typename Accumulator::View(tmp);
}
// Contribution 3
{
Avm_DECLARE_VIEWS(3);
auto tmp = ((binary_mem_tag_ctr *
(((-binary_sel_bin + FF(1)) * (-binary_mem_tag_ctr_inv + FF(1))) + binary_mem_tag_ctr_inv)) -
binary_sel_bin);
using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
auto tmp = ((new_term.binary_mem_tag_ctr *
(((-new_term.binary_sel_bin + FF(1)) * (-new_term.binary_mem_tag_ctr_inv + FF(1))) +
new_term.binary_mem_tag_ctr_inv)) -
new_term.binary_sel_bin);
tmp *= scaling_factor;
std::get<3>(evals) += tmp;
std::get<3>(evals) += typename Accumulator::View(tmp);
}
// Contribution 4
{
Avm_DECLARE_VIEWS(4);
auto tmp = ((-binary_sel_bin + FF(1)) * binary_acc_ia);
using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
auto tmp = ((-new_term.binary_sel_bin + FF(1)) * new_term.binary_acc_ia);
tmp *= scaling_factor;
std::get<4>(evals) += tmp;
std::get<4>(evals) += typename Accumulator::View(tmp);
}
// Contribution 5
{
Avm_DECLARE_VIEWS(5);
auto tmp = ((-binary_sel_bin + FF(1)) * binary_acc_ib);
using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
auto tmp = ((-new_term.binary_sel_bin + FF(1)) * new_term.binary_acc_ib);
tmp *= scaling_factor;
std::get<5>(evals) += tmp;
std::get<5>(evals) += typename Accumulator::View(tmp);
}
// Contribution 6
{
Avm_DECLARE_VIEWS(6);
auto tmp = ((-binary_sel_bin + FF(1)) * binary_acc_ic);
using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
auto tmp = ((-new_term.binary_sel_bin + FF(1)) * new_term.binary_acc_ic);
tmp *= scaling_factor;
std::get<6>(evals) += tmp;
std::get<6>(evals) += typename Accumulator::View(tmp);
}
// Contribution 7
{
Avm_DECLARE_VIEWS(7);
auto tmp = (((binary_acc_ia - binary_ia_bytes) - (binary_acc_ia_shift * FF(256))) * binary_mem_tag_ctr);
using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
auto tmp =
(((new_term.binary_acc_ia - new_term.binary_ia_bytes) - (new_term.binary_acc_ia_shift * FF(256))) *
new_term.binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<7>(evals) += tmp;
std::get<7>(evals) += typename Accumulator::View(tmp);
}
// Contribution 8
{
Avm_DECLARE_VIEWS(8);
auto tmp = (((binary_acc_ib - binary_ib_bytes) - (binary_acc_ib_shift * FF(256))) * binary_mem_tag_ctr);
using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
auto tmp =
(((new_term.binary_acc_ib - new_term.binary_ib_bytes) - (new_term.binary_acc_ib_shift * FF(256))) *
new_term.binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<8>(evals) += tmp;
std::get<8>(evals) += typename Accumulator::View(tmp);
}
// Contribution 9
{
Avm_DECLARE_VIEWS(9);
auto tmp = (((binary_acc_ic - binary_ic_bytes) - (binary_acc_ic_shift * FF(256))) * binary_mem_tag_ctr);
using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>;
auto tmp =
(((new_term.binary_acc_ic - new_term.binary_ic_bytes) - (new_term.binary_acc_ic_shift * FF(256))) *
new_term.binary_mem_tag_ctr);
tmp *= scaling_factor;
std::get<9>(evals) += tmp;
std::get<9>(evals) += typename Accumulator::View(tmp);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ template <typename FF_> class conversionImpl {
[[maybe_unused]] const RelationParameters<FF>&,
[[maybe_unused]] const FF& scaling_factor)
{
// Contribution 0
{
Avm_DECLARE_VIEWS(0);
auto tmp = (conversion_sel_to_radix_le * (-conversion_sel_to_radix_le + FF(1)));
using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
auto tmp = (new_term.conversion_sel_to_radix_le * (-new_term.conversion_sel_to_radix_le + FF(1)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
std::get<0>(evals) += typename Accumulator::View(tmp);
}
}
};
Expand Down
21 changes: 9 additions & 12 deletions barretenberg/cpp/src/barretenberg/relations/generated/avm/gas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,23 @@ template <typename FF_> class gasImpl {
[[maybe_unused]] const RelationParameters<FF>&,
[[maybe_unused]] const FF& scaling_factor)
{
// Contribution 0
{
Avm_DECLARE_VIEWS(0);
auto tmp = (gas_sel_gas_cost - gas_sel_gas_cost);
using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
auto tmp = (new_term.gas_sel_gas_cost - new_term.gas_sel_gas_cost);
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
std::get<0>(evals) += typename Accumulator::View(tmp);
}
// Contribution 1
{
Avm_DECLARE_VIEWS(1);
auto tmp = (gas_l2_gas_fixed_table - gas_l2_gas_fixed_table);
using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
auto tmp = (new_term.gas_l2_gas_fixed_table - new_term.gas_l2_gas_fixed_table);
tmp *= scaling_factor;
std::get<1>(evals) += tmp;
std::get<1>(evals) += typename Accumulator::View(tmp);
}
// Contribution 2
{
Avm_DECLARE_VIEWS(2);
auto tmp = (gas_da_gas_fixed_table - gas_da_gas_fixed_table);
using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
auto tmp = (new_term.gas_da_gas_fixed_table - new_term.gas_da_gas_fixed_table);
tmp *= scaling_factor;
std::get<2>(evals) += tmp;
std::get<2>(evals) += typename Accumulator::View(tmp);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ template <typename FF_> class keccakf1600Impl {
[[maybe_unused]] const RelationParameters<FF>&,
[[maybe_unused]] const FF& scaling_factor)
{
// Contribution 0
{
Avm_DECLARE_VIEWS(0);
auto tmp = (keccakf1600_sel_keccakf1600 * (-keccakf1600_sel_keccakf1600 + FF(1)));
using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
auto tmp = (new_term.keccakf1600_sel_keccakf1600 * (-new_term.keccakf1600_sel_keccakf1600 + FF(1)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
std::get<0>(evals) += typename Accumulator::View(tmp);
}
}
};
Expand Down
111 changes: 54 additions & 57 deletions barretenberg/cpp/src/barretenberg/relations/generated/avm/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,92 +79,89 @@ template <typename FF_> class kernelImpl {
[[maybe_unused]] const RelationParameters<FF>&,
[[maybe_unused]] const FF& scaling_factor)
{
// Contribution 0
{
Avm_DECLARE_VIEWS(0);
auto tmp =
((-main_sel_last + FF(1)) * (kernel_note_hash_exist_write_offset_shift -
(kernel_note_hash_exist_write_offset + main_sel_op_note_hash_exists)));
using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_note_hash_exist_write_offset_shift -
(new_term.kernel_note_hash_exist_write_offset + new_term.main_sel_op_note_hash_exists)));
tmp *= scaling_factor;
std::get<0>(evals) += tmp;
std::get<0>(evals) += typename Accumulator::View(tmp);
}
// Contribution 1
{
Avm_DECLARE_VIEWS(1);
auto tmp = ((-main_sel_last + FF(1)) * (kernel_emit_note_hash_write_offset_shift -
(kernel_emit_note_hash_write_offset + main_sel_op_emit_note_hash)));
using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_emit_note_hash_write_offset_shift -
(new_term.kernel_emit_note_hash_write_offset + new_term.main_sel_op_emit_note_hash)));
tmp *= scaling_factor;
std::get<1>(evals) += tmp;
std::get<1>(evals) += typename Accumulator::View(tmp);
}
// Contribution 2
{
Avm_DECLARE_VIEWS(2);
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_nullifier_exists_write_offset_shift -
(kernel_nullifier_exists_write_offset + (main_sel_op_nullifier_exists * main_ib))));
using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
auto tmp =
((-new_term.main_sel_last + FF(1)) * (new_term.kernel_nullifier_exists_write_offset_shift -
(new_term.kernel_nullifier_exists_write_offset +
(new_term.main_sel_op_nullifier_exists * new_term.main_ib))));
tmp *= scaling_factor;
std::get<2>(evals) += tmp;
std::get<2>(evals) += typename Accumulator::View(tmp);
}
// Contribution 3
{
Avm_DECLARE_VIEWS(3);
auto tmp =
((-main_sel_last + FF(1)) *
(kernel_nullifier_non_exists_write_offset_shift -
(kernel_nullifier_non_exists_write_offset + (main_sel_op_nullifier_exists * (-main_ib + FF(1))))));
using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_nullifier_non_exists_write_offset_shift -
(new_term.kernel_nullifier_non_exists_write_offset +
(new_term.main_sel_op_nullifier_exists * (-new_term.main_ib + FF(1))))));
tmp *= scaling_factor;
std::get<3>(evals) += tmp;
std::get<3>(evals) += typename Accumulator::View(tmp);
}
// Contribution 4
{
Avm_DECLARE_VIEWS(4);
auto tmp = ((-main_sel_last + FF(1)) * (kernel_emit_nullifier_write_offset_shift -
(kernel_emit_nullifier_write_offset + main_sel_op_emit_nullifier)));
using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_emit_nullifier_write_offset_shift -
(new_term.kernel_emit_nullifier_write_offset + new_term.main_sel_op_emit_nullifier)));
tmp *= scaling_factor;
std::get<4>(evals) += tmp;
std::get<4>(evals) += typename Accumulator::View(tmp);
}
// Contribution 5
{
Avm_DECLARE_VIEWS(5);
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_l1_to_l2_msg_exists_write_offset_shift -
(kernel_l1_to_l2_msg_exists_write_offset + main_sel_op_l1_to_l2_msg_exists)));
using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
auto tmp =
((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_l1_to_l2_msg_exists_write_offset_shift -
(new_term.kernel_l1_to_l2_msg_exists_write_offset + new_term.main_sel_op_l1_to_l2_msg_exists)));
tmp *= scaling_factor;
std::get<5>(evals) += tmp;
std::get<5>(evals) += typename Accumulator::View(tmp);
}
// Contribution 6
{
Avm_DECLARE_VIEWS(6);
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_emit_unencrypted_log_write_offset_shift -
(kernel_emit_unencrypted_log_write_offset + main_sel_op_emit_unencrypted_log)));
using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
auto tmp =
((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_emit_unencrypted_log_write_offset_shift -
(new_term.kernel_emit_unencrypted_log_write_offset + new_term.main_sel_op_emit_unencrypted_log)));
tmp *= scaling_factor;
std::get<6>(evals) += tmp;
std::get<6>(evals) += typename Accumulator::View(tmp);
}
// Contribution 7
{
Avm_DECLARE_VIEWS(7);
auto tmp =
((-main_sel_last + FF(1)) * (kernel_emit_l2_to_l1_msg_write_offset_shift -
(kernel_emit_l2_to_l1_msg_write_offset + main_sel_op_emit_l2_to_l1_msg)));
using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_emit_l2_to_l1_msg_write_offset_shift -
(new_term.kernel_emit_l2_to_l1_msg_write_offset + new_term.main_sel_op_emit_l2_to_l1_msg)));
tmp *= scaling_factor;
std::get<7>(evals) += tmp;
std::get<7>(evals) += typename Accumulator::View(tmp);
}
// Contribution 8
{
Avm_DECLARE_VIEWS(8);
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_sload_write_offset_shift - (kernel_sload_write_offset + main_sel_op_sload)));
using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_sload_write_offset_shift -
(new_term.kernel_sload_write_offset + new_term.main_sel_op_sload)));
tmp *= scaling_factor;
std::get<8>(evals) += tmp;
std::get<8>(evals) += typename Accumulator::View(tmp);
}
// Contribution 9
{
Avm_DECLARE_VIEWS(9);
auto tmp = ((-main_sel_last + FF(1)) *
(kernel_sstore_write_offset_shift - (kernel_sstore_write_offset + main_sel_op_sstore)));
using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>;
auto tmp = ((-new_term.main_sel_last + FF(1)) *
(new_term.kernel_sstore_write_offset_shift -
(new_term.kernel_sstore_write_offset + new_term.main_sel_op_sstore)));
tmp *= scaling_factor;
std::get<9>(evals) += tmp;
std::get<9>(evals) += typename Accumulator::View(tmp);
}
}
};
Expand Down
Loading

0 comments on commit 43b0efc

Please sign in to comment.