blob: 42123c98500f073eca028697df55a89a8cf2ac62 [file] [log] [blame]
borenet1ed2ae42016-07-26 11:52:17 -07001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6# Recipe module for Skia Swarming perf.
7
8
9DEPS = [
borenetbc20a702016-08-03 10:38:44 -070010 'build/file',
borenet1436a092016-08-03 08:23:10 -070011 'core',
borenet1ed2ae42016-07-26 11:52:17 -070012 'recipe_engine/json',
13 'recipe_engine/path',
14 'recipe_engine/platform',
15 'recipe_engine/properties',
16 'recipe_engine/raw_io',
borenet8b5ec392016-09-26 10:25:32 -070017 'recipe_engine/time',
borenet1436a092016-08-03 08:23:10 -070018 'run',
borenetbc20a702016-08-03 10:38:44 -070019 'flavor',
20 'vars',
borenet1ed2ae42016-07-26 11:52:17 -070021]
22
23
24TEST_BUILDERS = {
25 'client.skia': {
26 'skiabot-linux-swarm-000': [
mtklein122fac32016-09-19 07:26:41 -070027 ('Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug' +
28 '-GN_Android_Vulkan'),
29 'Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-GN_Android',
30 'Perf-Android-Clang-Nexus6-GPU-Adreno420-arm-Release-GN_Android',
31 'Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-GN_Android',
32 'Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-GN_Android',
Ben Wagner25509582016-11-04 11:31:05 -040033 'Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-GN_Android',
borenet2c3112d2016-08-05 06:30:10 -070034 'Perf-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Release-GN',
mtklein90939aa2016-09-22 06:50:24 -070035 'Perf-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer',
mtklein2b3c2a32016-09-08 08:39:34 -070036 'Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-GN',
borenete2251ac2016-08-05 05:40:59 -070037 'Perf-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
Brian Salomonf61abec2016-10-14 15:41:54 -040038 'Perf-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-ANGLE',
borenetf5b675e2016-08-01 05:08:52 -070039 'Perf-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug',
mtklein2b3c2a32016-09-08 08:39:34 -070040 'Perf-Win-MSVC-GCE-CPU-AVX2-x86_64-Release',
borenet1ed2ae42016-07-26 11:52:17 -070041 'Perf-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Release-Trybot',
bsalomon11abd8d2016-10-14 08:13:48 -070042 'Perf-Win8-MSVC-ShuttleB-GPU-GTX960-x86_64-Debug-ANGLE',
mtklein2b3c2a32016-09-08 08:39:34 -070043 'Perf-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug',
borenet1ed2ae42016-07-26 11:52:17 -070044 ],
45 },
46}
47
48
borenet2dbbfa52016-10-14 06:32:09 -070049import calendar
borenet8b5ec392016-09-26 10:25:32 -070050
51
borenete2251ac2016-08-05 05:40:59 -070052def nanobench_flags(bot):
53 args = ['--pre_log']
54
55 if 'GPU' in bot:
56 args.append('--images')
57 args.extend(['--gpuStatsDump', 'true'])
58
59 if 'Android' in bot and 'GPU' in bot:
60 args.extend(['--useThermalManager', '1,1,10,1000'])
61
62 args.extend(['--scales', '1.0', '1.1'])
63
64 if 'iOS' in bot:
borenet2c3112d2016-08-05 06:30:10 -070065 args.extend(['--skps', 'ignore_skps'])
borenete2251ac2016-08-05 05:40:59 -070066
bsalomon11abd8d2016-10-14 08:13:48 -070067 config = ['8888', 'gpu', 'nonrendering', 'hwui' ]
mtkleindf5df812016-09-12 12:24:38 -070068 if 'AndroidOne' not in bot:
69 config += [ 'f16', 'srgb' ]
mtklein896ddb72016-09-14 10:33:12 -070070 if '-GCE-' in bot:
71 config += [ '565' ]
Ben Wagner52245152016-11-02 13:11:05 -040072 # The NP produces a long error stream when we run with MSAA.
73 if 'NexusPlayer' not in bot:
borenete2251ac2016-08-05 05:40:59 -070074 if 'Android' in bot:
Ben Wagner25509582016-11-04 11:31:05 -040075 # The NVIDIA_Shield has a regular OpenGL implementation. We bench that
76 # instead of ES.
77 if 'NVIDIA_Shield' in bot:
borenete2251ac2016-08-05 05:40:59 -070078 config.remove('gpu')
79 config.extend(['gl', 'glmsaa4', 'glnvpr4', 'glnvprdit4'])
80 else:
81 config.extend(['msaa4', 'nvpr4', 'nvprdit4'])
82 else:
83 config.extend(['msaa16', 'nvpr16', 'nvprdit16'])
84
85 # Bench instanced rendering on a limited number of platforms
borenet2c3112d2016-08-05 06:30:10 -070086 if 'Nexus6' in bot:
borenete2251ac2016-08-05 05:40:59 -070087 config.append('esinst') # esinst4 isn't working yet on Adreno.
Ben Wagner25509582016-11-04 11:31:05 -040088 elif 'PixelC' in bot:
89 config.extend(['esinst', 'esinst4'])
90 elif 'NVIDIA_Shield' in bot:
borenet2c3112d2016-08-05 06:30:10 -070091 config.extend(['glinst', 'glinst4'])
borenete2251ac2016-08-05 05:40:59 -070092 elif 'MacMini6.2' in bot:
borenet2c3112d2016-08-05 06:30:10 -070093 config.extend(['glinst', 'glinst16'])
borenete2251ac2016-08-05 05:40:59 -070094
mtklein90939aa2016-09-22 06:50:24 -070095 if 'CommandBuffer' in bot:
96 config = ['commandbuffer']
borenete2251ac2016-08-05 05:40:59 -070097 if 'Vulkan' in bot:
borenet2c3112d2016-08-05 06:30:10 -070098 config = ['vk']
borenete2251ac2016-08-05 05:40:59 -070099
bsalomon11abd8d2016-10-14 08:13:48 -0700100 if 'ANGLE' in bot:
Brian Salomonf61abec2016-10-14 15:41:54 -0400101 config.extend(['angle_d3d11_es2'])
102 # The GL backend of ANGLE crashes on the perf bot currently.
103 if 'Win' not in bot:
104 config.extend(['angle_gl_es2'])
bsalomon11abd8d2016-10-14 08:13:48 -0700105
borenete2251ac2016-08-05 05:40:59 -0700106 args.append('--config')
107 args.extend(config)
108
109 if 'Valgrind' in bot:
110 # Don't care about Valgrind performance.
111 args.extend(['--loops', '1'])
112 args.extend(['--samples', '1'])
113 # Ensure that the bot framework does not think we have timed out.
114 args.extend(['--keepAlive', 'true'])
115
116 match = []
117 if 'Android' in bot:
118 # Segfaults when run as GPU bench. Very large texture?
119 match.append('~blurroundrect')
120 match.append('~patch_grid') # skia:2847
121 match.append('~desk_carsvg')
122 if 'NexusPlayer' in bot:
borenet2c3112d2016-08-05 06:30:10 -0700123 match.append('~desk_unicodetable')
124 if 'Nexus5' in bot:
borenete2251ac2016-08-05 05:40:59 -0700125 match.append('~keymobi_shop_mobileweb_ebay_com.skp') # skia:5178
borenet2c3112d2016-08-05 06:30:10 -0700126 if 'iOS' in bot:
borenete2251ac2016-08-05 05:40:59 -0700127 match.append('~blurroundrect')
128 match.append('~patch_grid') # skia:2847
129 match.append('~desk_carsvg')
130 match.append('~keymobi')
131 match.append('~path_hairline')
132 match.append('~GLInstancedArraysBench') # skia:4714
133
borenete2251ac2016-08-05 05:40:59 -0700134 # We do not need or want to benchmark the decodes of incomplete images.
135 # In fact, in nanobench we assert that the full image decode succeeds.
136 match.append('~inc0.gif')
137 match.append('~inc1.gif')
138 match.append('~incInterlaced.gif')
139 match.append('~inc0.jpg')
140 match.append('~incGray.jpg')
141 match.append('~inc0.wbmp')
142 match.append('~inc1.wbmp')
143 match.append('~inc0.webp')
144 match.append('~inc1.webp')
145 match.append('~inc0.ico')
146 match.append('~inc1.ico')
147 match.append('~inc0.png')
148 match.append('~inc1.png')
149 match.append('~inc2.png')
150 match.append('~inc12.png')
151 match.append('~inc13.png')
152 match.append('~inc14.png')
153 match.append('~inc0.webp')
154 match.append('~inc1.webp')
155
156 if match:
157 args.append('--match')
158 args.extend(match)
159
160 return args
161
162
borenetbc20a702016-08-03 10:38:44 -0700163def perf_steps(api):
164 """Run Skia benchmarks."""
165 if api.vars.upload_perf_results:
166 api.flavor.create_clean_device_dir(
167 api.flavor.device_dirs.perf_data_dir)
168
169 # Run nanobench.
170 properties = [
171 '--properties',
172 'gitHash', api.vars.got_revision,
173 'build_number', api.vars.build_number,
174 ]
175 if api.vars.is_trybot:
176 properties.extend([
177 'issue', api.vars.issue,
178 'patchset', api.vars.patchset,
rmistry3f1c9c02016-08-24 05:07:06 -0700179 'patch_storage', api.vars.patch_storage,
borenetbc20a702016-08-03 10:38:44 -0700180 ])
borenetbfa5b452016-10-19 10:13:32 -0700181 if api.vars.no_buildbot:
182 properties.extend(['no_buildbot', 'True'])
183 properties.extend(['swarming_bot_id', api.vars.swarming_bot_id])
184 properties.extend(['swarming_task_id', api.vars.swarming_task_id])
borenetbc20a702016-08-03 10:38:44 -0700185
186 target = 'nanobench'
borenetbc20a702016-08-03 10:38:44 -0700187 args = [
188 target,
189 '--undefok', # This helps branches that may not know new flags.
190 '-i', api.flavor.device_dirs.resource_dir,
191 '--skps', api.flavor.device_dirs.skp_dir,
192 '--images', api.flavor.device_path_join(
193 api.flavor.device_dirs.images_dir, 'nanobench'),
194 ]
195
stephana7fbacbb2016-10-07 06:36:16 -0700196 # Do not run svgs on Valgrind.
197 if 'Valgrind' not in api.vars.builder_name:
198 args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
199
borenetbc20a702016-08-03 10:38:44 -0700200 skip_flag = None
201 if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU':
202 skip_flag = '--nogpu'
203 elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU':
204 skip_flag = '--nocpu'
205 if skip_flag:
206 args.append(skip_flag)
borenete2251ac2016-08-05 05:40:59 -0700207 args.extend(nanobench_flags(api.vars.builder_name))
borenetbc20a702016-08-03 10:38:44 -0700208
209 if api.vars.upload_perf_results:
borenet8b5ec392016-09-26 10:25:32 -0700210 now = api.time.utcnow()
borenet2dbbfa52016-10-14 06:32:09 -0700211 ts = int(calendar.timegm(now.utctimetuple()))
borenetbc20a702016-08-03 10:38:44 -0700212 json_path = api.flavor.device_path_join(
213 api.flavor.device_dirs.perf_data_dir,
borenet8b5ec392016-09-26 10:25:32 -0700214 'nanobench_%s_%d.json' % (api.vars.got_revision, ts))
borenetbc20a702016-08-03 10:38:44 -0700215 args.extend(['--outResultsFile', json_path])
216 args.extend(properties)
217
218 keys_blacklist = ['configuration', 'role', 'is_trybot']
219 args.append('--key')
220 for k in sorted(api.vars.builder_cfg.keys()):
221 if not k in keys_blacklist:
222 args.extend([k, api.vars.builder_cfg[k]])
223
224 api.run(api.flavor.step, target, cmd=args,
borenetd460a3c2016-08-05 05:18:05 -0700225 abort_on_failure=False,
226 env=api.vars.default_env)
borenetbc20a702016-08-03 10:38:44 -0700227
228 # See skia:2789.
229 if ('Valgrind' in api.vars.builder_name and
230 api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU'):
231 abandonGpuContext = list(args)
232 abandonGpuContext.extend(['--abandonGpuContext', '--nocpu'])
233 api.run(api.flavor.step,
borenetd460a3c2016-08-05 05:18:05 -0700234 '%s --abandonGpuContext' % target,
235 cmd=abandonGpuContext, abort_on_failure=False,
236 env=api.vars.default_env)
borenetbc20a702016-08-03 10:38:44 -0700237
238 # Copy results to swarming out dir.
239 if api.vars.upload_perf_results:
240 api.file.makedirs('perf_dir', api.vars.perf_data_dir)
241 api.flavor.copy_directory_contents_to_host(
242 api.flavor.device_dirs.perf_data_dir,
243 api.vars.perf_data_dir)
244
245
borenet1ed2ae42016-07-26 11:52:17 -0700246def RunSteps(api):
borenet1436a092016-08-03 08:23:10 -0700247 api.core.setup()
mtkleindf5df812016-09-12 12:24:38 -0700248 try:
Kevin Lubickb03b5ac2016-11-14 13:42:27 -0500249 api.flavor.install_everything()
mtkleindf5df812016-09-12 12:24:38 -0700250 perf_steps(api)
251 finally:
252 api.flavor.cleanup_steps()
borenet1436a092016-08-03 08:23:10 -0700253 api.run.check_failure()
borenet1ed2ae42016-07-26 11:52:17 -0700254
255
256def GenTests(api):
borenet1ed2ae42016-07-26 11:52:17 -0700257 for mastername, slaves in TEST_BUILDERS.iteritems():
258 for slavename, builders_by_slave in slaves.iteritems():
259 for builder in builders_by_slave:
260 test = (
261 api.test(builder) +
262 api.properties(buildername=builder,
263 mastername=mastername,
264 slavename=slavename,
265 buildnumber=5,
266 revision='abc123',
267 path_config='kitchen',
268 swarm_out_dir='[SWARM_OUT_DIR]') +
269 api.path.exists(
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500270 api.path['start_dir'].join('skia'),
271 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenet1ed2ae42016-07-26 11:52:17 -0700272 'skimage', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500273 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenet1ed2ae42016-07-26 11:52:17 -0700274 'skp', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500275 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
borenet1ed2ae42016-07-26 11:52:17 -0700276 )
277 )
borenet1ed2ae42016-07-26 11:52:17 -0700278 if 'Trybot' in builder:
279 test += api.properties(issue=500,
280 patchset=1,
281 rietveld='https://codereview.chromium.org')
282 if 'Win' in builder:
283 test += api.platform('win', 64)
284
285 yield test
286
287 builder = 'Perf-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Release-Trybot'
288 yield (
289 api.test('big_issue_number') +
290 api.properties(buildername=builder,
291 mastername='client.skia.compile',
292 slavename='skiabot-linux-swarm-000',
293 buildnumber=5,
294 revision='abc123',
295 path_config='kitchen',
296 swarm_out_dir='[SWARM_OUT_DIR]',
297 rietveld='https://codereview.chromium.org',
298 patchset=1,
299 issue=2147533002L) +
300 api.path.exists(
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500301 api.path['start_dir'].join('skia'),
302 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenet1ed2ae42016-07-26 11:52:17 -0700303 'skimage', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500304 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenet1ed2ae42016-07-26 11:52:17 -0700305 'skp', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500306 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
rmistrybcba19d2016-08-11 12:36:58 -0700307 'svg', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500308 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
borenet1ed2ae42016-07-26 11:52:17 -0700309 ) +
310 api.platform('win', 64)
311 )
rmistry3f1c9c02016-08-24 05:07:06 -0700312
borenet96b38422016-10-27 06:35:51 -0700313 builder = ('Perf-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind-'
314 'Trybot')
rmistry3f1c9c02016-08-24 05:07:06 -0700315 yield (
316 api.test('recipe_with_gerrit_patch') +
317 api.properties(
borenet96b38422016-10-27 06:35:51 -0700318 buildername=builder,
rmistry3f1c9c02016-08-24 05:07:06 -0700319 mastername='client.skia',
320 slavename='skiabot-linux-swarm-000',
321 buildnumber=5,
322 path_config='kitchen',
323 swarm_out_dir='[SWARM_OUT_DIR]',
324 revision='abc123',
borenet96b38422016-10-27 06:35:51 -0700325 patch_storage='gerrit') +
326 api.properties.tryserver(
327 buildername=builder,
328 gerrit_project='skia',
329 gerrit_url='https://skia-review.googlesource.com/',
330 )
rmistry3f1c9c02016-08-24 05:07:06 -0700331 )
borenetbfa5b452016-10-19 10:13:32 -0700332
borenet96b38422016-10-27 06:35:51 -0700333 builder = 'Perf-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Release-Trybot'
borenetbfa5b452016-10-19 10:13:32 -0700334 yield (
335 api.test('nobuildbot') +
borenet96b38422016-10-27 06:35:51 -0700336 api.properties(
337 buildername=builder,
338 mastername='client.skia',
339 slavename='skiabot-linux-swarm-000',
340 buildnumber=5,
341 revision='abc123',
342 path_config='kitchen',
343 nobuildbot='True',
344 swarm_out_dir='[SWARM_OUT_DIR]',
345 patch_storage='gerrit') +
346 api.properties.tryserver(
347 buildername=builder,
348 gerrit_project='skia',
349 gerrit_url='https://skia-review.googlesource.com/',
350 ) +
borenetbfa5b452016-10-19 10:13:32 -0700351 api.path.exists(
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500352 api.path['start_dir'].join('skia'),
353 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenetbfa5b452016-10-19 10:13:32 -0700354 'skimage', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500355 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenetbfa5b452016-10-19 10:13:32 -0700356 'skp', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500357 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
borenetbfa5b452016-10-19 10:13:32 -0700358 'svg', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500359 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
borenetbfa5b452016-10-19 10:13:32 -0700360 ) +
361 api.platform('win', 64) +
362 api.step_data('get swarming bot id',
363 stdout=api.raw_io.output('skia-bot-123')) +
364 api.step_data('get swarming task id', stdout=api.raw_io.output('123456'))
365 )