blob: b0efc96b6834d65a139e462f0cda4f2d82228020 [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
Eric Boren4c7754c2017-04-10 08:19:10 -04009import calendar
10
11
borenet1ed2ae42016-07-26 11:52:17 -070012DEPS = [
Eric Boren4c7754c2017-04-10 08:19:10 -040013 'build/file',
14 'core',
15 'recipe_engine/json',
borenet1ed2ae42016-07-26 11:52:17 -070016 'recipe_engine/path',
17 'recipe_engine/platform',
18 'recipe_engine/properties',
19 'recipe_engine/raw_io',
Eric Boren4c7754c2017-04-10 08:19:10 -040020 'recipe_engine/step',
21 'recipe_engine/time',
22 'run',
23 'flavor',
24 'vars',
borenet1ed2ae42016-07-26 11:52:17 -070025]
26
27
Eric Boren4c7754c2017-04-10 08:19:10 -040028def nanobench_flags(bot):
29 args = ['--pre_log']
30
31 if 'GPU' in bot:
32 args.append('--images')
33 args.extend(['--gpuStatsDump', 'true'])
34
35 if 'Android' in bot and 'GPU' in bot:
36 args.extend(['--useThermalManager', '1,1,10,1000'])
37
38 args.extend(['--scales', '1.0', '1.1'])
39
40 if 'iOS' in bot:
41 args.extend(['--skps', 'ignore_skps'])
42
43 configs = ['8888', 'nonrendering', 'hwui' ]
44
45 if '-arm-' not in bot:
46 # For Android CPU tests, these take too long and cause the task to time out.
47 configs += [ 'f16', 'srgb' ]
48 if '-GCE-' in bot:
49 configs += [ '565' ]
50
51 gl_prefix = 'gl'
52 sample_count = '8'
53 if 'Android' in bot or 'iOS' in bot:
54 sample_count = '4'
55 # The NVIDIA_Shield has a regular OpenGL implementation. We bench that
56 # instead of ES.
57 if 'NVIDIA_Shield' not in bot:
58 gl_prefix = 'gles'
59 # The NP produces a long error stream when we run with MSAA.
60 # iOS crashes (skia:6399)
61 if 'NexusPlayer' in bot or 'iOS' in bot:
62 sample_count = ''
63 elif 'Intel' in bot:
64 sample_count = ''
65 elif 'ChromeOS' in bot:
66 gl_prefix = 'gles'
67
68 configs.append(gl_prefix)
69 if sample_count is not '':
70 configs.extend([gl_prefix + 'msaa' + sample_count,
71 gl_prefix + 'nvpr' + sample_count,
72 gl_prefix + 'nvprdit' + sample_count])
73
74 # We want to test both the OpenGL config and the GLES config on Linux Intel:
75 # GL is used by Chrome, GLES is used by ChromeOS.
76 if 'Intel' in bot and 'Ubuntu' in bot:
77 configs.append('gles')
78
79 # Bench instanced rendering on a limited number of platforms
80 inst_config = gl_prefix + 'inst'
Kevin Lubickfe079d42017-04-12 08:31:48 -040081 if 'PixelC' in bot or 'NVIDIA_Shield' in bot or 'MacMini6.2' in bot:
Eric Boren4c7754c2017-04-10 08:19:10 -040082 configs.extend([inst_config, inst_config + sample_count])
83
84 if 'CommandBuffer' in bot:
85 configs = ['commandbuffer']
86 if 'Vulkan' in bot:
87 configs = ['vk']
88
89 if 'ANGLE' in bot:
90 # Test only ANGLE configs.
91 configs = ['angle_d3d11_es2']
92 if sample_count is not '':
93 configs.append('angle_d3d11_es2_msaa' + sample_count)
94
95 if 'ChromeOS' in bot:
96 # Just run GLES for now - maybe add gles_msaa4 in the future
97 configs = ['gles']
98
99 args.append('--config')
100 args.extend(configs)
101
102 if 'Valgrind' in bot:
103 # Don't care about Valgrind performance.
104 args.extend(['--loops', '1'])
105 args.extend(['--samples', '1'])
106 # Ensure that the bot framework does not think we have timed out.
107 args.extend(['--keepAlive', 'true'])
108
109 match = []
110 if 'Android' in bot:
111 # Segfaults when run as GPU bench. Very large texture?
112 match.append('~blurroundrect')
113 match.append('~patch_grid') # skia:2847
114 match.append('~desk_carsvg')
115 if 'NexusPlayer' in bot:
116 match.append('~desk_unicodetable')
117 if 'Nexus5' in bot:
118 match.append('~keymobi_shop_mobileweb_ebay_com.skp') # skia:5178
119 if 'iOS' in bot:
120 match.append('~blurroundrect')
121 match.append('~patch_grid') # skia:2847
122 match.append('~desk_carsvg')
123 match.append('~keymobi')
124 match.append('~path_hairline')
125 match.append('~GLInstancedArraysBench') # skia:4714
126 if 'IntelIris540' in bot and 'ANGLE' in bot:
127 match.append('~tile_image_filter_tiled_64') # skia:6082
128 if 'Intel' in bot and 'Ubuntu' in bot and not 'Vulkan' in bot:
129 match.append('~native_image_to_raster_surface') # skia:6401
130 if 'Vulkan' in bot and 'IntelIris540' in bot and 'Win' in bot:
131 # skia:6398
132 match.append('~GM_varied_text_clipped_lcd')
133 match.append('~GM_varied_text_ignorable_clip_lcd')
134 match.append('~Xfermode_DstATop_aa')
135 match.append('~Xfermode_SrcIn_aa')
136 match.append('~Xfermode_SrcOut_aa')
137 match.append('~Xfermode_Src_aa')
138 match.append('~fontscaler_lcd')
139 match.append('~rotated_rects_aa_alternating_transparent_and_opaque_src')
140 match.append('~rotated_rects_aa_changing_transparent_src')
141 match.append('~rotated_rects_aa_same_transparent_src')
142 match.append('~shadermask_LCD_FF')
143 match.append('~srcmode_rects_1')
144 match.append('~text_16_LCD_88')
145 match.append('~text_16_LCD_BK')
146 match.append('~text_16_LCD_FF')
147 match.append('~text_16_LCD_WT')
148 if 'Vulkan' in bot and 'NexusPlayer' in bot:
149 match.append('~hardstop') # skia:6037
150 if 'ANGLE' in bot and any('msaa' in x for x in configs):
151 match.append('~native_image_to_raster_surface') # skia:6457
152
153 # We do not need or want to benchmark the decodes of incomplete images.
154 # In fact, in nanobench we assert that the full image decode succeeds.
155 match.append('~inc0.gif')
156 match.append('~inc1.gif')
157 match.append('~incInterlaced.gif')
158 match.append('~inc0.jpg')
159 match.append('~incGray.jpg')
160 match.append('~inc0.wbmp')
161 match.append('~inc1.wbmp')
162 match.append('~inc0.webp')
163 match.append('~inc1.webp')
164 match.append('~inc0.ico')
165 match.append('~inc1.ico')
166 match.append('~inc0.png')
167 match.append('~inc1.png')
168 match.append('~inc2.png')
169 match.append('~inc12.png')
170 match.append('~inc13.png')
171 match.append('~inc14.png')
172 match.append('~inc0.webp')
173 match.append('~inc1.webp')
174
175 if match:
176 args.append('--match')
177 args.extend(match)
178
179 return args
180
181
182def perf_steps(api):
183 """Run Skia benchmarks."""
184 if api.vars.upload_perf_results:
185 api.flavor.create_clean_device_dir(
186 api.flavor.device_dirs.perf_data_dir)
187
188 # Run nanobench.
189 properties = [
190 '--properties',
191 'gitHash', api.vars.got_revision,
Eric Boren4c7754c2017-04-10 08:19:10 -0400192 ]
193 if api.vars.is_trybot:
194 properties.extend([
195 'issue', api.vars.issue,
196 'patchset', api.vars.patchset,
197 'patch_storage', api.vars.patch_storage,
198 ])
Eric Borenf9aa9e52017-04-10 09:56:10 -0400199 properties.extend(['swarming_bot_id', api.vars.swarming_bot_id])
200 properties.extend(['swarming_task_id', api.vars.swarming_task_id])
Eric Boren4c7754c2017-04-10 08:19:10 -0400201
202 target = 'nanobench'
203 args = [
204 target,
205 '--undefok', # This helps branches that may not know new flags.
206 '-i', api.flavor.device_dirs.resource_dir,
207 '--skps', api.flavor.device_dirs.skp_dir,
208 '--images', api.flavor.device_path_join(
209 api.flavor.device_dirs.images_dir, 'nanobench'),
210 ]
211
212 # Do not run svgs on Valgrind.
213 if 'Valgrind' not in api.vars.builder_name:
214 if ('Vulkan' not in api.vars.builder_name or
215 'NexusPlayer' not in api.vars.builder_name):
216 args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
217
218 skip_flag = None
219 if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU':
220 skip_flag = '--nogpu'
221 elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU':
222 skip_flag = '--nocpu'
223 if skip_flag:
224 args.append(skip_flag)
225 args.extend(nanobench_flags(api.vars.builder_name))
226
227 if 'Chromecast' in api.vars.builder_cfg.get('os', ''):
228 # Due to limited disk space, run a watered down perf run on Chromecast.
229 args = [
230 target,
231 '-i', api.flavor.device_dirs.resource_dir,
232 '--images', api.flavor.device_path_join(
233 api.flavor.device_dirs.resource_dir, 'color_wheel.jpg'),
234 '--svgs', api.flavor.device_dirs.svg_dir,
235 ]
236
237 if api.vars.upload_perf_results:
238 now = api.time.utcnow()
239 ts = int(calendar.timegm(now.utctimetuple()))
240 json_path = api.flavor.device_path_join(
241 api.flavor.device_dirs.perf_data_dir,
242 'nanobench_%s_%d.json' % (api.vars.got_revision, ts))
243 args.extend(['--outResultsFile', json_path])
244 args.extend(properties)
245
246 keys_blacklist = ['configuration', 'role', 'is_trybot']
247 args.append('--key')
248 for k in sorted(api.vars.builder_cfg.keys()):
249 if not k in keys_blacklist:
250 args.extend([k, api.vars.builder_cfg[k]])
251
252 env = api.step.get_from_context('env', {})
253 if 'Ubuntu16' in api.vars.builder_name:
254 # The vulkan in this asset name simply means that the graphics driver
255 # supports Vulkan. It is also the driver used for GL code.
256 dri_path = api.vars.slave_dir.join('linux_vulkan_intel_driver_release')
257 if 'Debug' in api.vars.builder_name:
258 dri_path = api.vars.slave_dir.join('linux_vulkan_intel_driver_debug')
259
260 if 'Vulkan' in api.vars.builder_name:
261 sdk_path = api.vars.slave_dir.join('linux_vulkan_sdk', 'bin')
262 lib_path = api.vars.slave_dir.join('linux_vulkan_sdk', 'lib')
263 env.update({
264 'PATH':'%%(PATH)s:%s' % sdk_path,
265 'LD_LIBRARY_PATH': '%s:%s' % (lib_path, dri_path),
266 'LIBGL_DRIVERS_PATH': dri_path,
267 'VK_ICD_FILENAMES':'%s' % dri_path.join('intel_icd.x86_64.json'),
268 })
269 else:
270 # Even the non-vulkan NUC jobs could benefit from the newer drivers.
271 env.update({
272 'LD_LIBRARY_PATH': dri_path,
273 'LIBGL_DRIVERS_PATH': dri_path,
274 })
275
276 # See skia:2789.
277 if '_AbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''):
278 args.extend(['--abandonGpuContext', '--nocpu'])
279
280 with api.step.context({'env': env}):
281 api.run(api.flavor.step, target, cmd=args,
282 abort_on_failure=False)
283
284 # Copy results to swarming out dir.
285 if api.vars.upload_perf_results:
286 api.file.makedirs('perf_dir', api.vars.perf_data_dir)
287 api.flavor.copy_directory_contents_to_host(
288 api.flavor.device_dirs.perf_data_dir,
289 api.vars.perf_data_dir)
290
291
borenet1ed2ae42016-07-26 11:52:17 -0700292def RunSteps(api):
Eric Boren4c7754c2017-04-10 08:19:10 -0400293 api.core.setup()
294 env = api.step.get_from_context('env', {})
295 if 'iOS' in api.vars.builder_name:
296 env['IOS_BUNDLE_ID'] = 'com.google.nanobench'
297 with api.step.context({'env': env}):
298 try:
299 if 'Chromecast' in api.vars.builder_name:
300 api.flavor.install(resources=True, skps=True)
301 else:
302 api.flavor.install_everything()
303 perf_steps(api)
304 finally:
305 api.flavor.cleanup_steps()
306 api.run.check_failure()
307
308
Eric Borenf9aa9e52017-04-10 09:56:10 -0400309TEST_BUILDERS = [
Kevin Lubickfe079d42017-04-12 08:31:48 -0400310 'Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-Android_Vulkan',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400311 'Perf-Android-Clang-Nexus10-CPU-Exynos5250-arm-Release-Android',
Kevin Lubickfe079d42017-04-12 08:31:48 -0400312 'Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-Android',
313 'Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-Android',
314 'Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-Android',
315 'Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-Android_Vulkan',
316 'Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-Android',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400317 'Perf-ChromeOS-Clang-Chromebook_C100p-GPU-MaliT764-arm-Release',
318 'Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Debug',
319 'Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release',
Kevin Lubickfe079d42017-04-12 08:31:48 -0400320 'Perf-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Release',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400321 'Perf-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer',
Kevin Lubickfe079d42017-04-12 08:31:48 -0400322 'Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400323 'Perf-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
324 ('Perf-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind' +
325 '_AbandonGpuContext'),
Kevin Lubickfe079d42017-04-12 08:31:48 -0400326 'Perf-Ubuntu16-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-Vulkan',
327 'Perf-Ubuntu16-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Release',
328 'Perf-Win10-MSVC-NUC6i5SYK-GPU-IntelIris540-x86_64-Release-ANGLE',
329 'Perf-Win10-MSVC-NUC6i5SYK-GPU-IntelIris540-x86_64-Release-Vulkan',
330 'Perf-Win10-MSVC-ShuttleC-GPU-GTX960-x86_64-Debug-ANGLE',
331 'Perf-Win2k8-MSVC-GCE-CPU-AVX2-x86_64-Debug',
332 'Perf-Win2k8-MSVC-GCE-CPU-AVX2-x86_64-Release',
Eric Borenf9aa9e52017-04-10 09:56:10 -0400333 'Perf-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release'
334]
borenet1ed2ae42016-07-26 11:52:17 -0700335
336
337def GenTests(api):
Eric Borenf9aa9e52017-04-10 09:56:10 -0400338 for builder in TEST_BUILDERS:
339 test = (
340 api.test(builder) +
341 api.properties(buildername=builder,
342 revision='abc123',
343 path_config='kitchen',
344 swarm_out_dir='[SWARM_OUT_DIR]') +
345 api.path.exists(
346 api.path['start_dir'].join('skia'),
347 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
Eric Boren4c7754c2017-04-10 08:19:10 -0400348 'skimage', 'VERSION'),
Eric Borenf9aa9e52017-04-10 09:56:10 -0400349 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
Eric Boren4c7754c2017-04-10 08:19:10 -0400350 'skp', 'VERSION'),
Eric Borenf9aa9e52017-04-10 09:56:10 -0400351 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
352 )
353 )
Eric Borenf9aa9e52017-04-10 09:56:10 -0400354 if 'Win' in builder:
355 test += api.platform('win', 64)
Eric Boren4c7754c2017-04-10 08:19:10 -0400356
Eric Borenf9aa9e52017-04-10 09:56:10 -0400357 if 'Chromecast' in builder:
358 test += api.step_data(
359 'read chromecast ip',
360 stdout=api.raw_io.output('192.168.1.2:5555'))
361
362 if 'ChromeOS' in builder:
363 test += api.step_data(
364 'read chromeos ip',
365 stdout=api.raw_io.output('{"user_ip":"foo@127.0.0.1"}'))
366
367 yield test
Eric Boren4c7754c2017-04-10 08:19:10 -0400368
Kevin Lubickfe079d42017-04-12 08:31:48 -0400369 builder = 'Perf-Win10-MSVC-ShuttleB-GPU-IntelHD4600-x86_64-Release'
370 yield (
371 api.test('trybot') +
372 api.properties(buildername=builder,
373 revision='abc123',
374 path_config='kitchen',
375 swarm_out_dir='[SWARM_OUT_DIR]') +
376 api.properties(patch_storage='gerrit') +
377 api.properties.tryserver(
378 buildername=builder,
379 gerrit_project='skia',
380 gerrit_url='https://skia-review.googlesource.com/',
381 )+
382 api.path.exists(
383 api.path['start_dir'].join('skia'),
384 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
385 'skimage', 'VERSION'),
386 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
387 'skp', 'VERSION'),
388 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
389 'svg', 'VERSION'),
390 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
391 )
392 )
393
394 builder = 'Perf-Android-Clang-NexusPlayer-CPU-SSE4-x86-Debug-Android'
Eric Boren4c7754c2017-04-10 08:19:10 -0400395 yield (
396 api.test('failed_push') +
397 api.properties(buildername=builder,
Eric Boren4c7754c2017-04-10 08:19:10 -0400398 revision='abc123',
399 path_config='kitchen',
Eric Boren5de544b2017-01-12 08:46:20 -0500400 swarm_out_dir='[SWARM_OUT_DIR]') +
borenet1ed2ae42016-07-26 11:52:17 -0700401 api.path.exists(
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500402 api.path['start_dir'].join('skia'),
403 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
Eric Boren4c7754c2017-04-10 08:19:10 -0400404 'skimage', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500405 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
Eric Boren4c7754c2017-04-10 08:19:10 -0400406 'skp', 'VERSION'),
407 api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
408 'svg', 'VERSION'),
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500409 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
Eric Boren4c7754c2017-04-10 08:19:10 -0400410 ) +
411 api.step_data('push [START_DIR]/skia/resources/* '+
412 '/sdcard/revenge_of_the_skiabot/resources', retcode=1)
borenetbfa5b452016-10-19 10:13:32 -0700413 )