summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2017-06-28 10:37:51 -0700
committerPat Gavlin <pagavlin@microsoft.com>2017-06-28 11:35:54 -0700
commit3c1c553bc9c27dab04258ce184c74af151f6a311 (patch)
treee72459c630c44967260662d3930043a398bd68b1
parent217ab30d021f27be6fe4f35126a88e592366acbf (diff)
downloadcoreclr-3c1c553bc9c27dab04258ce184c74af151f6a311.tar.gz
coreclr-3c1c553bc9c27dab04258ce184c74af151f6a311.tar.bz2
coreclr-3c1c553bc9c27dab04258ce184c74af151f6a311.zip
Add a flag to build.{sh,cmd} to disable PGO.
This is helpful when performing JIT throughput measurements.
-rw-r--r--build.cmd9
-rwxr-xr-xbuild.sh11
-rw-r--r--pgosupport.cmake2
3 files changed, 17 insertions, 5 deletions
diff --git a/build.cmd b/build.cmd
index f77c7d2c16..ecd07f11a8 100644
--- a/build.cmd
+++ b/build.cmd
@@ -79,6 +79,7 @@ set __BuildStandaloneGC="-DFEATURE_STANDALONE_GC=0"
set __BuildStandaloneGCOnly="-DFEATURE_STANDALONE_GC_ONLY=0"
set __PgoInstrument=0
+set __PgoOptimize=1
set __IbcTuning=
REM __PassThroughArgs is a set of things that will be passed through to nested calls to build.cmd
@@ -138,6 +139,7 @@ if /i "%1" == "skipbuildpackages" (set __BuildPackages=0&set processedArgs=!pr
if /i "%1" == "skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
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" == "pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "nopgooptimize" (set __PgoOptimize=0&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" == "buildstandalonegc" (
@@ -158,6 +160,8 @@ if [!processedArgs!]==[] (
:ArgsDone
+if %__PgoOptimize%==0 set __RestoreOptData=0
+
if defined __BuildAll goto BuildAll
set /A __TotalSpecifiedBuildArch=__BuildArchX64 + __BuildArchX86 + __BuildArchArm + __BuildArchArm64
@@ -314,7 +318,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=%__PgoOptDataVersion%"
+ set __ExtraCmakeArgs=!___SDKVersion! "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% %__BuildStandaloneGC% %__BuildStandaloneGCOnly% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
@@ -368,7 +372,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=%__PgoOptDataVersion%"
+ 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%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
@@ -620,6 +624,7 @@ echo for the specified platform ^(FreeBSD, Linux, NetBSD, OS X or Windows,
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 nopgooptimize - do not use profile guided optimizations.
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^)
diff --git a/build.sh b/build.sh
index 30856d5a09..5ebf40a694 100755
--- a/build.sh
+++ b/build.sh
@@ -29,6 +29,7 @@ usage()
echo " - will use ROOTFS_DIR environment variable if set."
echo "crosscomponent - optional argument to build cross-architecture component,"
echo " - will use CAC_ROOTFS_DIR environment variable if set."
+ echo "nopgooptimize - do not use profile guided optimizations."
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."
@@ -363,7 +364,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=$__PgoOptDataVersion"
+ __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 -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize"
build_native $__SkipCrossArchBuild "$__CrossArch" "$__CrossCompIntermediatesDir" "$__ExtraCmakeArgs" "cross-architecture component"
# restore ROOTFS_DIR, CROSSCOMPONENT, and CROSSCOMPILE
@@ -595,6 +596,7 @@ __MSBCleanBuildArgs=
__UseNinja=0
__VerboseBuild=0
__PgoInstrument=0
+__PgoOptimize=1
__IbcTuning=""
__ConfigureOnly=0
__SkipConfigure=0
@@ -730,6 +732,11 @@ while :; do
__PgoInstrument=1
;;
+ nopgooptimize)
+ __PgoOptimize=0
+ __SkipRestoreOptData=1
+ ;;
+
ibcinstrument)
__IbcTuning="/Tuning"
;;
@@ -936,7 +943,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=$__PgoOptDataVersion"
+__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__PgoOptDataVersion -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize"
build_native $__SkipCoreCLR "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs" "CoreCLR component"
# Build cross-architecture components
diff --git a/pgosupport.cmake b/pgosupport.cmake
index e92923fcb0..947286628c 100644
--- a/pgosupport.cmake
+++ b/pgosupport.cmake
@@ -34,7 +34,7 @@ function(add_pgo TargetName)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -flto -fuse-ld=gold -fprofile-instr-generate")
endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELWITHDEBINFO)
endif(WIN32)
- else(CLR_CMAKE_PGO_INSTRUMENT)
+ elseif(CLR_CMAKE_PGO_OPTIMIZE)
# If we don't have profile data availble, gracefully fall back to a non-PGO opt build
if(EXISTS ${ProfilePath})
if(WIN32)