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

Reduce cloning overhead #83

Merged
merged 9 commits into from
Mar 6, 2024

Conversation

Nashtare
Copy link
Collaborator

@Nashtare Nashtare commented Mar 5, 2024

Alternative to #81 for reducing the overhead of GenerationInputs cloning. The rationale is that once the inputs have been processed, some are unneeded to carry on with witness generation / proof execution, and can be trimmed off, alleviating the downside of cloning. Also some method signatures have been changed to take a reference to the GenerationInputs.

Could actually be done against main, but continuations branch has done some changes around, so probably better to just redirect this tweak there.

@Nashtare Nashtare requested review from dvdplm and LindaGuiga March 5, 2024 09:50
@Nashtare Nashtare self-assigned this Mar 5, 2024
Copy link
Contributor

@LindaGuiga LindaGuiga left a comment

Choose a reason for hiding this comment

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

Looks great, thanks a lot!

@Nashtare
Copy link
Collaborator Author

Nashtare commented Mar 5, 2024

@dvdplm happy to hear your thoughts compared to your approach

Copy link
Contributor

@muursh muursh left a comment

Choose a reason for hiding this comment

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

Nice. I'm good with this

Copy link
Contributor

@4l0n50 4l0n50 left a comment

Choose a reason for hiding this comment

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

LGTM. It looks like GenerationState never needs the full GenerationInputs isn't it? So maybe it would be more "honest" to have another struct there?

@LindaGuiga
Copy link
Contributor

LGTM. It looks like GenerationState never needs the full GenerationInputs isn't it? So maybe it would be more "honest" to have another struct there?

GenerationState::new needs all of the inputs to generate the initial prover inputs though. It no longer needs once all of that has been initialized, but the first time, it still needs that information.

@4l0n50
Copy link
Contributor

4l0n50 commented Mar 5, 2024

GenerationState::new needs all of the inputs to generate the initial prover inputs though. It no longer needs once all of that has been initialized, but the first time, it still needs that information.

Yes, but I meant (though not 100% sure) that the field inputs of GenerationState doesn't need to be the full GenerationInputs.

Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

This is awesome, much better than #81!

One word of caution though: it is going to be important to keep track of when GenerationInputs has been trimmed and when it's full-fat. In some sense the trimmed/full-fat versions are different types and it would be safer to actually have different types for them, so that it becomes impossible to misuse trim().

@dvdplm dvdplm mentioned this pull request Mar 5, 2024
@LindaGuiga
Copy link
Contributor

In some sense the trimmed/full-fat versions are different types and it would be safer to actually have different types for them, so that it becomes impossible to misuse trim().

So should the two different types be implemented in this PR already?

@Nashtare
Copy link
Collaborator Author

Nashtare commented Mar 5, 2024

Yeah I'll take care of that tomorrow unless you want to go ahead and handle it yourself after the merge

@Nashtare Nashtare added the crate: evm_arithmetization Anything related to the evm_arithmetization crate. label Mar 6, 2024
@LindaGuiga LindaGuiga merged commit e61b3fc into continuation_to_zkevm Mar 6, 2024
5 checks passed
@LindaGuiga LindaGuiga deleted the robin-alternative-cloning branch March 6, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: evm_arithmetization Anything related to the evm_arithmetization crate.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants