Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions barretenberg/cpp/pil/vm2/context.pil
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace execution;

// The initial next_context_id = 2, in row = 1
#[INCR_NEXT_CONTEXT_ID]
NOT_LAST_EXEC * (next_context_id' - (next_context_id + sel_enter_call)) = 0;
NOT_LAST_EXEC * (next_context_id' - (next_context_id + sel_enter_call + enqueued_call_start')) = 0;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Taken from here


// nested_exit_call = 1 ==> context_id' = parent_id
// sel_enter_call = 1 ==> context_id' = next_context_id
Expand Down Expand Up @@ -235,12 +235,12 @@ namespace execution;
#[PROPAGATE_RD_SIZE]
NOT_LAST_EXEC * DEFAULT_CTX_ROW * (last_child_returndata_size' - last_child_returndata_size) = 0;

// sel_exit_call = 1 ==> last_child_id' = context_id; <-- sel_exit_call includes error case
// nested_exit_call = 1 ==> last_child_id' = context_id; <-- sel_exit_call includes error case
// sel_enter_call = 1 ==> last_child_id' = 0;
// enqueued_call_start = 1 ==> last_child_id = 0; <-- Current row is 0
// otherwise = 0 ==> last_child_id' = last_child_id;
#[EXIT_CALL_LAST_CHILD_ID]
NOT_LAST_EXEC * sel_exit_call * (last_child_id' - context_id) = 0;
NOT_LAST_EXEC * nested_exit_call * (last_child_id' - context_id) = 0;
#[ENTER_CALL_LAST_CHILD_ID]
NOT_LAST_EXEC * sel_enter_call * last_child_id' = 0;
#[LAST_CHILD_ID_IS_ZERO]
Expand Down
7 changes: 4 additions & 3 deletions barretenberg/cpp/pil/vm2/opcodes/internal_call.pil
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ namespace execution;
// When we encounter this case, the internal call information in the next row is constrained to change (incremented, unwound, etc)
pol NEW_NEXT_CALL_ID = (sel_execute_internal_call + sel_execute_internal_return) * (1 - sel_error) + sel_exit_call;

pol PROPAGATE_CALL_ID = 1 - RESET_NEXT_CALL_ID - NEW_NEXT_CALL_ID;
// This is an XOR
pol RESET_OR_NEW_NEXT_CALL_ID = (RESET_NEXT_CALL_ID + NEW_NEXT_CALL_ID) - (RESET_NEXT_CALL_ID * NEW_NEXT_CALL_ID);
pol PROPAGATE_CALL_ID = 1 - RESET_OR_NEW_NEXT_CALL_ID;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From here, RESET_NEXT_CALL_ID and NEW_NEXT_CALL_ID weren't mutually exclusive.


// =============================
// === Internal Call Pointer ===
Expand Down Expand Up @@ -57,9 +59,8 @@ namespace execution;
#[NEXT_CALL_ID_STARTS_TWO]
RESET_NEXT_CALL_ID * (next_internal_call_id' - 2) = 0;
// If we encounter a sel_execute_internal_call, we increment the next next_internal_call_id, unless we are changing context
pol CONTEXT_CHANGE = (RESET_NEXT_CALL_ID + sel_exit_call) - (RESET_NEXT_CALL_ID * sel_exit_call) ;
#[INCR_NEXT_INT_CALL_ID]
NOT_LAST_EXEC * (1 - CONTEXT_CHANGE) * (next_internal_call_id' - (next_internal_call_id + sel_execute_internal_call)) = 0;
NOT_LAST_EXEC * (1 - RESET_OR_NEW_NEXT_CALL_ID) * (next_internal_call_id' - (next_internal_call_id + sel_execute_internal_call)) = 0;

// =============================
// === Error Handling ====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ void contextImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
auto tmp =
execution_NOT_LAST_EXEC * (in.get(C::execution_next_context_id_shift) -
(in.get(C::execution_next_context_id) + in.get(C::execution_sel_enter_call)));
(in.get(C::execution_next_context_id) + in.get(C::execution_sel_enter_call) +
in.get(C::execution_enqueued_call_start_shift)));
tmp *= scaling_factor;
std::get<7>(evals) += typename Accumulator::View(tmp);
}
Expand Down Expand Up @@ -285,7 +286,7 @@ void contextImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
}
{ // EXIT_CALL_LAST_CHILD_ID
using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>;
auto tmp = execution_NOT_LAST_EXEC * in.get(C::execution_sel_exit_call) *
auto tmp = execution_NOT_LAST_EXEC * in.get(C::execution_nested_exit_call) *
(in.get(C::execution_last_child_id_shift) - in.get(C::execution_context_id));
tmp *= scaling_factor;
std::get<35>(evals) += typename Accumulator::View(tmp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ template <typename FF_> class internal_callImpl {
public:
using FF = FF_;

static constexpr std::array<size_t, 10> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 6, 3, 3, 6, 3, 6, 5 };
static constexpr std::array<size_t, 10> SUBRELATION_PARTIAL_LENGTHS = { 3, 3, 3, 7, 3, 3, 7, 3, 7, 5 };

template <typename AllEntities> inline static bool skip(const AllEntities& in)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ void internal_callImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
(in.get(C::execution_sel_execute_internal_call) + in.get(C::execution_sel_execute_internal_return)) *
(FF(1) - in.get(C::execution_sel_error)) +
in.get(C::execution_sel_exit_call);
const auto execution_PROPAGATE_CALL_ID = ((FF(1) - execution_RESET_NEXT_CALL_ID) - execution_NEW_NEXT_CALL_ID);
const auto execution_CONTEXT_CHANGE = ((execution_RESET_NEXT_CALL_ID + in.get(C::execution_sel_exit_call)) -
execution_RESET_NEXT_CALL_ID * in.get(C::execution_sel_exit_call));
const auto execution_RESET_OR_NEW_NEXT_CALL_ID = ((execution_RESET_NEXT_CALL_ID + execution_NEW_NEXT_CALL_ID) -
execution_RESET_NEXT_CALL_ID * execution_NEW_NEXT_CALL_ID);
const auto execution_PROPAGATE_CALL_ID = (FF(1) - execution_RESET_OR_NEW_NEXT_CALL_ID);

{ // CALL_ID_STARTS_ONE
using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
Expand Down Expand Up @@ -82,7 +82,7 @@ void internal_callImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
}
{ // INCR_NEXT_INT_CALL_ID
using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
auto tmp = execution_NOT_LAST_EXEC * (FF(1) - execution_CONTEXT_CHANGE) *
auto tmp = execution_NOT_LAST_EXEC * (FF(1) - execution_RESET_OR_NEW_NEXT_CALL_ID) *
(in.get(C::execution_next_internal_call_id_shift) -
(in.get(C::execution_next_internal_call_id) + in.get(C::execution_sel_execute_internal_call)));
tmp *= scaling_factor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { AvmProvingTester } from './avm_proving_tester.js';

const TIMEOUT = 300_000;

// TODO: unskip when check-circuit works for AMM. Confirm that it is fast enough to run in CI.
describe.skip('AVM proven AMM', () => {
describe('AVM proven AMM', () => {
const logger = createLogger('avm-proven-tests-amm');
const metrics = new TestExecutorMetrics();
let tester: AvmProvingTester;
Expand Down
Loading