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

Add mibc/profile for R2R FSC/FSI for faster startup #13328

Closed
vzarytovskii opened this issue Jun 20, 2022 · 5 comments · Fixed by #17513
Closed

Add mibc/profile for R2R FSC/FSI for faster startup #13328

vzarytovskii opened this issue Jun 20, 2022 · 5 comments · Fixed by #17513
Assignees
Labels
Area-SetupAndDelivery Setup, packages, templates, SDK, delivery channels Feature Improvement Theme-Performance
Milestone

Comments

@vzarytovskii
Copy link
Member

We should consider adding both managed and native mibc/profiles for fsc and fsi:

  • Come up with both FSC and FSI scenarios for profile generation, add them to dotnet-optimization (@EgorBo can assist with that):
    • Scenarios for collecting the profiling data (F# console, or web app, for example) which will be used to produce profiles.
    • Profiles then will be packaged and published as a NuGet package.
  • When we building the compiler, download the NuGet package with profiles, and use them when building R2R compiler.

@EgorBo Have I missed anything?

@vzarytovskii vzarytovskii added Area-SetupAndDelivery Setup, packages, templates, SDK, delivery channels Feature Improvement Theme-Performance labels Jun 20, 2022
@vzarytovskii vzarytovskii added this to the Backlog milestone Jun 20, 2022
@EgorBo
Copy link
Member

EgorBo commented Jun 20, 2022

Native profile is less relevant here, although, it might uncover some scenarios we don't hit often when we run C# programs and optimize them inside JIT/VM/GC.

I assume the primary target here is to make FSC compiler faster - for that we need a scenario from you where FSC compiles a program so then we can run that scenario on our pipeline, generate an mibc and publish it to a nuget so you can just download it and use during "dotnet publish" for FSC (ideally, with CompositeR2R mode)

@vzarytovskii
Copy link
Member Author

vzarytovskii commented Jun 20, 2022

Native profile is less relevant here, although, it might uncover some scenarios we don't hit often when we run C# programs and optimize them inside JIT/VM/GC.

Got it, thanks.

I assume the primary target here is to make FSC compiler faster - for that we need a scenario from you where FSC compiles a program so then we can run that scenario on our pipeline, generate an mibc and publish it to a nuget so you can just download it and use during "dotnet publish" for FSC (ideally, with CompositeR2R mode)

Yes, faster startup times for compiler, and, most importantly, interactive (FSI) are what we're after.

@vzarytovskii
Copy link
Member Author

We will also need to understand how does it affect, .tail calls, for example, since F# emits a bunch of them.

@EgorBo
Copy link
Member

EgorBo commented Jun 20, 2022

We will also need to understand how does it affect, .tail calls, for example, since F# emits a bunch of them.

We used to avoid instrumenting methods with explicit tails calls but then decided to allow it - dotnet/runtime#58632 so should be fine

@vzarytovskii vzarytovskii modified the milestones: Backlog, August-2022 Aug 1, 2022
@0101 0101 self-assigned this Aug 4, 2022
@EgorBo
Copy link
Member

EgorBo commented Aug 20, 2022

PR: https://dev.azure.com/dnceng/internal/_git/dotnet-optimization/pullrequest/25175

I played with the resulting MIBC locally - it doesn't give much, but it works good with R2RComposite, e.g. I was measuring how long it takes to build https://github.com/giraffe-fsharp/Giraffe

for(;;) { Measure-Command { C:\prj\fsharp\artifacts\bin\fsc\Release\net7.0\win-x64\publish\fsc.exe "@girafe.rsp" }}

best results:

Default: 5350ms
PublishReadyToRun for fsc: 4184ms
PublishReadyToRun + Composite: 3589ms

Around 30% improvement! 🙂

also, hit a runtime issue while I was collecting MIBC: dotnet/runtime#74295

@vzarytovskii vzarytovskii added this to the Backlog milestone Mar 3, 2023
@vzarytovskii vzarytovskii modified the milestones: Backlog, May-2023 May 4, 2023
@vzarytovskii vzarytovskii modified the milestones: May-2023, June-2023 Jun 1, 2023
@vzarytovskii vzarytovskii modified the milestones: June-2023, July-2023 Jul 3, 2023
@vzarytovskii vzarytovskii modified the milestones: July-2023, August-2023 Aug 3, 2023
@vzarytovskii vzarytovskii modified the milestones: August-2023, Backlog Sep 7, 2023
@vzarytovskii vzarytovskii changed the title Consider adding mibc/profile for R2R FSC/FSI for faster startup Add mibc/profile for R2R FSC/FSI for faster startup Nov 13, 2023
@vzarytovskii vzarytovskii modified the milestones: Backlog, January-2024 Jan 4, 2024
@vzarytovskii vzarytovskii removed this from the January-2024 milestone Feb 5, 2024
@psfinaki psfinaki self-assigned this May 28, 2024
@psfinaki psfinaki added this to the May-2024 milestone May 28, 2024
@psfinaki psfinaki modified the milestones: May-2024, June-2024 Jun 6, 2024
@psfinaki psfinaki mentioned this issue Jun 12, 2024
2 tasks
@vzarytovskii vzarytovskii modified the milestones: June-2024, July-2024 Jul 3, 2024
@vzarytovskii vzarytovskii modified the milestones: July-2024, August-2024 Jul 31, 2024
This was referenced Aug 2, 2024
@vzarytovskii vzarytovskii removed their assignment Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-SetupAndDelivery Setup, packages, templates, SDK, delivery channels Feature Improvement Theme-Performance
Projects
Archived in project
4 participants