Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bb): eliminate recursion in accumulate* #8205

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Conversation

fcarreiro
Copy link
Contributor

@fcarreiro fcarreiro commented Aug 27, 2024

Jean is working on the AVM recursive verifier and he found that these functions were executed recursively (the compiler was indeed generating recursive calls) and causing a stack overflow. This fixes that.

  • Also fixed accumulate_relation_evaluations_without_skipping which was only not skipping the first relation. Tests fail with the fix, I've added a comment.
  • I also made some params const&. IIUC they were being copied before which can be massive for the type AllValues. Not sure about that but you might want to check the callers, etc.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @fcarreiro and the rest of your teammates on Graphite Graphite

@fcarreiro fcarreiro force-pushed the fc/bb-stack-overflow branch 3 times, most recently from d0f3107 to 3b11930 Compare August 27, 2024 11:52
@ludamad
Copy link
Collaborator

ludamad commented Aug 27, 2024

As discussed, a helper for this constant range loop would help readability

auto seq = std::make_index_sequence<NUM_RELATIONS>{};
// This evaluates the function across the relations, without recursion.
[&]<size_t... I>(std::index_sequence<I...>) {
// FIXME: You wan't /*consider_skipping=*/false here, but tests need to be fixed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure I get this, and why not fix the test if so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have the time, like 20 verification tests fail. Cody said Luke will look at it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it wasn't immediately obvious to me what the issue is so I thought Luke should have a look.

@fcarreiro fcarreiro force-pushed the fc/bb-stack-overflow branch from 3b11930 to 0adca16 Compare August 27, 2024 12:30
@fcarreiro fcarreiro merged commit 47e83fa into master Aug 27, 2024
37 checks passed
Copy link
Contributor Author

Merge activity

@fcarreiro fcarreiro deleted the fc/bb-stack-overflow branch August 27, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants