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 PGO for F# compiler #42514

Merged
merged 17 commits into from
Oct 17, 2024
Merged
16 changes: 16 additions & 0 deletions src/Layout/tool_fsharp/tool_fsc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,28 @@
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>

<!-- MIBC, PGO -->
<Import Project="..\redist\targets\GetRuntimeInformation.targets" /> <!-- Rid is set here -->
<PropertyGroup>
<MibcPath>$(PkgMicrosoft_FSharp_Compiler)/contentFiles/mibc</MibcPath>
<MibcRid>$(Rid)</MibcRid>
<MibcRid Condition="$(MibcRid.Contains('musl-'))">$(MibcRid.Replace('musl-', ''))</MibcRid>
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
<MibcFile>$(MibcPath)/optimization.$(MibcRid).mibc.runtime/DotNet_FSharp.mibc</MibcFile>
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
<ReadyToRunOptimizationData>$(MibcFile)</ReadyToRunOptimizationData>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.FSharp.Compiler" ExcludeAssets="contentFiles" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Framework" />
<PackageReference Include="Microsoft.Build.Tasks.Core" />
<PackageReference Include="Microsoft.Build.Utilities.Core" />
</ItemGroup>

<!-- MIBC don't work for SB yet: https://github.com/dotnet/source-build/issues/247 -->
<Target Name="ValidateMibcFile" AfterTargets="_ResolvePublishNuGetPackagePdbsAndXml" Condition="'$(DotNetBuildSourceOnly)' != 'true' AND '$(SelfContained)' == 'true'">
<Error Condition="!Exists('$(MibcFile)')" Text="MIBC file '$(MibcFile)' does not exist." />
</Target>

<Target Name="_ResolvePublishNuGetPackagePdbsAndXml"
AfterTargets="_ResolveCopyLocalAssetsForPublish">
<PropertyGroup>
Expand All @@ -29,6 +44,7 @@
<FilesToCopyFromFSharpCompilerPackage Include="$(PkgMicrosoft_FSharp_Compiler)/contentFiles/$(FSharpCorePath)/FSharp.Core.*.nupkg" SubDir="library-packs\"/>
<FilesToCopyFromFSharpCompilerPackage Include="$(PkgMicrosoft_FSharp_Compiler)/contentFiles/$(FSharpCorePath)/Microsoft.FSharp.Core.NetSdk.props" SubDir="" />
<FilesToCopyFromFSharpCompilerPackage Include="$(PkgMicrosoft_FSharp_Compiler)/contentFiles/any/any/*" Exclude="$(PkgMicrosoft_FSharp_Compiler)/contentFiles/any/any/Microsoft.FSharp.Core.NetSdk.props" SubDir="" />
<FilesToCopyFromFSharpCompilerPackage Include="$(MibcPath)/*" SubDir="" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
</ItemGroup>
<ItemGroup>
<ResolvedFileToPublish
Expand Down