dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.82k stars 772 forks source link

Enable PGO - alternative approach #17317

Open psfinaki opened 1 week ago

psfinaki commented 1 week ago

Description

This should eventually make the FSC and FSI start about 30% faster. The implementation is inspired by the runtime targets.

Fixes #12636 Fixes #13328

github-actions[bot] commented 1 week ago

:white_check_mark: No release notes required

psfinaki commented 1 week ago

Hi @EgorBo, so this is an alternative approach to enable PGO, without doing profile generation ourselves. However - this doesn't seem to work so far, as in, benchmarks don't show any improvements.

Any ideas what could be wrong?

vzarytovskii commented 1 week ago

@EgorBo any pointers on how to figure out why is profile we get from nuget is not applying, and if we generate it locally, it shows a difference?

EgorBo commented 1 week ago

@psfinaki @vzarytovskii I presume you test it on fsi? have you added fsi as a training scenario to dotnet-optimization repo? Otherwise it produces some MIBC trained to TechEmpower, console apps and for F# it's only "build Giraffe" scenario

vzarytovskii commented 1 week ago

@psfinaki @vzarytovskii I presume you test it on fsi? have you added fsi as a training scenario to dotnet-optimization repo? Otherwise it produces some MIBC trained to TechEmpower, console apps and for F# it's only "build Giraffe" scenario

We have tested on fsc, since that's the only F# scenario in the optimization repo as of now.

@psfinaki did you try to build Giraffe with and without profile applied in this PR? Does it change anything?

psfinaki commented 1 week ago

So far I have only tried running published fsc against an empty test.fsx script. That was enough to show the differece in that other PR with us creating the profile.

Let me try Giraffe.

psfinaki commented 1 week ago

@vzarytovskii @EgorBo I'm afraid I don't see any difference in Giraffe compilation either :( it's the same execution time basically.

EgorBo commented 1 week ago

@vzarytovskii @EgorBo I'm afraid I don't see any difference in Giraffe compilation either :( it's the same execution time basically.

Do you a MIBC that works locally? can you send it to me? I'll check weigths in it

vzarytovskii commented 4 days ago

@EgorBo did you, by any chance, look at it? Curious what's the difference between those.

EgorBo commented 4 days ago

@EgorBo did you, by any chance, looked at it? Curious what's the difference between those.

The only @psfinaki collected looks extremely weird to me. I propose we merge this PR as is since it generally looks corret to me, the problem must be inside the dotnet-optimization repo, once we figure it out and fix it should propagate a correct MIBC and optimize things out, hopefully 🙂 I'll take a look on Friday