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

Attestation aggregation: optimizations and benchmarks #7938

Merged
merged 95 commits into from
Feb 4, 2021

Conversation

farazdagi
Copy link
Contributor

@farazdagi farazdagi commented Nov 24, 2020

What type of PR is this?

Bug fix
Feature
Other/Refactoring

What does this PR do? Why is it needed?

In this PR:

  • optMaxCoverAttestationAggregation() method is added. See https://hackmd.io/@farazdagi/in-place-attagg for details on design of that optimized aggregation procedure. Once this feature is tested, optMaxCoverAttestationAggregation() will replace existing Bitlist based implementation.
  • New flag value (opt_max_cover) for attestation-aggregation-strategy flag has been added (flag is tracked via Feature flag tracking: attestation-aggregation-strategy=opt_max_cover #8365). So, new aggregation is used when one of the following is set:
    • attestation-aggregation-strategy=opt_max_cover
    • --dev
  • E2E tests are also configured to rely on a new optimized max-cover.
  • ❗ It should be safe to merge this PR, in a sense that it affects only --dev mode of beacon node.

PRs extracted from this PR:

Which issues(s) does this PR fix?

Fixes #7871

Other notes for review

  • It is very hard to benchmark the Aggregation() function, because it updates attestations in place, so for each bench mark run you need to create another copy of attestations lists (and when using b.StopTimer()/b.StartTimer() inside the for i := 0; i < b.N; i++ loop -- so that each case gets its own copy -- benchmarks seem to hang.
  • So, attestation copying was put inside as a part of benched function, but that copying is more heavy than aggregation itself, so results on number of operations completed are only relatively useful.
  • Still, benchmarks allow to see the difference in allocations (which was the purpose of this optimization -- get rid of unnecessary allocations), so benchmarks are still useful:
    image

@farazdagi farazdagi self-assigned this Nov 24, 2020
@stale
Copy link

stale bot commented Dec 24, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale There hasn't been any activity here in some time... label Dec 24, 2020
@rauljordan rauljordan removed the Stale There hasn't been any activity here in some time... label Dec 28, 2020
@farazdagi farazdagi marked this pull request as ready for review January 29, 2021 22:36
@farazdagi farazdagi requested a review from a team as a code owner January 29, 2021 22:36
@farazdagi farazdagi marked this pull request as draft February 1, 2021 13:23
@farazdagi farazdagi marked this pull request as ready for review February 2, 2021 23:48
Copy link
Contributor

@rauljordan rauljordan left a comment

Choose a reason for hiding this comment

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

Went through this a few times and feel really good about it. It is also very well gated behind flags and I know you put in a lot of thought into this. Excited to see it integrated into runtime and for future PR's!

@farazdagi
Copy link
Contributor Author

Went through this a few times and feel really good about it. It is also very well gated behind flags and I know you put in a lot of thought into this. Excited to see it integrated into runtime and for future PR's!

Thank you!

@prylabs-bulldozer prylabs-bulldozer bot merged commit c97ea76 into develop Feb 4, 2021
@delete-merged-branch delete-merged-branch bot deleted the maxcover-optimizations-and-benchmarks branch February 4, 2021 00:58
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.

Attestation aggregation: further optimizations
2 participants