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 VMR support for Windows-x64 PGO Instrumented leg #18672

Merged
merged 16 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
024b680
Enable forwarding down the PgoInstrument argument down the pipeline.
jkoritzinsky Feb 14, 2024
9b7843a
Create a generalized "reference-only" concept for the repo and a "lim…
jkoritzinsky Feb 14, 2024
7c29bf7
Update src/SourceBuild/content/repo-projects/installer.proj
jkoritzinsky Feb 14, 2024
e042248
Publish all artifacts in the PGO instrument leg (we'll handle conflic…
jkoritzinsky Feb 14, 2024
9976dd3
Update patch
jkoritzinsky Feb 14, 2024
d644c46
Merge branch 'main' of github.com:dotnet/installer into vmr-pgoinstru…
jkoritzinsky Feb 15, 2024
316dff7
Update patch
jkoritzinsky Feb 15, 2024
d20f50d
Merge branch 'main' into vmr-pgoinstrument
mmitche Feb 21, 2024
b153fc7
Update src/SourceBuild/patches/runtime/0001-Forward-the-pgoinstrument…
jkoritzinsky Feb 21, 2024
264fd69
Merge remote-tracking branch 'dotnet/main' into vmr-pgoinstrument
jkoritzinsky Feb 21, 2024
e734ab3
Merge branch 'vmr-pgoinstrument' of github.com:jkoritzinsky/installer…
jkoritzinsky Feb 21, 2024
d4f6713
Update src/SourceBuild/content/repo-projects/installer.proj
ViktorHofer Feb 23, 2024
56d586e
Update src/SourceBuild/content/repo-projects/source-build-reference-p…
ViktorHofer Feb 23, 2024
c597edd
Update src/SourceBuild/content/repo-projects/source-build-reference-p…
ViktorHofer Feb 23, 2024
1265a22
Update eng/pipelines/templates/stages/vmr-build.yml
ViktorHofer Feb 23, 2024
e93a7f4
Merge branch 'main' into vmr-pgoinstrument
ViktorHofer Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<InnerBuildArgs>$(InnerBuildArgs) /p:SkipBuildingInstallers=true</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:IncludeAdditionalSharedFrameworks=false</InnerBuildArgs>
<InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:DISABLE_CROSSGEN=true</InnerBuildArgs>
<InnerBuildArgs Condition="'$(PgoInstrument)' == 'true'">$(InnerBuildArgs) /p:PgoInstrument=true</InnerBuildArgs>
</PropertyGroup>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/vmr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:

- ${{ if eq(parameters.targetOS, 'windows') }}:
- script: |
call $(sourcesPath)\build.cmd -ci -cleanWhileBuilding -prepareMachine
call $(sourcesPath)\build.cmd -ci -cleanWhileBuilding -prepareMachine ${{ parameters.extraProperties }}
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
displayName: Build

- ${{ else }}:
Expand Down
13 changes: 13 additions & 0 deletions eng/pipelines/templates/stages/vmr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -826,3 +826,16 @@ stages:
useMonoRuntime: true
targetOS: windows
targetArchitecture: x86

- template: ../jobs/vmr-build.yml
parameters:
buildName: Windows_x64_Pgo
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
vmrBranch: ${{ variables.VmrBranch }}
architecture: x64
pool:
name: ${{ variables.defaultPoolName }}
demands: ${{ variables.defaultPoolDemandsWindows }}
targetOS: windows
targetArchitecture: x64
extraProperties: /p:PgoInstrument=true
1 change: 1 addition & 0 deletions src/SourceBuild/content/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
<NonShippingPackagesListPrefix>NonShipping.Packages.</NonShippingPackagesListPrefix>

<ReferencePackagesDir>$([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'reference'))</ReferencePackagesDir>
<ReferenceAssetsDir>$([MSBuild]::NormalizeDirectory('$(PrereqsPackagesDir)', 'reference-assets'))</ReferenceAssetsDir>
<SourceBuiltArtifactsTarballName>Private.SourceBuilt.Artifacts</SourceBuiltArtifactsTarballName>
<SourceBuiltPrebuiltsTarballName>Private.SourceBuilt.Prebuilts</SourceBuiltPrebuiltsTarballName>

Expand Down
24 changes: 12 additions & 12 deletions src/SourceBuild/content/repo-projects/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -398,21 +398,21 @@
<ItemGroup>
<RepoManifestNonShippingPackage Include="@(RepoManifestPackage)"
Condition="$([System.String]::Copy('%(Identity)').Contains('$([System.IO.Path]::DirectorySeparatorChar)NonShipping$([System.IO.Path]::DirectorySeparatorChar)'))">
<DestinationFolder Condition="'$(RepositoryName)' != 'source-build-reference-packages'">$(ArtifactsNonShippingPackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(RepositoryName)' == 'source-build-reference-packages'">$(ReferencePackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(ArtifactsNonShippingPackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferencePackagesDir)</DestinationFolder>
</RepoManifestNonShippingPackage>

<RepoManifestShippingPackage Include="@(RepoManifestPackage)"
Exclude="@(RepoManifestNonShippingPackage)">
<DestinationFolder Condition="'$(RepositoryName)' != 'source-build-reference-packages'">$(ArtifactsShippingPackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(RepositoryName)' == 'source-build-reference-packages'">$(ReferencePackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(ArtifactsShippingPackagesDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferencePackagesDir)</DestinationFolder>
</RepoManifestShippingPackage>
</ItemGroup>

<!-- Building SBRP: At this point the References directory contains the previously-source-built SBRPs,
clear it before copying the current SBRPs. This ensures n-1 SBRPs aren't required to build the product repos. -->
<RemoveDir Directories="$(ReferencePackagesDir)"
Condition="'$(RepositoryName)' == 'source-build-reference-packages'" />
<RepoManifestAsset>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(ArtifactsAssetsDir)</DestinationFolder>
<DestinationFolder Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferenceAssetsDir)</DestinationFolder>
</RepoManifestAsset>
</ItemGroup>

<!-- Copy shipping packages -->
<Copy SourceFiles="@(RepoManifestShippingPackage)"
Expand All @@ -426,7 +426,7 @@

<!-- Copy assets -->
<Copy SourceFiles="@(RepoManifestAsset)"
DestinationFolder="$(ArtifactsAssetsDir)"
DestinationFolder="%(RepoManifestAsset.DestinationFolder)"
Condition="'@(RepoManifestAsset)' != ''" />

<MakeDir Directories="$(BaseIntermediateOutputPath)" />
Expand Down Expand Up @@ -506,8 +506,8 @@
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(BaseIntermediateOutputPath)ExtractToolPackage.complete">
<PropertyGroup>
<_ToolPackagesRoot Condition="'$(RepositoryName)' != 'source-build-reference-packages'">$(ArtifactsNonShippingPackagesDir)</_ToolPackagesRoot>
<_ToolPackagesRoot Condition="'$(RepositoryName)' == 'source-build-reference-packages'">$(ReferencePackagesDir)</_ToolPackagesRoot>
<_ToolPackagesRoot Condition="'$(ReferenceOnlyRepoArtifacts)' != 'true'">$(ArtifactsNonShippingPackagesDir)</_ToolPackagesRoot>
<_ToolPackagesRoot Condition="'$(ReferenceOnlyRepoArtifacts)' == 'true'">$(ReferencePackagesDir)</_ToolPackagesRoot>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/SourceBuild/content/repo-projects/installer.proj
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
<BuildArgs Condition="'$(TargetOS)' == 'freebsd' and '$(DotNetBuildSourceOnly)' == 'true'">$(BuildArgs) /p:PortableBuild=true</BuildArgs>
<BuildArgs Condition="'$(TargetOS)' != 'windows'">$(BuildArgs) /p:CoreSetupRid=$(TargetRid)</BuildArgs>

<!-- Consume the source-built Core-Setup and toolset. This line must be removed to source-build CLI without source-building Core-Setup first. -->
<BuildArgs>$(BuildArgs) /p:PublicBaseURL=file:%2F%2F$(ArtifactsAssetsDir)</BuildArgs>
<BaseUrl>$(ArtifactsAssetsDir)</BaseUrl>
<BuildArgs>$(BuildArgs) /p:PublicBaseURL=file:%2F%2F$(BaseUrl)</BuildArgs>
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved

<BuildArgs>$(BuildArgs) /p:UsePortableLinuxSharedFramework=false</BuildArgs>

<BuildArgs Condition="'$(PgoInstrument)' == 'true'">$(BuildArgs) /p:PgoInstrument=true</BuildArgs>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/SourceBuild/content/repo-projects/runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<BuildArgs Condition="'$(ShortStack)' != 'true'">$(BuildArgs) /p:BaseOS=$(BaseOS)</BuildArgs>
<BuildArgs Condition="'$(DotNetBuildRuntimeWasmEnableThreads)' == 'true'">$(BuildArgs) /p:DotNetBuildRuntimeWasmEnableThreads=true</BuildArgs>
<BuildArgs Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">$(BuildArgs) /p:DotNetBuildRuntimeNativeAOTRuntimePack=true</BuildArgs>
<BuildArgs Condition="'$(PgoInstrument)' == 'true'">$(BuildArgs) $(FlagParameterPrefix)pgoinstrument</BuildArgs>
</PropertyGroup>

<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<!-- All packages built in SBRP repo are copied to prereqs/package/reference.
Nothing gets copied to the artifacts/packages folder. -->
<ReferenceOnlyRepoArtifacts>true</ReferenceOnlyRepoArtifacts>

<!-- SBRP builds before Arcade so it also needs the bootstrap Arcade version -->
<UseBootstrapArcade>true</UseBootstrapArcade>
Expand Down Expand Up @@ -30,4 +31,13 @@
SourcePath="$(LocalNuGetPackageCacheDirectory)" />
</Target>

<Target Name="ClearPreviousSBRP"
BeforeTargets="CopyRepoArtifacts"
DependsOnTargets="RepoBuild">

ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
<!-- Building SBRP: At this point the References directory contains the previously-source-built SBRPs,
clear it before copying the current SBRPs. This ensures n-1 SBRPs aren't required to build the product repos. -->
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
<RemoveDir Directories="$(ReferencePackagesDir)" />
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
From 6d82f35999ffb5a1ed85931578e46d66816b385b Mon Sep 17 00:00:00 2001
From: Jeremy Koritzinsky <[email protected]>
Date: Wed, 14 Feb 2024 11:43:33 -0800
Subject: [PATCH] Forward the pgoinstrument argument to the inner build for
VMR/Source-build builds

Build all assets when we're building PGO-instrumented assets in a vertical build/source-build scenario (where we won't have assets from a non-PGO-instrumented job available)
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
---
eng/DotNetBuild.props | 1 +
eng/Subsets.props | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/eng/DotNetBuild.props b/eng/DotNetBuild.props
index 8527ec175ad..3c68bf354ba 100644
--- a/eng/DotNetBuild.props
+++ b/eng/DotNetBuild.props
@@ -61,6 +61,7 @@
<!-- Pass through special build modes controlled by properties -->
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeWasmEnableThreads)' == 'true'">$(InnerBuildArgs) /p:WasmEnableThreads=true</InnerBuildArgs>
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)s clr.nativeaotlibs+clr.nativeaotruntime+libs+packs /p:BuildNativeAOTRuntimePack=true /p:SkipLibrariesNativeRuntimePackages=true</InnerBuildArgs>
+ <InnerBuildArgs Condition="'$(PgoInstrument)' == 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)pgoinstrument</InnerBuildArgs>

<!-- This prop needs to be passed to the inner build manually as the BaseInnerSourceBuildCommand gets overriden above -->
<InnerBuildArgs Condition="'$(DotNetBuildRepo)' == 'true'">$(InnerBuildArgs) /p:DotNetBuildRepo=true</InnerBuildArgs>
diff --git a/eng/Subsets.props b/eng/Subsets.props
index cd4532699b1..7af22c51e2e 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -43,6 +43,11 @@
<DefaultSubsets Condition="('$(DotNetBuildSourceOnly)' == 'true' and '$(PrimaryRuntimeFlavor)' != 'Mono') or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' != 'x86' and '$(TargetArchitecture)' != 'x64')">clr+libs+tools+host+packs</DefaultSubsets>
</PropertyGroup>

+ <PropertyGroup>
+ <!-- If we're building from source, then we want to build all of the assets even in a PGO-instrumented build as downstream repos will not be able to pull assets from a matching non-PGO-instrumented build. -->
+ <BuildOnlyPgoInstrumentedAssets Condition="'$(PgoInstrument)' == 'true' and '$(DotNetBuild)' != 'true'">true</BuildOnlyPgoInstrumentedAssets>
+ </PropertyGroup>
+
<!-- Init _subset here to allow RuntimeFlavor to be set as early as possible -->
<PropertyGroup>
<_subset Condition="'$(Subset)' != ''">+$(Subset.ToLowerInvariant())+</_subset>
@@ -79,7 +84,7 @@
'$(BuildTargetFramework)' == '' or
'$(BuildAllConfigurations)' == 'true'">libs.native+</DefaultLibrariesSubsets>
<DefaultLibrariesSubsets>$(DefaultLibrariesSubsets)libs.sfx+libs.oob+libs.pretest</DefaultLibrariesSubsets>
- <!-- Respect the DotNetBuildTests product flag when building the product. -->
+ <!-- Respect the DotNetBuildTests product flag when building the product. -->
<DefaultLibrariesSubsets Condition="'$(DotNetBuildTests)' == 'true'">$(DefaultLibrariesSubsets)+libs.tests</DefaultLibrariesSubsets>

<DefaultToolsSubsets>tools.illink</DefaultToolsSubsets>
@@ -391,7 +396,7 @@
<ProjectToBuild Include="$(CoreClrProjectRoot)crossgen-corelib.proj" Category="clr" />
</ItemGroup>

- <ItemGroup Condition="$(_subset.Contains('+clr.packages+')) and '$(PgoInstrument)' != 'true'">
+ <ItemGroup Condition="$(_subset.Contains('+clr.packages+')) and '$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<ProjectToBuild Include="$(CoreClrProjectRoot).nuget\coreclr-packages.proj" Pack="true" Category="clr" />
<ProjectToBuild Include="$(CoreClrProjectRoot)tools\dotnet-pgo\dotnet-pgo-pack.proj" Pack="true" Category="clr" Condition="'$(DotNetBuildSourceOnly)' != 'true' and '$(RuntimeFlavor)' != 'Mono'"/>
</ItemGroup>
@@ -448,7 +453,7 @@
<ProjectToBuild Include="@(ManagedProjectToBuild)" BuildInParallel="true" Pack="true" Category="host" />
</ItemGroup>

- <ItemGroup Condition="$(_subset.Contains('+host.pkg+')) and '$(PgoInstrument)' != 'true'">
+ <ItemGroup Condition="$(_subset.Contains('+host.pkg+')) and '$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<PkgprojProjectToBuild Include="$(InstallerProjectRoot)pkg\projects\host-packages.proj" SignPhase="MsiFiles" />
<ProjectToBuild Include="@(PkgprojProjectToBuild)" Pack="true" Category="host" />
</ItemGroup>
@@ -508,10 +513,10 @@

<Choose>
<When Condition="$(_subset.Contains('+packs.product+'))">
- <ItemGroup Condition="'$(PgoInstrument)' != 'true'">
+ <ItemGroup Condition="'$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Ref.sfxproj" />
</ItemGroup>
- <ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(PgoInstrument)' != 'true'">
+ <ItemGroup Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Host.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
@@ -521,7 +526,7 @@
<SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" />
</ItemGroup>
<ItemGroup>
- <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(RuntimeFlavor)' != 'Mono' and '$(PgoInstrument)' != 'true'" Include="$(InstallerProjectRoot)\pkg\projects\nativeaot-packages.proj" Category="packs" />
+ <ProjectToBuild Condition="'$(NativeAotSupported)' == 'true' and '$(RuntimeFlavor)' != 'Mono' and '$(BuildOnlyPgoInstrumentedAssets)' != 'true'" Include="$(InstallerProjectRoot)\pkg\projects\nativeaot-packages.proj" Category="packs" />
</ItemGroup>
<ItemGroup>
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" />
@@ -531,12 +536,12 @@
</When>
</Choose>

- <ItemGroup Condition="$(_subset.Contains('+packs.installers+')) AND '$(PgoInstrument)' != 'true'">
+ <ItemGroup Condition="$(_subset.Contains('+packs.installers+')) AND '$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<InstallerProjectToBuild Include="$(InstallerProjectRoot)pkg\sfx\installers.proj" />
<ProjectToBuild Include="@(InstallerProjectToBuild)" Category="packs" />
</ItemGroup>

- <ItemGroup Condition="$(_subset.Contains('+packs.tests+')) AND '$(PgoInstrument)' != 'true'">
+ <ItemGroup Condition="$(_subset.Contains('+packs.tests+')) AND '$(BuildOnlyPgoInstrumentedAssets)' != 'true'">
<TestProjectToBuild Include="$(InstallerProjectRoot)tests\Microsoft.DotNet.CoreSetup.Packaging.Tests\Microsoft.DotNet.CoreSetup.Packaging.Tests.csproj" />
<ProjectToBuild Include="@(TestProjectToBuild)" BuildInParallel="true" Test="true" Category="packs" />
</ItemGroup>
--
2.43.0.windows.1

Loading