Skip to content

Commit 758d5d4

Browse files
committed
Resolve merge conflict.
2 parents 8eed9ac + e44bcca commit 758d5d4

File tree

449 files changed

+18506
-3508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

449 files changed

+18506
-3508
lines changed

benchmark/scripts/Benchmark_Driver

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,14 @@ def instrument_test(driver_path, test, num_samples):
118118
return avg_test_output
119119

120120

121-
def get_tests(driver_path):
121+
def get_tests(driver_path, args):
122122
"""Return a list of available performance tests"""
123-
return subprocess.check_output([driver_path, '--list']).split()[2:]
123+
tests = subprocess.check_output([driver_path, '--list']).split()[2:]
124+
if args.filter:
125+
return filter(lambda name: name.startswith(args.filter), tests)
126+
if not args.benchmarks:
127+
return tests
128+
return sorted(list(set(tests).intersection(set(args.benchmarks))))
124129

125130

126131
def get_current_git_branch(git_repo_path):
@@ -168,9 +173,7 @@ def run_benchmarks(driver, benchmarks=[], num_samples=10, verbose=False,
168173
line_format = '{:>3} {:<25} {:>7} {:>7} {:>7} {:>8} {:>6} {:>10} {:>10}'
169174
if verbose and log_directory:
170175
print(line_format.format(*headings))
171-
for test in get_tests(driver):
172-
if benchmarks and test not in benchmarks:
173-
continue
176+
for test in benchmarks:
174177
test_output = instrument_test(driver, test, num_samples)
175178
if test_output[0] == 'Totals':
176179
continue
@@ -219,7 +222,7 @@ def submit(args):
219222
file = os.path.join(args.tests, "Benchmark_" + optset)
220223
try:
221224
res = run_benchmarks(
222-
file, benchmarks=args.benchmark,
225+
file, benchmarks=get_tests(file, args),
223226
num_samples=args.iterations)
224227
data['Tests'].extend(parse_results(res, optset))
225228
except subprocess.CalledProcessError as e:
@@ -243,7 +246,7 @@ def run(args):
243246
optset = args.optimization
244247
file = os.path.join(args.tests, "Benchmark_" + optset)
245248
run_benchmarks(
246-
file, benchmarks=args.benchmarks,
249+
file, benchmarks=get_tests(file, args),
247250
num_samples=args.iterations, verbose=True,
248251
log_directory=args.output_dir,
249252
swift_repo=args.swift_repo)
@@ -346,17 +349,40 @@ def positive_int(value):
346349

347350

348351
def main():
349-
parser = argparse.ArgumentParser(description='Swift benchmarks driver')
350-
subparsers = parser.add_subparsers()
351-
352-
submit_parser = subparsers.add_parser(
353-
'submit',
354-
help='run benchmarks and submit results to LNT')
355-
submit_parser.add_argument(
352+
parser = argparse.ArgumentParser(
353+
epilog='Example: ./Benchmark_Driver run -i 5 -f Array'
354+
)
355+
subparsers = parser.add_subparsers(
356+
title='Swift benchmark driver commands',
357+
help='See COMMAND -h for additional arguments', metavar='<command>')
358+
359+
parent_parser = argparse.ArgumentParser(add_help=False)
360+
benchmarks_group = parent_parser.add_mutually_exclusive_group()
361+
benchmarks_group.add_argument(
362+
'benchmarks',
363+
default=[],
364+
help='benchmark to run (default: all)', nargs='*', metavar="BENCHMARK")
365+
benchmarks_group.add_argument(
366+
'-f', '--filter',
367+
help='run all tests whose name starts with PREFIX', metavar="PREFIX")
368+
parent_parser.add_argument(
356369
'-t', '--tests',
357370
help='directory containing Benchmark_O{,none,unchecked} ' +
358371
'(default: DRIVER_DIR)',
359372
default=DRIVER_DIR)
373+
374+
submit_parser = subparsers.add_parser(
375+
'submit',
376+
help='Run benchmarks and submit results to LNT',
377+
parents=[parent_parser])
378+
submit_parser.add_argument(
379+
'-o', '--optimization', nargs='+',
380+
help='optimization levels to use (default: O Onone Ounchecked)',
381+
default=['O', 'Onone', 'Ounchecked'])
382+
submit_parser.add_argument(
383+
'-i', '--iterations',
384+
help='number of times to run each test (default: 10)',
385+
type=positive_int, default=10)
360386
submit_parser.add_argument(
361387
'-m', '--machine', required=True,
362388
help='LNT machine name')
@@ -366,48 +392,33 @@ def main():
366392
submit_parser.add_argument(
367393
'-l', '--lnt_host', required=True,
368394
help='LNT host to submit results to')
369-
submit_parser.add_argument(
370-
'-i', '--iterations',
371-
help='number of times to run each test (default: 10)',
372-
type=positive_int, default=10)
373-
submit_parser.add_argument(
374-
'-o', '--optimization', nargs='+',
375-
help='optimization levels to use (default: O Onone Ounchecked)',
376-
default=['O', 'Onone', 'Ounchecked'])
377-
submit_parser.add_argument(
378-
'benchmark',
379-
help='benchmark to run (default: all)', nargs='*')
380395
submit_parser.set_defaults(func=submit)
381396

382397
run_parser = subparsers.add_parser(
383398
'run',
384-
help='run benchmarks and output results to stdout')
399+
help='Run benchmarks and output results to stdout',
400+
parents=[parent_parser])
385401
run_parser.add_argument(
386-
'-t', '--tests',
387-
help='directory containing Benchmark_O{,none,unchecked} ' +
388-
'(default: DRIVER_DIR)',
389-
default=DRIVER_DIR)
402+
'-o', '--optimization',
403+
metavar='OPT',
404+
choices=['O', 'Onone', 'Ounchecked'],
405+
help='optimization level to use: {O,Onone,Ounchecked}, (default: O)',
406+
default='O')
390407
run_parser.add_argument(
391408
'-i', '--iterations',
392409
help='number of times to run each test (default: 1)',
393410
type=positive_int, default=1)
394-
run_parser.add_argument(
395-
'-o', '--optimization',
396-
help='optimization level to use (default: O)', default='O')
397411
run_parser.add_argument(
398412
'--output-dir',
399413
help='log results to directory (default: no logging)')
400414
run_parser.add_argument(
401415
'--swift-repo',
402416
help='absolute path to Swift source repo for branch comparison')
403-
run_parser.add_argument(
404-
'benchmarks',
405-
help='benchmark to run (default: all)', nargs='*')
406417
run_parser.set_defaults(func=run)
407418

408419
compare_parser = subparsers.add_parser(
409420
'compare',
410-
help='compare benchmark results')
421+
help='Compare benchmark results')
411422
compare_parser.add_argument(
412423
'--log-dir', required=True,
413424
help='directory containing benchmark logs')

benchmark/scripts/compare_perf_tests.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def main():
150150
new_max_results[row[TESTNAME]] = int(row[MAX])
151151

152152
ratio_total = 0
153-
for key in new_results.keys():
153+
for key in set(new_results.keys()).intersection(old_results.keys()):
154154
ratio = (old_results[key] + 0.001) / (new_results[key] + 0.001)
155155
ratio_list[key] = round(ratio, 2)
156156
ratio_total *= ratio
@@ -168,21 +168,22 @@ def main():
168168
(complete_perf_list,
169169
increased_perf_list,
170170
decreased_perf_list,
171-
normal_perf_list) = sort_ratio_list(ratio_list, args.changes_only)
171+
normal_perf_list) = sort_ratio_list(
172+
ratio_list, delta_list, args.changes_only)
172173

173174
"""
174175
Create markdown formatted table
175176
"""
176177
test_name_width = max_width(ratio_list, title='TEST', key_len=True)
177178
new_time_width = max_width(new_results, title=new_branch)
178179
old_time_width = max_width(old_results, title=old_branch)
179-
delta_width = max_width(delta_list, title='DELTA (%)')
180+
delta_width = max_width(delta_list, title='DELTA')
180181

181182
markdown_table_header = "\n" + MARKDOWN_ROW.format(
182183
"TEST".ljust(test_name_width),
183184
old_branch.ljust(old_time_width),
184185
new_branch.ljust(new_time_width),
185-
"DELTA (%)".ljust(delta_width),
186+
"DELTA".ljust(delta_width),
186187
"SPEEDUP".ljust(2))
187188
markdown_table_header += MARKDOWN_ROW.format(
188189
HEADER_SPLIT.ljust(test_name_width),
@@ -276,7 +277,7 @@ def convert_to_html(ratio_list, old_results, new_results, delta_list,
276277
(complete_perf_list,
277278
increased_perf_list,
278279
decreased_perf_list,
279-
normal_perf_list) = sort_ratio_list(ratio_list, changes_only)
280+
normal_perf_list) = sort_ratio_list(ratio_list, delta_list, changes_only)
280281

281282
html_rows = ""
282283
for key in complete_perf_list:
@@ -307,7 +308,7 @@ def convert_to_html(ratio_list, old_results, new_results, delta_list,
307308
unknown_list[key]))
308309

309310
html_table = HTML_TABLE.format("TEST", old_branch, new_branch,
310-
"DELTA (%)", "SPEEDUP", html_rows)
311+
"DELTA", "SPEEDUP", html_rows)
311312
html_data = HTML.format(html_table)
312313
return html_data
313314

@@ -321,7 +322,7 @@ def write_to_file(file_name, data):
321322
file.close
322323

323324

324-
def sort_ratio_list(ratio_list, changes_only=False):
325+
def sort_ratio_list(ratio_list, delta_list, changes_only=False):
325326
"""
326327
Return 3 sorted list improvement, regression and normal.
327328
"""
@@ -330,7 +331,7 @@ def sort_ratio_list(ratio_list, changes_only=False):
330331
sorted_normal_perf_list = []
331332
normal_perf_list = {}
332333

333-
for key, v in sorted(ratio_list.items(), key=lambda x: x[1]):
334+
for key, v in sorted(delta_list.items(), key=lambda x: x[1], reverse=True):
334335
if ratio_list[key] < RATIO_MIN:
335336
decreased_perf_list.append(key)
336337
elif ratio_list[key] > RATIO_MAX:
@@ -348,6 +349,7 @@ def sort_ratio_list(ratio_list, changes_only=False):
348349
complete_perf_list = (decreased_perf_list + increased_perf_list +
349350
sorted_normal_perf_list)
350351

352+
increased_perf_list.reverse()
351353
return (complete_perf_list, increased_perf_list,
352354
decreased_perf_list, sorted_normal_perf_list)
353355

benchmark/single-source/StringEdits.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ var editWords: [String] = [
2323
"gastroperiodynia",
2424
]
2525

26-
// FIXME: remove when String is a Collection
27-
extension String: RangeReplaceableCollection { }
28-
2926
let alphabet = "abcdefghijklmnopqrstuvwxyz"
3027
/// All edits that are one edit away from `word`
3128
func edits(_ word: String) -> Set<String> {

benchmark/single-source/StringMatch.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ import Glibc
1717
import Darwin
1818
#endif
1919

20-
// FIXME: remove when String is a Collection
21-
extension String: Collection { }
22-
2320
/* match: search for regexp anywhere in text */
2421
func match(regexp: String, text: String) -> Bool {
2522
if regexp.first == "^" {

cmake/modules/AddSwift.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,11 @@ function(add_swift_library name)
14361436
endif()
14371437

14381438
foreach(sdk ${SWIFTLIB_TARGET_SDKS})
1439+
if(NOT SWIFT_SDK_${sdk}_ARCHITECTURES)
1440+
# SWIFT_SDK_${sdk}_ARCHITECTURES is empty, so just continue
1441+
continue()
1442+
endif()
1443+
14391444
set(THIN_INPUT_TARGETS)
14401445

14411446
# For each architecture supported by this SDK
@@ -1639,6 +1644,7 @@ function(add_swift_library name)
16391644
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND SWIFTLIB_SHARED)
16401645
set(codesign_arg CODESIGN)
16411646
endif()
1647+
precondition(THIN_INPUT_TARGETS)
16421648
_add_swift_lipo_target(
16431649
SDK ${sdk}
16441650
TARGET ${lipo_target}

docs/ContinuousIntegration.md

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ swift-ci pull request testing is triggered by writing a comment on this PR addre
2929
2. Validation Testing
3030
3. Benchmarking.
3131
4. Lint Testing
32-
5. Specific Preset Testing
32+
5. Source Compatibility Testing
33+
6. Specific Preset Testing
3334

3435
We describe each in detail below:
3536

3637
### Smoke Testing
3738

38-
Platform | Comment | Check Status
39-
------------ | ------- | ------------
40-
All supported platforms | @swift-ci Please smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
41-
All supported platforms | @swift-ci Please clean smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
42-
All supported platforms | @swift-ci Please smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
43-
All supported platforms | @swift-ci Please clean smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
44-
OS X platform | @swift-ci Please smoke test OS X platform | Swift Test OS X Platform (smoke test)
45-
OS X platform | @swift-ci Please clean smoke test OS X platform | Swift Test OS X Platform (smoke test)
46-
Linux platform | @swift-ci Please smoke test Linux platform | Swift Test Linux Platform (smoke test)
47-
Linux platform | @swift-ci Please clean smoke test Linux platform | Swift Test Linux Platform (smoke test)
39+
Platform | Comment | Check Status
40+
------------ | ------- | ------------
41+
All supported platforms | @swift-ci Please smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
42+
All supported platforms | @swift-ci Please clean smoke test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
43+
All supported platforms | @swift-ci Please smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
44+
All supported platforms | @swift-ci Please clean smoke test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)
45+
macOS platform | @swift-ci Please smoke test OS X platform | Swift Test OS X Platform (smoke test)
46+
macOS platform | @swift-ci Please clean smoke test OS X platform | Swift Test OS X Platform (smoke test)
47+
Linux platform | @swift-ci Please smoke test Linux platform | Swift Test Linux Platform (smoke test)
48+
Linux platform | @swift-ci Please clean smoke test Linux platform | Swift Test Linux Platform (smoke test)
4849

4950
A smoke test on macOS does the following:
5051

@@ -70,18 +71,18 @@ A smoke test on Linux does the following:
7071

7172
### Validation Testing
7273

73-
Platform | Comment | Check Status
74-
------------ | ------- | ------------
75-
All supported platforms | @swift-ci Please test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
76-
All supported platforms | @swift-ci Please clean test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
77-
All supported platforms | @swift-ci Please test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
78-
All supported platforms | @swift-ci Please clean test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
79-
OS X platform | @swift-ci Please test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
80-
OS X platform | @swift-ci Please clean test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
81-
OS X platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform
82-
Linux platform | @swift-ci Please test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
83-
Linux platform | @swift-ci Please clean test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
84-
OS X platform | @swift-ci Please ASAN test | Swift ASAN Test OS X Platform
74+
Platform | Comment | Check Status
75+
------------ | ------- | ------------
76+
All supported platforms | @swift-ci Please test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
77+
All supported platforms | @swift-ci Please clean test | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br>Swift Test Linux Platform<br>Swift Test OS X Platform<br>
78+
All supported platforms | @swift-ci Please test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
79+
All supported platforms | @swift-ci Please clean test and merge | Swift Test Linux Platform (smoke test)<br>Swift Test OS X Platform (smoke test)<br> Swift Test Linux Platform <br>Swift Test OS X Platform
80+
macOS platform | @swift-ci Please test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
81+
macOS platform | @swift-ci Please clean test OS X platform | Swift Test OS X Platform (smoke test)<br>Swift Test OS X Platform
82+
macOS platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform
83+
Linux platform | @swift-ci Please test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
84+
Linux platform | @swift-ci Please clean test Linux platform | Swift Test Linux Platform (smoke test)<br>Swift Test Linux Platform
85+
macOS platform | @swift-ci Please ASAN test | Swift ASAN Test OS X Platform
8586

8687
The core principles of validation testing is that:
8788

@@ -114,21 +115,28 @@ A validation test on Linux does the following:
114115

115116
### Benchmarking
116117

117-
Platform | Comment | Check Status
118-
------------ | ------- | ------------
119-
OS X platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform
118+
Platform | Comment | Check Status
119+
------------ | ------- | ------------
120+
macOS platform | @swift-ci Please benchmark | Swift Benchmark on OS X Platform
120121

121122
### Lint Testing
122123

123-
Language | Comment | Check Status
124-
------------ | ------- | ------------
125-
Python | @swift-ci Please Python lint | Python lint
124+
Language | Comment | Check Status
125+
------------ | ------- | ------------
126+
Python | @swift-ci Please Python lint | Python lint
127+
128+
### Source Compatibility Testing
129+
130+
Platform | Comment | Check Status
131+
------------ | ------- | ------------
132+
macOS platform | @swift-ci Please Test Source Compatibility | Swift Source Compatibility Suite on macOS Platform
126133

127134
### Specific Preset Testing
128135

129-
Platform | Comment | Check Status
130-
------------ | ------- | ------------
131-
OS X platform | preset=<preset> <br> @swift-ci Please test macOS with preset | Swift Test macOS Platform with preset
136+
Platform | Comment | Check Status
137+
------------ | ------- | ------------
138+
macOS platform | preset=<preset> <br> @swift-ci Please test macOS with preset | Swift Test macOS Platform with preset
139+
132140

133141
For example:
134142

0 commit comments

Comments
 (0)