-
Notifications
You must be signed in to change notification settings - Fork 844
Workaround .NET GC perf problems affecting compiler within repo #13736
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
Conversation
|
Sigh, setting ServerGC seems to kill |
|
We can theoretically set it only for proto, fsharp, and visualfsharp solutions. |
yeah DOTNET_* is the preferred way in 6+, but both are supported atm. Perhaps your other projects are failing since they arent compiling against latest 7preview7 drop? clrgc.dll has been included only starting in preview7 |
It's that we need to set it for just |
| <SetEnvironmentVariableTask Name="DOTNET_gcServer" Value="1" /> | ||
| </Target> | ||
| <Target Name="UnsetGcServerAfterRunningSdkCompiler" AfterTargets="CoreCompile" Condition="'$(Configuration)' == 'Proto' OR '$(DisableCompilerRedirection)'=='true'"> | ||
| <SetEnvironmentVariableTask Name="DOTNET_gcServer" Value="0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this is not a stable way of setting/unsetting the environment variable for only the execution of fsc in a multiproc setting.
AFAICS MSBuild has no way to say "use this environment variable when running these tasks".
Not sure if there's much else we can do to get the compiler in .NET SDK 7 p7 working efficiently.
|
@vzarytovskii I give up here - I have no idea how to get the environment variable DOTNET_gcServer=1 set only for executions of the F# compiler that comes from the .NET SDK. As usual MSBuild is the hardest thing in the universe. I guess we could execute via a batch file or similar. |
|
Tested with various modes including GCStress=0xC, disabled/enabled R2R, disabled optimizations in jit - it only reproduces with gcServer=1 so sounds like a gc bug to me cc @dotnet/gc @jkotas |
|
@EgorBo Thank you for looking at this |
|
Here's a standalone repro, instructions are in readme: https://github.com/vzarytovskii/fsyacc-issue-repro/tree/main Update: Turning tailcalls and optimize off does not change anything - still fails. |
|
thanks for the repro @vzarytovskii, we will take a look (I just quickly tried and I can repro it). |
|
I'm investigating - I suspect we are not handling mark stack overflow in Server GC correctly in this case. |
|
@PeterSolMS Any luck with investigation? I suppose, fix will target rc2? |
|
Sorry about not keeping this up to date - I checked in a fix, PR is here dotnet/runtime#74571. Fix should be in RC2. |

Workaround #13730 to help make this repo more usable
This largely corrects the perf of the F# compiler in .NET 7 preview 7 when used from
build.batIdeally we would prefer the workaround
but this seems to kill fslex and fsyacc - there may be something we can do for that, not sure. (and should this be
DOTNET_GCName=clrgc.dllcc @mangod9 )