borenet | 1e37d17 | 2015-03-27 05:42:18 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2015 Google Inc. |
| 3 | # |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | # |
| 7 | |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 8 | #!/usr/bin/env python |
| 9 | |
| 10 | usage = ''' |
| 11 | Write extra flags to outfile for nanobench based on the bot name: |
borenet | 1e37d17 | 2015-03-27 05:42:18 -0700 | [diff] [blame] | 12 | $ python nanobench_flags.py outfile Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 13 | Or run self-tests: |
| 14 | $ python nanobench_flags.py test |
| 15 | ''' |
| 16 | |
| 17 | import inspect |
| 18 | import json |
| 19 | import os |
| 20 | import sys |
| 21 | |
| 22 | |
| 23 | def lineno(): |
| 24 | caller = inspect.stack()[1] # Up one level to our caller. |
| 25 | return inspect.getframeinfo(caller[0]).lineno |
| 26 | |
| 27 | |
| 28 | cov_start = lineno()+1 # We care about coverage starting just past this def. |
| 29 | def get_args(bot): |
benjaminwagner | 8d61f0d | 2016-01-25 13:02:40 -0800 | [diff] [blame] | 30 | args = ['--pre_log'] |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 31 | |
scroggo | 860e8a6 | 2015-10-15 07:51:28 -0700 | [diff] [blame] | 32 | if 'GPU' in bot: |
| 33 | args.append('--images') |
joshualitt | 3b8c0a9 | 2015-12-02 11:04:51 -0800 | [diff] [blame] | 34 | args.extend(['--gpuStatsDump', 'true']) |
scroggo | 0a3cac8 | 2015-10-08 14:44:51 -0700 | [diff] [blame] | 35 | |
joshualitt | e1745a1 | 2016-02-11 11:42:19 -0800 | [diff] [blame] | 36 | if 'Android' in bot and 'GPU' in bot: |
| 37 | args.extend(['--useThermalManager', '1,1,10,1000']) |
| 38 | |
borenet | d34d947 | 2015-09-03 12:31:26 -0700 | [diff] [blame] | 39 | if 'Appurify' not in bot: |
| 40 | args.extend(['--scales', '1.0', '1.1']) |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 41 | |
stephana | 18b72db | 2015-05-21 13:59:36 -0700 | [diff] [blame] | 42 | if 'iOS' in bot: |
| 43 | args.extend(['--skps', 'ignore_skps']) |
| 44 | |
borenet | d34d947 | 2015-09-03 12:31:26 -0700 | [diff] [blame] | 45 | if 'Appurify' not in bot: |
| 46 | config = ['565', '8888', 'gpu', 'nonrendering', 'angle', 'hwui'] |
| 47 | # The S4 crashes and the NP produces a long error stream when we run with |
| 48 | # MSAA. |
| 49 | if ('GalaxyS4' not in bot and |
| 50 | 'NexusPlayer' not in bot): |
| 51 | if 'Android' in bot: |
bsalomon | b8797bb | 2016-04-05 08:49:38 -0700 | [diff] [blame] | 52 | # The TegraX1 has a regular OpenGL implementation. We bench that instead |
| 53 | # of ES. |
| 54 | if 'TegraX1' in bot: |
| 55 | config.remove('gpu') |
| 56 | config.extend(['gl', 'glmsaa4', 'glnvpr4', 'glnvprdit4']) |
| 57 | else: |
| 58 | config.extend(['msaa4', 'nvpr4', 'nvprdit4']) |
borenet | d34d947 | 2015-09-03 12:31:26 -0700 | [diff] [blame] | 59 | else: |
cdalton | c28afdb | 2016-03-29 20:05:07 -0700 | [diff] [blame] | 60 | config.extend(['msaa16', 'nvpr16', 'nvprdit16']) |
borenet | d34d947 | 2015-09-03 12:31:26 -0700 | [diff] [blame] | 61 | args.append('--config') |
| 62 | args.extend(config) |
bsalomon | bdff1fc | 2015-02-28 16:56:31 -0800 | [diff] [blame] | 63 | |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 64 | if 'Valgrind' in bot: |
| 65 | # Don't care about Valgrind performance. |
| 66 | args.extend(['--loops', '1']) |
| 67 | args.extend(['--samples', '1']) |
msarett | c149f0e | 2016-01-04 11:35:43 -0800 | [diff] [blame] | 68 | # Ensure that the bot framework does not think we have timed out. |
| 69 | args.extend(['--keepAlive', 'true']) |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 70 | |
egdaniel | 9a0f629 | 2015-03-20 07:03:52 -0700 | [diff] [blame] | 71 | if 'HD2000' in bot: |
mtklein | bf9e600 | 2015-06-16 10:41:27 -0700 | [diff] [blame] | 72 | args.extend(['--GPUbenchTileW', '256']) |
| 73 | args.extend(['--GPUbenchTileH', '256']) |
egdaniel | 9a0f629 | 2015-03-20 07:03:52 -0700 | [diff] [blame] | 74 | |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 75 | match = [] |
| 76 | if 'Android' in bot: |
| 77 | # Segfaults when run as GPU bench. Very large texture? |
| 78 | match.append('~blurroundrect') |
| 79 | match.append('~patch_grid') # skia:2847 |
| 80 | match.append('~desk_carsvg') |
| 81 | if 'HD2000' in bot: |
| 82 | match.extend(['~gradient', '~etc1bitmap']) # skia:2895 |
borenet | e1d7e0f | 2015-04-23 12:44:31 -0700 | [diff] [blame] | 83 | if 'NexusPlayer' in bot: |
| 84 | match.append('~desk_unicodetable') |
benjaminwagner | a1a8a60 | 2015-09-23 11:41:04 -0700 | [diff] [blame] | 85 | if 'GalaxyS4' in bot: |
| 86 | match.append('~GLInstancedArraysBench') # skia:4371 |
bsalomon | 885b677 | 2016-04-06 08:35:15 -0700 | [diff] [blame] | 87 | if 'Nexus5' in bot: |
| 88 | match.append('~keymobi_shop_mobileweb_ebay_com.skp') # skia:5178 |
stephana | 18b72db | 2015-05-21 13:59:36 -0700 | [diff] [blame] | 89 | if 'iOS' in bot: |
| 90 | match.append('~blurroundrect') |
| 91 | match.append('~patch_grid') # skia:2847 |
| 92 | match.append('~desk_carsvg') |
| 93 | match.append('~keymobi') |
stephana | 340cd84 | 2015-05-26 06:19:11 -0700 | [diff] [blame] | 94 | match.append('~path_hairline') |
joshualitt | 431dded | 2015-12-16 10:38:35 -0800 | [diff] [blame] | 95 | match.append('~GLInstancedArraysBench') # skia:4714 |
stephana | 18b72db | 2015-05-21 13:59:36 -0700 | [diff] [blame] | 96 | |
scroggo | 860e8a6 | 2015-10-15 07:51:28 -0700 | [diff] [blame] | 97 | # the 32-bit GCE bots run out of memory in DM when running these large images |
| 98 | # so defensively disable them in nanobench, too. |
| 99 | # FIXME (scroggo): This may have just been due to SkImageDecoder's |
halcanary | 6950de6 | 2015-11-07 05:29:00 -0800 | [diff] [blame] | 100 | # buildTileIndex leaking memory (https://bug.skia.org/4360). That is |
| 101 | # disabled by default for nanobench, so we may not need this. |
scroggo | 860e8a6 | 2015-10-15 07:51:28 -0700 | [diff] [blame] | 102 | # FIXME (scroggo): Share image blacklists between dm and nanobench? |
| 103 | if 'x86' in bot and not 'x86-64' in bot: |
| 104 | match.append('~interlaced1.png') |
| 105 | match.append('~interlaced2.png') |
| 106 | match.append('~interlaced3.png') |
| 107 | |
brianosman | 2e77ddb | 2016-03-30 06:30:46 -0700 | [diff] [blame] | 108 | # This low-end Android bot crashes about 25% of the time while running the |
| 109 | # (somewhat intense) shapes benchmarks. |
| 110 | if 'Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release' in bot: |
| 111 | match.append('~shapes_') |
| 112 | |
msarett | a7a21cf | 2015-11-16 08:43:23 -0800 | [diff] [blame] | 113 | # We do not need or want to benchmark the decodes of incomplete images. |
| 114 | # In fact, in nanobench we assert that the full image decode succeeds. |
| 115 | match.append('~inc0.gif') |
| 116 | match.append('~inc1.gif') |
| 117 | match.append('~incInterlaced.gif') |
| 118 | match.append('~inc0.jpg') |
| 119 | match.append('~incGray.jpg') |
| 120 | match.append('~inc0.wbmp') |
| 121 | match.append('~inc1.wbmp') |
| 122 | match.append('~inc0.webp') |
| 123 | match.append('~inc1.webp') |
| 124 | match.append('~inc0.ico') |
| 125 | match.append('~inc1.ico') |
| 126 | match.append('~inc0.png') |
| 127 | match.append('~inc1.png') |
| 128 | match.append('~inc2.png') |
| 129 | match.append('~inc12.png') |
| 130 | match.append('~inc13.png') |
| 131 | match.append('~inc14.png') |
| 132 | match.append('~inc0.webp') |
| 133 | match.append('~inc1.webp') |
| 134 | |
mtklein | afe9fac | 2016-02-22 14:59:59 -0800 | [diff] [blame] | 135 | # As an experiment, skip nanobench on Debug trybots. |
| 136 | if 'Debug' in bot and 'CPU' in bot and 'Trybot' in bot: |
| 137 | match = ['nothing_will_match_this'] |
| 138 | |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 139 | if match: |
| 140 | args.append('--match') |
| 141 | args.extend(match) |
mtklein | 7e78f3d | 2015-03-10 08:03:26 -0700 | [diff] [blame] | 142 | |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 143 | return args |
| 144 | cov_end = lineno() # Don't care about code coverage past here. |
| 145 | |
| 146 | |
| 147 | def self_test(): |
| 148 | import coverage # This way the bots don't need coverage.py to be installed. |
| 149 | args = {} |
| 150 | cases = [ |
joshualitt | e1745a1 | 2016-02-11 11:42:19 -0800 | [diff] [blame] | 151 | 'Perf-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Release', |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 152 | 'Perf-Android-Nexus7-Tegra3-Arm7-Release', |
borenet | e1d7e0f | 2015-04-23 12:44:31 -0700 | [diff] [blame] | 153 | 'Perf-Android-GCC-NexusPlayer-GPU-PowerVR-x86-Release', |
brianosman | 2e77ddb | 2016-03-30 06:30:46 -0700 | [diff] [blame] | 154 | 'Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release', |
borenet | 1e37d17 | 2015-03-27 05:42:18 -0700 | [diff] [blame] | 155 | 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind', |
| 156 | 'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE', |
stephana | 18b72db | 2015-05-21 13:59:36 -0700 | [diff] [blame] | 157 | 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug', |
benjaminwagner | a1a8a60 | 2015-09-23 11:41:04 -0700 | [diff] [blame] | 158 | 'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release', |
mtklein | afe9fac | 2016-02-22 14:59:59 -0800 | [diff] [blame] | 159 | 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot', |
bsalomon | b8797bb | 2016-04-05 08:49:38 -0700 | [diff] [blame] | 160 | 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release', |
bsalomon | 885b677 | 2016-04-06 08:35:15 -0700 | [diff] [blame] | 161 | 'Perf-Android-GCC-Nexus5-GPU-Adreno330-Arm7-Release', |
mtklein | f73e589 | 2015-02-24 11:45:11 -0800 | [diff] [blame] | 162 | ] |
| 163 | |
| 164 | cov = coverage.coverage() |
| 165 | cov.start() |
| 166 | for case in cases: |
| 167 | args[case] = get_args(case) |
| 168 | cov.stop() |
| 169 | |
| 170 | this_file = os.path.basename(__file__) |
| 171 | _, _, not_run, _ = cov.analysis(this_file) |
| 172 | filtered = [line for line in not_run if line > cov_start and line < cov_end] |
| 173 | if filtered: |
| 174 | print 'Lines not covered by test cases: ', filtered |
| 175 | sys.exit(1) |
| 176 | |
| 177 | golden = this_file.replace('.py', '.json') |
| 178 | with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f: |
| 179 | json.dump(args, f, indent=2, sort_keys=True) |
| 180 | |
| 181 | |
| 182 | if __name__ == '__main__': |
| 183 | if len(sys.argv) == 2 and sys.argv[1] == 'test': |
| 184 | self_test() |
| 185 | sys.exit(0) |
| 186 | |
| 187 | if len(sys.argv) != 3: |
| 188 | print usage |
| 189 | sys.exit(1) |
| 190 | |
| 191 | with open(sys.argv[1], 'w') as out: |
| 192 | json.dump(get_args(sys.argv[2]), out) |