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

Use Dynamic Profile-Guided Optimization #5216

Merged
merged 2 commits into from
Feb 8, 2023

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Jan 27, 2023

Changes

Enable .NET 7.0 Dynamic PGO and on stack replacement

Example of experiences in the wild https://petabridge.com/blog/dotnet7-pgo-performance-improvements/

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Remarks

With this one weird trick

@flcl42
Copy link
Contributor

flcl42 commented Jan 30, 2023

Sync phase has a different profile than regular execution. Does PGO need to realign after sync?

@benaadams
Copy link
Member Author

Sync phase has a different profile than regular execution. Does PGO need to realign after sync?

It reprofiles on each restart; also for the lifetime of the running app. So as new methods are called it fast-Jit compiles them for fast startup; then after a number of calls will re-Jit them optimised using the data from those calls.

It doesn't de-optimise methods and move back to profiling them once they have been optimised however if that is the question. Presumably sync phase will be calling different methods than regular execution; rather than causing the same methods to execute completely differently? (e.g. use a different concrete class behind an interface)

@LukaszRozmej
Copy link
Member

  1. I assume it is sufficient to mark this on entry points to the app and not on every project?
  2. Before merging this would benefit from some measurements in Benchmarks and Metrics @kamilchodola

@benaadams
Copy link
Member Author

  1. I assume it is sufficient to mark this on entry points to the app and not on every project?

Yes, only needs to be on the exe; not the libs

@benaadams
Copy link
Member Author

Yes, only needs to be on the exe; not the libs

It will re-optimise all the libs and exe, but not currently the runtime as that is already PGO optimised to a "ready to run" version. However in .NET 8; it will also revisit the runtime and reoptimize that for the running app with dotnet/runtime#70941

@rubo rubo self-requested a review February 7, 2023 16:15
@LukaszRozmej
Copy link
Member

@kamilchodola do you want to test it in branch or should we merge it to master?

@kamilchodola
Copy link
Contributor

I'd prefer merging it to master and test together with all changes for some time.

@LukaszRozmej LukaszRozmej merged commit 4c94c42 into NethermindEth:master Feb 8, 2023
benaadams added a commit to benaadams/nethermind that referenced this pull request Feb 8, 2023
* Use Dynamic Profile-Guided Optimization

* Use for benchmarks also
@benaadams benaadams deleted the PGO branch February 11, 2023 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants