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