Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
internal_call_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
5
6namespace bb::avm2 {
7
8template <typename FF_>
9template <typename ContainerOverSubrelations, typename AllEntities>
10void internal_callImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
11 const AllEntities& in,
12 [[maybe_unused]] const RelationParameters<FF_>&,
13 [[maybe_unused]] const FF_& scaling_factor)
14{
15 using C = ColumnAndShifts;
16
17 PROFILE_THIS_NAME("accumulate/internal_call");
18
19 const auto execution_NOT_LAST_EXEC = in.get(C::execution_sel) * in.get(C::execution_sel_shift);
20 const auto execution_RESET_NEXT_CALL_ID =
21 in.get(C::execution_sel_enter_call) + in.get(C::execution_enqueued_call_start_shift);
22 const auto execution_NEW_NEXT_CALL_ID =
23 (in.get(C::execution_sel_execute_internal_call) + in.get(C::execution_sel_execute_internal_return)) *
24 (FF(1) - in.get(C::execution_sel_error)) +
25 in.get(C::execution_sel_exit_call);
26 const auto execution_RESET_OR_NEW_NEXT_CALL_ID = ((execution_RESET_NEXT_CALL_ID + execution_NEW_NEXT_CALL_ID) -
27 execution_RESET_NEXT_CALL_ID * execution_NEW_NEXT_CALL_ID);
28 const auto execution_PROPAGATE_CALL_ID = (FF(1) - execution_RESET_OR_NEW_NEXT_CALL_ID);
29
30 { // CALL_ID_STARTS_ONE
31 using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
32 auto tmp = execution_RESET_NEXT_CALL_ID * (in.get(C::execution_internal_call_id_shift) - FF(1));
33 tmp *= scaling_factor;
34 std::get<0>(evals) += typename Accumulator::View(tmp);
35 }
36 { // NEW_CALL_ID_ON_CALL
37 using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
38 auto tmp = in.get(C::execution_sel_execute_internal_call) *
39 (in.get(C::execution_internal_call_id_shift) - in.get(C::execution_next_internal_call_id));
40 tmp *= scaling_factor;
41 std::get<1>(evals) += typename Accumulator::View(tmp);
42 }
43 { // RESTORE_INTERNAL_ID_ON_RETURN
44 using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
45 auto tmp = in.get(C::execution_sel_execute_internal_return) *
46 (in.get(C::execution_internal_call_id_shift) - in.get(C::execution_internal_call_return_id));
47 tmp *= scaling_factor;
48 std::get<2>(evals) += typename Accumulator::View(tmp);
49 }
50 { // DEFAULT_PROPAGATE_CALL_ID
51 using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
52 auto tmp = execution_NOT_LAST_EXEC * execution_PROPAGATE_CALL_ID *
53 (in.get(C::execution_internal_call_id_shift) - in.get(C::execution_internal_call_id));
54 tmp *= scaling_factor;
55 std::get<3>(evals) += typename Accumulator::View(tmp);
56 }
57 { // RET_ID_STARTS_ZERO
58 using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
59 auto tmp = execution_RESET_NEXT_CALL_ID * in.get(C::execution_internal_call_return_id_shift);
60 tmp *= scaling_factor;
61 std::get<4>(evals) += typename Accumulator::View(tmp);
62 }
63 { // NEW_RETURN_ID_ON_CALL
64 using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
65 auto tmp = in.get(C::execution_sel_execute_internal_call) *
66 (in.get(C::execution_internal_call_return_id_shift) - in.get(C::execution_internal_call_id));
67 tmp *= scaling_factor;
68 std::get<5>(evals) += typename Accumulator::View(tmp);
69 }
70 { // DEFAULT_PROPAGATE_RET_ID
71 using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
72 auto tmp = execution_NOT_LAST_EXEC * execution_PROPAGATE_CALL_ID *
73 (in.get(C::execution_internal_call_return_id_shift) - in.get(C::execution_internal_call_return_id));
74 tmp *= scaling_factor;
75 std::get<6>(evals) += typename Accumulator::View(tmp);
76 }
77 { // NEXT_CALL_ID_STARTS_TWO
78 using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
79 auto tmp = execution_RESET_NEXT_CALL_ID * (in.get(C::execution_next_internal_call_id_shift) - FF(2));
80 tmp *= scaling_factor;
81 std::get<7>(evals) += typename Accumulator::View(tmp);
82 }
83 { // INCR_NEXT_INT_CALL_ID
84 using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
85 auto tmp = execution_NOT_LAST_EXEC * (FF(1) - execution_RESET_OR_NEW_NEXT_CALL_ID) *
86 (in.get(C::execution_next_internal_call_id_shift) -
87 (in.get(C::execution_next_internal_call_id) + in.get(C::execution_sel_execute_internal_call)));
88 tmp *= scaling_factor;
89 std::get<8>(evals) += typename Accumulator::View(tmp);
90 }
91 { // INTERNAL_RET_ERROR
92 using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>;
93 auto tmp =
94 in.get(C::execution_sel_execute_internal_return) *
95 ((in.get(C::execution_internal_call_return_id) *
96 (in.get(C::execution_sel_opcode_error) * (FF(1) - in.get(C::execution_internal_call_return_id_inv)) +
97 in.get(C::execution_internal_call_return_id_inv)) -
98 FF(1)) +
99 in.get(C::execution_sel_opcode_error));
100 tmp *= scaling_factor;
101 std::get<9>(evals) += typename Accumulator::View(tmp);
102 }
103}
104
105} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:35
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define PROFILE_THIS_NAME(name)
Definition op_count.hpp:16
Container for parameters used by the grand product (permutation, lookup) Honk relations.