-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-36044: Reduce number of unit tests run for PGO build. #14702
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
Changes from all commits
c51bc99
ae95e9f
055957e
6f0edcd
27be2a9
819075a
284a6db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd add to the description of this that "User are encouraged to benchmark the interpreter resulting from a PROFILE_TASK with this flag to decide if it is meaningfully faster than those produced using --pgo for their use cases". I don't care what the flag name is, --pgo-extended is fine by me. as is --pgo-very-long-training-run (a flag who's length matches the build time seems... appropriate). ;) |
||
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. " | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[:] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 | ||
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 [..] 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what "extended" means. I suggest to rename the option to "--pgo-all-tests" and rewrite the help to explain that it runs all tests by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think list.extend(). I.e. run more tests. I didn't want to use --pgo-all because we don't actually run all the tests. Some are excluded using the
support.PGO
flag. However, I don't feel strongly so if you really like --pgo-all, I will change it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, --pgo-harder? 😄