summaryrefslogtreecommitdiff
path: root/build.cmd
diff options
context:
space:
mode:
authorDaniel Podder <dapodd@microsoft.com>2017-03-16 14:37:07 -0700
committerGitHub <noreply@github.com>2017-03-16 14:37:07 -0700
commit1b64c03493a4b7e4336f0dabbdf4ed980f0d109c (patch)
treea99ada676214fba3125a7f0cef2c90fe861317aa /build.cmd
parentf1087c7acbc4dc1bc4556af629a67ea606a96713 (diff)
downloadcoreclr-1b64c03493a4b7e4336f0dabbdf4ed980f0d109c.tar.gz
coreclr-1b64c03493a4b7e4336f0dabbdf4ed980f0d109c.tar.bz2
coreclr-1b64c03493a4b7e4336f0dabbdf4ed980f0d109c.zip
Add IBC support to managed build (#10180)
Add a new build switch, `ibcinstrument`, that adds `/Tuning` on the `crossgen` command line when building System.Private.CoreLib and its peers. Automatically consume IBC optdata during builds when these conditions are met: 1. `ibcinstrument` is *not* passed to the build, 2. optdata is available 3. ibcmerge is available Note that `optdata` will not yet be restored with this change; once packages for master are made available, a new package reference will still need to be added. This PR attempts to unblock manually testing IBC, as well as surrounding CI/infrastructure work. To help produce an IBC-optimized build using manually generated profile data, run the newly added `tests/scripts/optdata/bootstrap.py` script. It will configure the build to consume IBC data from a path automatically, and print out that path where profile data can be copied.
Diffstat (limited to 'build.cmd')
-rw-r--r--build.cmd27
1 files changed, 20 insertions, 7 deletions
diff --git a/build.cmd b/build.cmd
index f0fbb716fc..692386331f 100644
--- a/build.cmd
+++ b/build.cmd
@@ -62,7 +62,8 @@ set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\bin"
set "__LogsDir=%__RootBinDir%\Logs"
-set "__OptDataVersion="
+set "__PgoOptDataVersion="
+set "__IbcOptDataVersion="
set __BuildAll=
@@ -78,6 +79,7 @@ set __BuildJit32="-DBUILD_JIT32=0"
set __BuildStandaloneGC="-DFEATURE_STANDALONE_GC=0"
set __PgoInstrument=0
+set __IbcTuning=
REM __PassThroughArgs is a set of things that will be passed through to nested calls to build.cmd
REM when using "all".
@@ -133,6 +135,7 @@ if /i "%1" == "skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!p
if /i "%1" == "usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly=1&set __BuildNative=1&set __BuildNativeCoreLib=0&set __BuildCoreLib=0&set __BuildTests=0&set __BuildPackages=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "buildjit32" (set __BuildJit32="-DBUILD_JIT32=1"&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "ibcinstrument" (set __IbcTuning=/Tuning&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if /i "%1" == "compatjitcrossgen" (set __CompatJitCrossgen=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "buildstandalonegc" (set __BuildStandaloneGC="-DFEATURE_STANDALONE_GC=1"&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -240,7 +243,10 @@ where /q python || (
set OptDataProjectJsonPath=%__ProjectDir%\src\.nuget\optdata\project.json
if EXIST "%OptDataProjectJsonPath%" (
for /f "tokens=*" %%s in ('python "%__ProjectDir%\extract-from-json.py" -rf "%OptDataProjectJsonPath%" dependencies optimization.PGO.CoreCLR') do @(
- set __OptDataVersion=%%s
+ set __PgoOptDataVersion=%%s
+ )
+ for /f "tokens=*" %%s in ('python "%__ProjectDir%\extract-from-json.py" -rf "%OptDataProjectJsonPath%" dependencies optimization.IBC.CoreCLR') do @(
+ set __IbcOptDataVersion=%%s
)
)
@@ -302,7 +308,7 @@ if %__BuildNative% EQU 1 (
echo %__MsgPrefix%Regenerating the Visual Studio solution
pushd "%__IntermediatesDir%"
- set __ExtraCmakeArgs=!___SDKVersion! "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__OptDataVersion%"
+ set __ExtraCmakeArgs=!___SDKVersion! "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% %__BuildJit32% %__BuildStandaloneGC% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
@@ -356,7 +362,7 @@ if /i "%__DoCrossArchBuild%"=="1" (
pushd "%__CrossCompIntermediatesDir%"
set __CMakeBinDir=%__CrossComponentBinDir%
set "__CMakeBinDir=!__CMakeBinDir:\=/!"
- set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__OptDataVersion%"
+ set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
@@ -401,6 +407,12 @@ if %__BuildCoreLib% EQU 1 (
set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn"
set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.err"
+ set __ExtraBuildArgs=
+ if not defined __IbcTuning (
+ set __ExtraBuildArgs=!__ExtraBuildArgs! -OptimizationDataDir="%__PackagesDir%/optimization.%__BuildOS%-%__BuildArch%.IBC.CoreCLR/%__IbcOptDataVersion%/data/"
+ set __ExtraBuildArgs=!__ExtraBuildArgs! -EnableProfileGuidedOptimization=true
+ )
+
if /i "%__BuildArch%" == "arm64" (
set __nugetBuildArgs=-buildNugetPackage=false
) else if "%__SkipNugetPackage%" == "1" (
@@ -409,7 +421,7 @@ if %__BuildCoreLib% EQU 1 (
set __nugetBuildArgs=-buildNugetPackage=true
)
- @call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\build.proj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! !__nugetBuildArgs! %__RunArgs% %__UnprocessedBuildArgs%
+ @call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\build.proj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! !__nugetBuildArgs! %__RunArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: System.Private.CoreLib build failed. Refer to the build log files for details:
echo "%__LogsDir%\System.Private.CoreLib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
@@ -429,8 +441,8 @@ if %__BuildNativeCoreLib% EQU 1 (
set COMPlus_UseWindowsX86CoreLegacyJit=1
)
- echo "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll"
- "%__CrossgenExe%" /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1
+ echo "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll"
+ "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%" /out "%__BinDir%\System.Private.CoreLib.ni.dll" "%__BinDir%\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1
if NOT !errorlevel! == 0 (
echo %__MsgPrefix%Error: CrossGen System.Private.CoreLib build failed. Refer to %__CrossGenCoreLibLog%
:: Put it in the same log, helpful for Jenkins
@@ -611,6 +623,7 @@ echo respectively^).
echo add nativemscorlib to go further and build the native image for designated mscorlib.
echo toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds.
echo pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.
+echo ibcinstrument: generate IBC-tuning-enabled native images when invoking crossgen.
echo configureonly: skip all builds; only run CMake ^(default: CMake and builds are run^)
echo skipconfigure: skip CMake ^(default: CMake is run^)
echo skipmscorlib: skip building System.Private.CoreLib ^(default: System.Private.CoreLib is built^).