diff options
author | Daniel Podder <dapodd@microsoft.com> | 2017-03-16 14:37:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 14:37:07 -0700 |
commit | 1b64c03493a4b7e4336f0dabbdf4ed980f0d109c (patch) | |
tree | a99ada676214fba3125a7f0cef2c90fe861317aa /build.sh | |
parent | f1087c7acbc4dc1bc4556af629a67ea606a96713 (diff) | |
download | coreclr-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.sh')
-rwxr-xr-x | build.sh | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -30,6 +30,7 @@ usage() echo "crosscomponent - optional argument to build cross-architecture component," echo " - will use CAC_ROOTFS_DIR environment variable if set." echo "pgoinstrument - generate instrumented code for profile guided optimization enabled binaries." + echo "ibcinstrument - generate IBC-tuning-enabled native images when invoking crossgen." echo "configureonly - do not perform any builds; just configure the build." echo "skipconfigure - skip build configuration." echo "skipnative - do not build native components." @@ -304,7 +305,7 @@ build_cross_arch_component() fi fi - __ExtraCmakeArgs="-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" + __ExtraCmakeArgs="-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" build_native $__SkipCrossArchBuild "$__CrossArch" "$__CrossCompIntermediatesDir" "$__ExtraCmakeArgs" "cross-architecture component" # restore ROOTFS_DIR, CROSSCOMPONENT, and CROSSCOMPILE @@ -366,7 +367,7 @@ build_CoreLib_ni() { if [ $__SkipCoreCLR == 0 -a -e $__BinDir/crossgen ]; then echo "Generating native image for System.Private.CoreLib." - $__BinDir/crossgen $__BinDir/System.Private.CoreLib.dll + $__BinDir/crossgen $__IbcTuning $__BinDir/System.Private.CoreLib.dll if [ $? -ne 0 ]; then echo "Failed to generate native image for System.Private.CoreLib." exit 1 @@ -399,7 +400,12 @@ build_CoreLib() echo "Commencing build of managed components for $__BuildOS.$__BuildArch.$__BuildType" # Invoke MSBuild - $__ProjectRoot/run.sh build -Project=$__ProjectDir/build.proj -MsBuildLog="/flp:Verbosity=normal;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log" -BuildTarget -__IntermediatesDir=$__IntermediatesDir -__RootBinDir=$__RootBinDir -BuildNugetPackage=false -UseSharedCompilation=false $__RunArgs $__UnprocessedBuildArgs + __ExtraBuildArgs="" + if [ "$__IbcTuning" -eq "" ]; then + __ExtraBuildArgs="$__ExtraBuildArgs -OptimizationDataDir=\"$__PackagesDir/optimization.$__BuildOS-$__BuildArch.IBC.CoreCLR/$__IbcOptDataVersion/data/\"" + __ExtraBuildArgs="$__ExtraBuildArgs -EnableProfileGuidedOptimization=true" + fi + $__ProjectRoot/run.sh build -Project=$__ProjectDir/build.proj -MsBuildLog="/flp:Verbosity=normal;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log" -BuildTarget -__IntermediatesDir=$__IntermediatesDir -__RootBinDir=$__RootBinDir -BuildNugetPackage=false -UseSharedCompilation=false $__RunArgs $__ExtraBuildArgs $__UnprocessedBuildArgs if [ $? -ne 0 ]; then echo "Failed to build managed components." @@ -550,6 +556,7 @@ __MSBCleanBuildArgs= __UseNinja=0 __VerboseBuild=0 __PgoInstrument=0 +__IbcTuning="" __ConfigureOnly=0 __SkipConfigure=0 __SkipRestore="" @@ -568,7 +575,8 @@ __SkipGenerateVersion=0 __DoCrossArchBuild=0 __PortableLinux=0 __msbuildonunsupportedplatform=0 -__OptDataVersion="" +__PgoOptDataVersion="" +__IbcOptDataVersion="" while :; do if [ $# -le 0 ]; then @@ -672,6 +680,10 @@ while :; do __PgoInstrument=1 ;; + ibcinstrument) + __IbcTuning="/Tuning" + ;; + configureonly) __ConfigureOnly=1 __SkipMSCorLib=1 @@ -832,7 +844,8 @@ fi # Parse the optdata package version from its project.json file optDataProjectJsonPath="$__ProjectRoot/src/.nuget/optdata/project.json" if [ -f $optDataProjectJsonPath ]; then - __OptDataVersion=$("$__ProjectRoot/extract-from-json.py" -rf $optDataProjectJsonPath dependencies optimization.PGO.CoreCLR) + __PgoOptDataVersion=$("$__ProjectRoot/extract-from-json.py" -rf $optDataProjectJsonPath dependencies optimization.PGO.CoreCLR) + __IbcOptDataVersion=$("$__ProjectRoot/extract-from-json.py" -rf $optDataProjectJsonPath dependencies optimization.IBC.CoreCLR) fi # init the target distro name @@ -851,7 +864,7 @@ restore_optdata generate_event_logging_sources # Build the coreclr (native) components. -__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__OptDataVersion" +__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__PgoOptDataVersion" build_native $__SkipCoreCLR "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs" "CoreCLR component" # Build cross-architecture components |