From c51bc99089c15b02089f99fb6796ea0f0c7c859d Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Wed, 10 Jul 2019 22:47:59 -0700 Subject: [PATCH 1/7] Reduce number of unit tests run for PGO build. This speeds up the PGO profile generation by a factor of about 15X. Running the full unit test suite is slow. This may result in a slightly less optimized build since not as many code branches will be executed. If you are willing to wait for the slower build, the old behavior can be enabled as follows: ./configure [...] --with-profile-task='-m test --pgo' --- Makefile.pre.in | 51 ++++++++++++++++++++++++++++++++++++++++++++++--- configure | 34 ++++++++++++++++++++++++++++++++- configure.ac | 12 ++++++++++++ 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index ef9a4f88598f13..427baaf5607337 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -255,9 +255,54 @@ TCLTK_INCLUDES= @TCLTK_INCLUDES@ TCLTK_LIBS= @TCLTK_LIBS@ # The task to run while instrumented when building the profile-opt target. -# We exclude unittests with -x that take a rediculious amount of time to -# run in the instrumented training build or do not provide much value. -PROFILE_TASK=-m test.regrtest --pgo +# To speed up profile generation, we don't run the full unit test suite +# by default. To run the full suite, use PROFILE_TASK="-m test --pgo". +PROFILE_TASK= @PROFILE_TASK@ + +# The set of tests below was chosen based on the following criteria: either +# they exercise a commonly used C extension module or type, or they run some +# relatively typical Python code. +DEFAULT_PROFILE_TASK=-m test --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binop \ + test_bisect \ + test_bytes \ + test_cmath \ + test_codecs \ + test_collections \ + test_complex \ + test_dataclasses \ + test_datetime \ + test_decimal \ + test_difflib \ + test_embed \ + test_float \ + test_fstring \ + test_functools \ + test_generators \ + test_hashlib \ + test_heapq \ + test_int \ + test_itertools \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_operator \ + test_ordered_dict \ + test_pickle \ + test_pprint \ + test_re \ + test_set \ + test_statistics \ + test_struct \ + test_tabnanny \ + test_time \ + test_unicode \ + test_xml_etree \ + test_xml_etree_c # report files for gcov / lcov coverage report COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/configure b/configure index 2c49d853a384a0..5163c3dc0d885e 100755 --- a/configure +++ b/configure @@ -686,6 +686,7 @@ target_vendor target_cpu target LLVM_AR +PROFILE_TASK DEF_MAKE_RULE DEF_MAKE_ALL_RULE ABIFLAGS @@ -785,6 +786,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -819,6 +821,7 @@ with_pydebug with_trace_refs with_assertions enable_optimizations +with_profile_task with_lto with_hash_algorithm with_address_sanitizer @@ -897,6 +900,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1149,6 +1153,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1286,7 +1299,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1439,6 +1452,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1505,6 +1519,8 @@ Optional Packages: --with-pydebug build with Py_DEBUG defined --with-trace-refs enable tracing references for debugging purpose --with-assertions build with C assertions enabled + --with-profile-task=ARGS + Python args for PGO generation task --with-lto Enable Link Time Optimization in any build. Disabled by default. --with-hash-algorithm=[fnv|siphash24] @@ -6426,6 +6442,22 @@ else DEF_MAKE_RULE="all" fi +# PGO generation task + +PROFILE_TASK='$(DEFAULT_PROFILE_TASK)' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-profile-task=STRING" >&5 +$as_echo_n "checking for --with-profile-task=STRING... " >&6; } + +# Check whether --with-profile-task was given. +if test "${with_profile_task+set}" = set; then : + withval=$with_profile_task; + PROFILE_TASK="$withval" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROFILE_TASK" >&5 +$as_echo "$PROFILE_TASK" >&6; } + # Make llvm-relatec checks work on systems where llvm tools are not installed with their # normal names in the default $PATH (ie: Ubuntu). They exist under the # non-suffixed name in their versioned llvm directory. diff --git a/configure.ac b/configure.ac index cc31df866d522f..bb9cb6855ca9e5 100644 --- a/configure.ac +++ b/configure.ac @@ -1293,6 +1293,18 @@ else DEF_MAKE_RULE="all" fi +# PGO generation task +AC_SUBST(PROFILE_TASK) +PROFILE_TASK='$(DEFAULT_PROFILE_TASK)' +AC_MSG_CHECKING(for --with-profile-task=STRING) +AC_ARG_WITH(profile-task, + AS_HELP_STRING([--with-profile-task=ARGS], + [Python args for PGO generation task]), +[ + PROFILE_TASK="$withval" + ]) +AC_MSG_RESULT($PROFILE_TASK) + # Make llvm-relatec checks work on systems where llvm tools are not installed with their # normal names in the default $PATH (ie: Ubuntu). They exist under the # non-suffixed name in their versioned llvm directory. From ae95e9f97c4c358bbe64a0afab59f741d100be6e Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Thu, 11 Jul 2019 01:28:31 -0700 Subject: [PATCH 2/7] Add NEWS. --- .../2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst new file mode 100644 index 00000000000000..0f87f84c77fe07 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst @@ -0,0 +1,6 @@ +Reduce the number of unit tests run for the PGO generation task. This +speeds up the task by a factor of about 15X. Running the full unit test +suite is slow. This change may result in a slightly less optimized build +since not as many code branches will be executed. If you are willing to +wait for the much slower build, the old behavior can be restored using +'./configure [..] --with-profile-task="-m test --pgo"'. From 055957ee13d2446aff4b07ce5d42c8e7ec5bc659 Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Thu, 11 Jul 2019 01:31:59 -0700 Subject: [PATCH 3/7] Move NEWS entry under "Build" --- .../2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/NEWS.d/next/{Core and Builtins => Build}/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst (100%) diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst similarity index 100% rename from Misc/NEWS.d/next/Core and Builtins/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst rename to Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst From 6f0edcde894f70fee0c498c751cbc1bee26aaa36 Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Mon, 15 Jul 2019 15:19:55 -0700 Subject: [PATCH 4/7] Move list of PGO tests from Makefile to regrtest. Add --pgo-extended option to regrtest. --- Lib/test/libregrtest/cmdline.py | 6 +- Lib/test/libregrtest/main.py | 56 +++++++++++++++++++ Makefile.pre.in | 48 +--------------- .../2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst | 2 +- configure | 16 +----- configure.ac | 2 +- 6 files changed, 67 insertions(+), 63 deletions(-) diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py index 9f1bf6800824a6..c8fedc7ad329bd 100644 --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -264,7 +264,9 @@ def _create_parser(): help='only write the name of test cases that will be run' ' , don\'t execute them') group.add_argument('-P', '--pgo', dest='pgo', action='store_true', - help='enable Profile Guided Optimization training') + help='enable Profile Guided Optimization (PGO) training') + group.add_argument('--pgo-extended', action='store_true', + help='enable extended PGO training (slower training)') group.add_argument('--fail-env-changed', action='store_true', help='if a test file alters the environment, mark ' 'the test as failed') @@ -344,6 +346,8 @@ def _parse_args(args, **kwargs): parser.error("-G/--failfast needs either -v or -W") if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3): parser.error("--pgo/-v don't go together!") + if ns.pgo_extended: + ns.pgo = True # pgo_extended implies pgo if ns.nowindows: print("Warning: the --nowindows (-n) option is deprecated. " diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index e2274254fdb89c..b71ec978df7fe6 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -21,6 +21,55 @@ from test import support +# Set of tests run by default if --pgo is specified. The tests below were +# chosen based on the following criteria: either they exercise a commonly used +# C extension module or type, or they run some relatively typical Python code. +# Long running tests should be avoided because the PGO instrumented executable +# runs slowly. +_PGO_TESTS = [ + 'test_array', + 'test_base64', + 'test_binascii', + 'test_binop', + 'test_bisect', + 'test_bytes', + 'test_cmath', + 'test_codecs', + 'test_collections', + 'test_complex', + 'test_dataclasses', + 'test_datetime', + 'test_decimal', + 'test_difflib', + 'test_embed', + 'test_float', + 'test_fstring', + 'test_functools', + 'test_generators', + 'test_hashlib', + 'test_heapq', + 'test_int', + 'test_itertools', + 'test_json', + 'test_long', + 'test_math', + 'test_memoryview', + 'test_operator', + 'test_ordered_dict', + 'test_pickle', + 'test_pprint', + 'test_re', + 'test_set', + 'test_statistics', + 'test_struct', + 'test_tabnanny', + 'test_time', + 'test_unicode', + 'test_xml_etree', + 'test_xml_etree_c', +] + + class Regrtest: """Execute a test suite. @@ -214,6 +263,13 @@ def find_tests(self, tests): removepy(self.tests) + # Add default PGO tests if no tests are specified + if self.ns.pgo and not self.ns.args: + if self.ns.pgo_extended: + pass # will run all tests not marked excluded for PGO + else: + self.ns.args = _PGO_TESTS[:] # run smaller set of tests + stdtests = STDTESTS[:] nottests = NOTTESTS.copy() if self.ns.exclude: diff --git a/Makefile.pre.in b/Makefile.pre.in index 427baaf5607337..318756fd5b9c32 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -256,54 +256,10 @@ TCLTK_LIBS= @TCLTK_LIBS@ # The task to run while instrumented when building the profile-opt target. # To speed up profile generation, we don't run the full unit test suite -# by default. To run the full suite, use PROFILE_TASK="-m test --pgo". +# by default. The default is "-m test --pgo". To run more tests, use +# PROFILE_TASK="-m test --pgo-extended" PROFILE_TASK= @PROFILE_TASK@ -# The set of tests below was chosen based on the following criteria: either -# they exercise a commonly used C extension module or type, or they run some -# relatively typical Python code. -DEFAULT_PROFILE_TASK=-m test --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binop \ - test_bisect \ - test_bytes \ - test_cmath \ - test_codecs \ - test_collections \ - test_complex \ - test_dataclasses \ - test_datetime \ - test_decimal \ - test_difflib \ - test_embed \ - test_float \ - test_fstring \ - test_functools \ - test_generators \ - test_hashlib \ - test_heapq \ - test_int \ - test_itertools \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_operator \ - test_ordered_dict \ - test_pickle \ - test_pprint \ - test_re \ - test_set \ - test_statistics \ - test_struct \ - test_tabnanny \ - test_time \ - test_unicode \ - test_xml_etree \ - test_xml_etree_c - # report files for gcov / lcov coverage report COVERAGE_INFO= $(abs_builddir)/coverage.info COVERAGE_REPORT=$(abs_builddir)/lcov-report diff --git a/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst index 0f87f84c77fe07..52d1059d5baa23 100644 --- a/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst +++ b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst @@ -3,4 +3,4 @@ speeds up the task by a factor of about 15X. Running the full unit test suite is slow. This change may result in a slightly less optimized build since not as many code branches will be executed. If you are willing to wait for the much slower build, the old behavior can be restored using -'./configure [..] --with-profile-task="-m test --pgo"'. +'./configure [..] --with-profile-task="-m test --pgo-extended"'. diff --git a/configure b/configure index 5163c3dc0d885e..b8113dce11427f 100755 --- a/configure +++ b/configure @@ -786,7 +786,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -900,7 +899,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1153,15 +1151,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1299,7 +1288,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1452,7 +1441,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -6444,7 +6432,7 @@ fi # PGO generation task -PROFILE_TASK='$(DEFAULT_PROFILE_TASK)' +PROFILE_TASK='-m test --pgo' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-profile-task=STRING" >&5 $as_echo_n "checking for --with-profile-task=STRING... " >&6; } diff --git a/configure.ac b/configure.ac index bb9cb6855ca9e5..eee78dd97955a6 100644 --- a/configure.ac +++ b/configure.ac @@ -1295,7 +1295,7 @@ fi # PGO generation task AC_SUBST(PROFILE_TASK) -PROFILE_TASK='$(DEFAULT_PROFILE_TASK)' +PROFILE_TASK='-m test --pgo' AC_MSG_CHECKING(for --with-profile-task=STRING) AC_ARG_WITH(profile-task, AS_HELP_STRING([--with-profile-task=ARGS], From 27be2a95d899e118c1b8a857295fbe26891980ec Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Tue, 16 Jul 2019 12:13:20 -0700 Subject: [PATCH 5/7] Move default list of PGO tests to own module. --- Lib/test/libregrtest/main.py | 58 ++---------------------------------- Lib/test/libregrtest/pgo.py | 52 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 Lib/test/libregrtest/pgo.py diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index b71ec978df7fe6..78b6790685c9df 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -17,59 +17,11 @@ INTERRUPTED, CHILD_ERROR, TEST_DID_NOT_RUN, PROGRESS_MIN_TIME, format_test_result, is_failed) from test.libregrtest.setup import setup_tests +from test.libregrtest.pgo import setup_pgo_tests from test.libregrtest.utils import removepy, count, format_duration, printlist from test import support -# Set of tests run by default if --pgo is specified. The tests below were -# chosen based on the following criteria: either they exercise a commonly used -# C extension module or type, or they run some relatively typical Python code. -# Long running tests should be avoided because the PGO instrumented executable -# runs slowly. -_PGO_TESTS = [ - 'test_array', - 'test_base64', - 'test_binascii', - 'test_binop', - 'test_bisect', - 'test_bytes', - 'test_cmath', - 'test_codecs', - 'test_collections', - 'test_complex', - 'test_dataclasses', - 'test_datetime', - 'test_decimal', - 'test_difflib', - 'test_embed', - 'test_float', - 'test_fstring', - 'test_functools', - 'test_generators', - 'test_hashlib', - 'test_heapq', - 'test_int', - 'test_itertools', - 'test_json', - 'test_long', - 'test_math', - 'test_memoryview', - 'test_operator', - 'test_ordered_dict', - 'test_pickle', - 'test_pprint', - 'test_re', - 'test_set', - 'test_statistics', - 'test_struct', - 'test_tabnanny', - 'test_time', - 'test_unicode', - 'test_xml_etree', - 'test_xml_etree_c', -] - - class Regrtest: """Execute a test suite. @@ -263,12 +215,8 @@ def find_tests(self, tests): removepy(self.tests) - # Add default PGO tests if no tests are specified - if self.ns.pgo and not self.ns.args: - if self.ns.pgo_extended: - pass # will run all tests not marked excluded for PGO - else: - self.ns.args = _PGO_TESTS[:] # run smaller set of tests + # add default PGO tests if no tests are specified + setup_pgo_tests(self.ns) stdtests = STDTESTS[:] nottests = NOTTESTS.copy() diff --git a/Lib/test/libregrtest/pgo.py b/Lib/test/libregrtest/pgo.py new file mode 100644 index 00000000000000..327f19374c3ff0 --- /dev/null +++ b/Lib/test/libregrtest/pgo.py @@ -0,0 +1,52 @@ +# Set of tests run by default if --pgo is specified. The tests below were +# chosen based on the following criteria: either they exercise a commonly used +# C extension module or type, or they run some relatively typical Python code. +# Long running tests should be avoided because the PGO instrumented executable +# runs slowly. +PGO_TESTS = [ + 'test_array', + 'test_base64', + 'test_binascii', + 'test_binop', + 'test_bisect', + 'test_bytes', + 'test_cmath', + 'test_codecs', + 'test_collections', + 'test_complex', + 'test_dataclasses', + 'test_datetime', + 'test_decimal', + 'test_difflib', + 'test_embed', + 'test_float', + 'test_fstring', + 'test_functools', + 'test_generators', + 'test_hashlib', + 'test_heapq', + 'test_int', + 'test_itertools', + 'test_json', + 'test_long', + 'test_math', + 'test_memoryview', + 'test_operator', + 'test_ordered_dict', + 'test_pickle', + 'test_pprint', + 'test_re', + 'test_set', + 'test_statistics', + 'test_struct', + 'test_tabnanny', + 'test_time', + 'test_unicode', + 'test_xml_etree', + 'test_xml_etree_c', +] + +def setup_pgo_tests(ns): + if not ns.args and not ns.pgo_extended: + # run default set of tests for PGO training + ns.args = PGO_TESTS[:] From 819075ab4a63800630a8171e970e5a25b244b205 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Wed, 17 Jul 2019 15:28:29 -0700 Subject: [PATCH 6/7] update the news wording a bit. more detail and a performance disclaimer. --- .../next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst index 52d1059d5baa23..a5bfecbabbd7eb 100644 --- a/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst +++ b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst @@ -1,6 +1,9 @@ Reduce the number of unit tests run for the PGO generation task. This -speeds up the task by a factor of about 15X. Running the full unit test -suite is slow. This change may result in a slightly less optimized build +speeds up the task by a factor of about 15x. Running the full unit test +suite is slow. This change may result in a slightly less optimized build since not as many code branches will be executed. If you are willing to wait for the much slower build, the old behavior can be restored using -'./configure [..] --with-profile-task="-m test --pgo-extended"'. +'./configure [..] --with-profile-task="-m test --pgo-extended"'. We make +no guarantees as to which PGO task set produces a faster build. Users who +care should run their own relevant benchmarks as results can depend on the +environment, workload, and compiler tool chain. From 284a6db055f0cf98c4713af782cdc17ef1b9d099 Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Fri, 19 Jul 2019 10:09:50 -0700 Subject: [PATCH 7/7] Set PROFILE_TASK from env or configure args. The configure flags --with-something are intended for enabling optional external software. Just use a variable instead. --- .../2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst | 8 +++---- configure | 22 +++++++------------ configure.ac | 16 +++++--------- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst index a5bfecbabbd7eb..177c4cb6d17c77 100644 --- a/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst +++ b/Misc/NEWS.d/next/Build/2019-07-11-01-28-24.bpo-36044.gIgfiJ.rst @@ -3,7 +3,7 @@ speeds up the task by a factor of about 15x. Running the full unit test suite is slow. This change may result in a slightly less optimized build since not as many code branches will be executed. If you are willing to wait for the much slower build, the old behavior can be restored using -'./configure [..] --with-profile-task="-m test --pgo-extended"'. We make -no guarantees as to which PGO task set produces a faster build. Users who -care should run their own relevant benchmarks as results can depend on the -environment, workload, and compiler tool chain. +'./configure [..] PROFILE_TASK="-m test --pgo-extended"'. We make no +guarantees as to which PGO task set produces a faster build. Users who +care should run their own relevant benchmarks as results can depend on +the environment, workload, and compiler tool chain. diff --git a/configure b/configure index b8113dce11427f..4cea98e3652896 100755 --- a/configure +++ b/configure @@ -820,7 +820,6 @@ with_pydebug with_trace_refs with_assertions enable_optimizations -with_profile_task with_lto with_hash_algorithm with_address_sanitizer @@ -858,6 +857,7 @@ LDFLAGS LIBS CPPFLAGS CPP +PROFILE_TASK PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR' @@ -1507,8 +1507,6 @@ Optional Packages: --with-pydebug build with Py_DEBUG defined --with-trace-refs enable tracing references for debugging purpose --with-assertions build with C assertions enabled - --with-profile-task=ARGS - Python args for PGO generation task --with-lto Enable Link Time Optimization in any build. Disabled by default. --with-hash-algorithm=[fnv|siphash24] @@ -1563,6 +1561,8 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + PROFILE_TASK + Python args for PGO generation task PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path @@ -6430,19 +6430,13 @@ else DEF_MAKE_RULE="all" fi -# PGO generation task - -PROFILE_TASK='-m test --pgo' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-profile-task=STRING" >&5 -$as_echo_n "checking for --with-profile-task=STRING... " >&6; } - -# Check whether --with-profile-task was given. -if test "${with_profile_task+set}" = set; then : - withval=$with_profile_task; - PROFILE_TASK="$withval" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking PROFILE_TASK" >&5 +$as_echo_n "checking PROFILE_TASK... " >&6; } +if test -z "$PROFILE_TASK" +then + PROFILE_TASK='-m test --pgo' fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROFILE_TASK" >&5 $as_echo "$PROFILE_TASK" >&6; } diff --git a/configure.ac b/configure.ac index eee78dd97955a6..b9759e12f89f74 100644 --- a/configure.ac +++ b/configure.ac @@ -1293,16 +1293,12 @@ else DEF_MAKE_RULE="all" fi -# PGO generation task -AC_SUBST(PROFILE_TASK) -PROFILE_TASK='-m test --pgo' -AC_MSG_CHECKING(for --with-profile-task=STRING) -AC_ARG_WITH(profile-task, - AS_HELP_STRING([--with-profile-task=ARGS], - [Python args for PGO generation task]), -[ - PROFILE_TASK="$withval" - ]) +AC_ARG_VAR(PROFILE_TASK, Python args for PGO generation task) +AC_MSG_CHECKING(PROFILE_TASK) +if test -z "$PROFILE_TASK" +then + PROFILE_TASK='-m test --pgo' +fi AC_MSG_RESULT($PROFILE_TASK) # Make llvm-relatec checks work on systems where llvm tools are not installed with their