2016-11-14 18:42:27 +00:00
|
|
|
# Copyright 2016 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
2017-04-10 12:19:10 +00:00
|
|
|
# Recipe for Skia skpbench.
|
|
|
|
|
|
|
|
|
|
|
|
import calendar
|
2016-11-14 18:42:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
DEPS = [
|
2017-07-07 21:36:58 +00:00
|
|
|
'flavor',
|
2017-05-13 02:09:38 +00:00
|
|
|
'recipe_engine/context',
|
2017-07-07 21:36:58 +00:00
|
|
|
'recipe_engine/file',
|
2016-11-14 18:42:27 +00:00
|
|
|
'recipe_engine/path',
|
2019-04-24 18:14:27 +00:00
|
|
|
'recipe_engine/platform',
|
2016-11-14 18:42:27 +00:00
|
|
|
'recipe_engine/properties',
|
2017-04-10 12:19:10 +00:00
|
|
|
'recipe_engine/python',
|
2016-11-14 18:42:27 +00:00
|
|
|
'recipe_engine/raw_io',
|
2017-04-10 12:19:10 +00:00
|
|
|
'recipe_engine/step',
|
|
|
|
'recipe_engine/time',
|
|
|
|
'run',
|
|
|
|
'vars',
|
2016-11-14 18:42:27 +00:00
|
|
|
]
|
|
|
|
|
2017-10-12 19:15:47 +00:00
|
|
|
ADB_BINARY = 'adb.1.0.35'
|
|
|
|
|
2016-11-14 18:42:27 +00:00
|
|
|
|
2017-04-10 12:19:10 +00:00
|
|
|
def _run(api, title, *cmd, **kwargs):
|
2018-05-18 11:36:55 +00:00
|
|
|
with api.context(cwd=api.path['start_dir'].join('skia')):
|
2017-04-10 12:19:10 +00:00
|
|
|
return api.run(api.step, title, cmd=list(cmd), **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
def _adb(api, title, *cmd, **kwargs):
|
|
|
|
if 'infra_step' not in kwargs:
|
|
|
|
kwargs['infra_step'] = True
|
2017-10-12 19:15:47 +00:00
|
|
|
return _run(api, title, ADB_BINARY, *cmd, **kwargs)
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
def skpbench_steps(api):
|
|
|
|
"""benchmark Skia using skpbench."""
|
2020-09-24 17:42:47 +00:00
|
|
|
is_vulkan = 'Vulkan' in api.vars.builder_name
|
|
|
|
is_android = 'Android' in api.vars.builder_name
|
|
|
|
is_ccpr = 'CCPR' in api.vars.builder_name
|
|
|
|
is_all_paths_volatile = 'AllPathsVolatile' in api.vars.builder_name
|
|
|
|
is_mskp = 'Mskp' in api.vars.builder_name
|
|
|
|
is_ddl = 'DDL' in api.vars.builder_name
|
|
|
|
is_9x9 = '9x9' in api.vars.builder_name
|
|
|
|
|
2018-05-18 11:36:55 +00:00
|
|
|
api.file.ensure_directory(
|
|
|
|
'makedirs perf_dir', api.flavor.host_dirs.perf_data_dir)
|
2018-04-17 19:55:57 +00:00
|
|
|
|
2020-09-24 17:42:47 +00:00
|
|
|
if is_android:
|
2018-06-01 14:08:53 +00:00
|
|
|
app = api.vars.build_dir.join('skpbench')
|
2018-05-23 12:43:04 +00:00
|
|
|
_adb(api, 'push skpbench', 'push', app, api.flavor.device_dirs.bin_dir)
|
2017-04-10 12:19:10 +00:00
|
|
|
|
2020-07-31 18:50:39 +00:00
|
|
|
skpbench_dir = api.vars.workdir.join('skia', 'tools', 'skpbench')
|
2017-04-10 12:19:10 +00:00
|
|
|
table = api.path.join(api.vars.swarming_out_dir, 'table')
|
|
|
|
|
2020-09-24 17:42:47 +00:00
|
|
|
config = 'vk' if is_vulkan else 'gles' if is_android else 'gl'
|
|
|
|
internal_samples = 4 if is_android else 8
|
|
|
|
|
|
|
|
if is_all_paths_volatile:
|
|
|
|
config = "%smsaa%i" % (config, internal_samples)
|
|
|
|
|
|
|
|
skpbench_invocation = api.path.join(api.flavor.device_dirs.bin_dir, 'skpbench')
|
|
|
|
|
|
|
|
# skbug.com/10184
|
|
|
|
if is_vulkan and 'GalaxyS20' in api.vars.builder_name:
|
|
|
|
skpbench_invocation = "LD_LIBRARY_PATH=/data/local/tmp %s" % skpbench_invocation
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
skpbench_args = [
|
2020-09-24 17:42:47 +00:00
|
|
|
skpbench_invocation,
|
2017-04-10 12:19:10 +00:00
|
|
|
'--resultsfile', table,
|
2017-06-27 17:44:36 +00:00
|
|
|
'--config', config,
|
2020-09-24 17:42:47 +00:00
|
|
|
'--internalSamples', str(internal_samples),
|
2017-06-27 17:44:36 +00:00
|
|
|
# TODO(dogben): Track down what's causing bots to die.
|
2017-10-20 18:39:11 +00:00
|
|
|
'-v5']
|
2020-09-24 17:42:47 +00:00
|
|
|
if is_ddl:
|
2018-05-31 17:27:52 +00:00
|
|
|
skpbench_args += ['--ddl']
|
2020-07-31 18:09:06 +00:00
|
|
|
# disable the mask generation threads for simplicity's sake in DDL mode
|
2018-06-26 17:47:44 +00:00
|
|
|
skpbench_args += ['--gpuThreads', '0']
|
2020-09-24 17:42:47 +00:00
|
|
|
if is_9x9:
|
2018-05-31 14:44:30 +00:00
|
|
|
skpbench_args += [
|
2020-05-18 14:21:53 +00:00
|
|
|
'--ddlNumRecordingThreads', 9,
|
2018-05-31 14:44:30 +00:00
|
|
|
'--ddlTilingWidthHeight', 3]
|
2020-09-24 17:42:47 +00:00
|
|
|
if is_android:
|
2018-05-23 12:43:04 +00:00
|
|
|
skpbench_args += [
|
|
|
|
'--adb',
|
|
|
|
'--adb_binary', ADB_BINARY]
|
2020-09-24 17:42:47 +00:00
|
|
|
if is_ccpr:
|
2017-10-20 18:39:11 +00:00
|
|
|
skpbench_args += [
|
2019-03-30 06:31:23 +00:00
|
|
|
'--pr', 'ccpr', '--cc', '--nocache',
|
2018-05-18 11:36:55 +00:00
|
|
|
api.path.join(api.flavor.device_dirs.skp_dir, 'desk_*svg.skp'),
|
|
|
|
api.path.join(api.flavor.device_dirs.skp_dir, 'desk_chalkboard.skp')]
|
2020-09-24 17:42:47 +00:00
|
|
|
elif is_mskp:
|
2019-08-01 17:39:34 +00:00
|
|
|
skpbench_args += [api.flavor.device_dirs.mskp_dir]
|
2020-09-24 17:42:47 +00:00
|
|
|
elif is_all_paths_volatile:
|
|
|
|
skpbench_args += [
|
|
|
|
# nvpr takes every path when enabled, which isn't always the best choice
|
|
|
|
# for volatile paths.
|
|
|
|
'--pr', '~nvpr',
|
|
|
|
'--allPathsVolatile',
|
2020-09-25 16:23:28 +00:00
|
|
|
'--suffix', "_volatile",
|
2020-09-24 17:42:47 +00:00
|
|
|
api.path.join(api.flavor.device_dirs.skp_dir, 'desk_*svg.skp'),
|
|
|
|
api.path.join(api.flavor.device_dirs.skp_dir, 'desk_chalkboard.skp')]
|
2017-10-20 18:39:11 +00:00
|
|
|
else:
|
2018-05-18 11:36:55 +00:00
|
|
|
skpbench_args += [api.flavor.device_dirs.skp_dir]
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
api.run(api.python, 'skpbench',
|
|
|
|
script=skpbench_dir.join('skpbench.py'),
|
|
|
|
args=skpbench_args)
|
|
|
|
|
|
|
|
skiaperf_args = [
|
|
|
|
table,
|
|
|
|
'--properties',
|
2018-05-18 11:36:55 +00:00
|
|
|
'gitHash', api.properties['revision'],
|
2017-04-10 12:19:10 +00:00
|
|
|
]
|
2017-04-10 13:56:10 +00:00
|
|
|
if api.vars.is_trybot:
|
|
|
|
skiaperf_args.extend([
|
|
|
|
'issue', api.vars.issue,
|
|
|
|
'patchset', api.vars.patchset,
|
|
|
|
'patch_storage', api.vars.patch_storage,
|
|
|
|
])
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
skiaperf_args.extend(['swarming_bot_id', api.vars.swarming_bot_id])
|
|
|
|
skiaperf_args.extend(['swarming_task_id', api.vars.swarming_task_id])
|
|
|
|
|
|
|
|
now = api.time.utcnow()
|
|
|
|
ts = int(calendar.timegm(now.utctimetuple()))
|
|
|
|
json_path = api.path.join(
|
2018-05-18 11:36:55 +00:00
|
|
|
api.flavor.host_dirs.perf_data_dir,
|
|
|
|
'skpbench_%s_%d.json' % (api.properties['revision'], ts))
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
skiaperf_args.extend([
|
|
|
|
'--outfile', json_path
|
|
|
|
])
|
|
|
|
|
|
|
|
skiaperf_args.append('--key')
|
|
|
|
for k in sorted(api.vars.builder_cfg.keys()):
|
2020-07-24 17:37:32 +00:00
|
|
|
if not k in ['configuration', 'role', 'is_trybot']:
|
2017-04-10 12:19:10 +00:00
|
|
|
skiaperf_args.extend([k, api.vars.builder_cfg[k]])
|
|
|
|
|
|
|
|
api.run(api.python, 'Parse skpbench output into Perf json',
|
|
|
|
script=skpbench_dir.join('skiaperf.py'),
|
|
|
|
args=skiaperf_args)
|
|
|
|
|
|
|
|
|
2016-11-14 18:42:27 +00:00
|
|
|
def RunSteps(api):
|
2018-05-04 17:46:15 +00:00
|
|
|
api.vars.setup()
|
|
|
|
api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
|
2020-02-27 17:19:46 +00:00
|
|
|
|
|
|
|
# The app_name passed to api.flavor.setup() is used to determine which app
|
|
|
|
# to install on an attached device. That work is done in skpbench_steps, so
|
|
|
|
# we pass None here.
|
|
|
|
api.flavor.setup(None)
|
2018-05-04 17:46:15 +00:00
|
|
|
|
2017-04-10 12:19:10 +00:00
|
|
|
try:
|
2019-08-01 17:39:34 +00:00
|
|
|
mksp_mode = ('Mskp' in api.vars.builder_name)
|
2020-02-27 17:19:46 +00:00
|
|
|
api.flavor.install(skps=not mksp_mode, mskps=mksp_mode)
|
2017-04-10 12:19:10 +00:00
|
|
|
skpbench_steps(api)
|
|
|
|
finally:
|
|
|
|
api.flavor.cleanup_steps()
|
|
|
|
api.run.check_failure()
|
|
|
|
|
|
|
|
|
2017-04-10 13:56:10 +00:00
|
|
|
TEST_BUILDERS = [
|
2019-08-01 17:39:34 +00:00
|
|
|
('Perf-Android-Clang-Pixel-GPU-Adreno530-arm64-Release-All-'
|
|
|
|
'Android_Skpbench_Mskp'),
|
2017-10-20 18:39:11 +00:00
|
|
|
('Perf-Android-Clang-Pixel-GPU-Adreno530-arm64-Release-All-'
|
|
|
|
'Android_CCPR_Skpbench'),
|
2020-10-27 18:09:43 +00:00
|
|
|
('Perf-Android-Clang-Pixel-GPU-Adreno530-arm64-Release-All-'
|
|
|
|
'Android_ReduceOpsTaskSplitting_Skpbench'),
|
2020-09-24 17:42:47 +00:00
|
|
|
('Perf-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-'
|
|
|
|
'Android_AllPathsVolatile_Skpbench'),
|
|
|
|
('Perf-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-'
|
|
|
|
'Android_Vulkan_AllPathsVolatile_Skpbench'),
|
2018-05-23 12:43:04 +00:00
|
|
|
'Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-Vulkan_Skpbench',
|
2018-05-31 14:44:30 +00:00
|
|
|
('Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-'
|
|
|
|
'Vulkan_Skpbench_DDLTotal_9x9'),
|
2020-09-24 17:42:47 +00:00
|
|
|
('Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-'
|
|
|
|
'AllPathsVolatile_Skpbench'),
|
2017-04-10 13:56:10 +00:00
|
|
|
]
|
2016-11-14 18:42:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def GenTests(api):
|
2017-04-10 13:56:10 +00:00
|
|
|
for builder in TEST_BUILDERS:
|
|
|
|
test = (
|
|
|
|
api.test(builder) +
|
|
|
|
api.properties(buildername=builder,
|
|
|
|
revision='abc123',
|
|
|
|
path_config='kitchen',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]') +
|
|
|
|
api.path.exists(
|
|
|
|
api.path['start_dir'].join('skia'),
|
|
|
|
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
|
|
|
|
'skp', 'VERSION'),
|
|
|
|
) +
|
|
|
|
api.step_data('get swarming bot id',
|
|
|
|
stdout=api.raw_io.output('skia-bot-123')) +
|
|
|
|
api.step_data('get swarming task id',
|
|
|
|
stdout=api.raw_io.output('123456'))
|
|
|
|
)
|
2019-04-24 18:14:27 +00:00
|
|
|
if 'Win' in builder and not 'LenovoYogaC630' in builder:
|
|
|
|
test += api.platform('win', 64)
|
2017-04-10 13:56:10 +00:00
|
|
|
yield test
|
2017-04-12 12:31:48 +00:00
|
|
|
|
2018-06-20 18:32:57 +00:00
|
|
|
b = ('Perf-Android-Clang-Pixel2XL-GPU-Adreno540-arm64-Release-All-'
|
|
|
|
'Android_Vulkan_Skpbench')
|
2017-04-12 12:31:48 +00:00
|
|
|
yield (
|
|
|
|
api.test('trybot') +
|
|
|
|
api.properties(buildername=b,
|
|
|
|
revision='abc123',
|
|
|
|
path_config='kitchen',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]') +
|
|
|
|
api.path.exists(
|
|
|
|
api.path['start_dir'].join('skia'),
|
|
|
|
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
|
|
|
|
'skp', 'VERSION'),
|
|
|
|
) +
|
|
|
|
api.step_data('get swarming bot id',
|
|
|
|
stdout=api.raw_io.output('skia-bot-123')) +
|
|
|
|
api.step_data('get swarming task id',
|
|
|
|
stdout=api.raw_io.output('123456')) +
|
|
|
|
api.properties(patch_storage='gerrit') +
|
|
|
|
api.properties.tryserver(
|
|
|
|
buildername=b,
|
|
|
|
gerrit_project='skia',
|
|
|
|
gerrit_url='https://skia-review.googlesource.com/',
|
|
|
|
)
|
|
|
|
)
|