| 1 |
// Copyright 2020 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 |
package gen_tasks_logic |
| 5 |
|
| 6 |
import ( |
| 7 |
"fmt" |
| 8 |
"sort" |
| 9 |
|
| 10 |
"go.skia.org/infra/task_scheduler/go/specs" |
| 11 |
) |
| 12 |
|
| 13 |
// nanobenchFlags generates flags to Nanobench based on the given task properties. |
| 14 |
func (b *TaskBuilder) nanobenchFlags(doUpload bool) { |
| 15 |
args := []string{ |
| 16 |
"nanobench", |
| 17 |
"--pre_log", |
| 18 |
} |
| 19 |
|
| 20 |
if b.GPU() { |
| 21 |
args = append(args, "--gpuStatsDump", "true") |
| 22 |
} |
| 23 |
|
| 24 |
configs := []string{} |
| 25 |
if b.CPU() { |
| 26 |
args = append(args, "--nogpu") |
| 27 |
configs = append(configs, "8888", "nonrendering") |
| 28 |
|
| 29 |
if b.ExtraConfig("BonusConfigs") { |
| 30 |
configs = []string{ |
| 31 |
"f16", |
| 32 |
"srgb-rgba", |
| 33 |
"srgb-f16", |
| 34 |
"narrow-rgba", |
| 35 |
"narrow-f16", |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
if b.Model("Nexus7") { |
| 40 |
args = append(args, "--purgeBetweenBenches") // Debugging skbug.com/40040209 |
| 41 |
} |
| 42 |
|
| 43 |
} else if b.GPU() { |
| 44 |
args = append(args, "--nocpu") |
| 45 |
|
| 46 |
glPrefix := "gl" |
| 47 |
sampleCount := 8 |
| 48 |
if b.MatchOs("Android") || b.Os("iOS") { |
| 49 |
sampleCount = 4 |
| 50 |
glPrefix = "gles" |
| 51 |
// iOS crashes with MSAA (skbug.com/40037602) |
| 52 |
// Nexus7 (Tegra3) does not support MSAA. |
| 53 |
// MSAA is disabled on Pixel3a (https://b.corp.google.com/issues/143074513). |
| 54 |
// MSAA is disabled on Pixel5 (https://skbug.com/40042528). |
| 55 |
if b.Os("iOS") || b.Model("Nexus7", "Pixel3a", "Pixel5") { |
| 56 |
sampleCount = 0 |
| 57 |
} |
| 58 |
} else if b.MatchGpu("AppleM") { |
| 59 |
sampleCount = 4 |
| 60 |
} else if b.MatchGpu("Intel") { |
| 61 |
// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926 |
| 62 |
if b.GPU("IntelIrisXe") && b.MatchOs("Win") && b.ExtraConfig("ANGLE") { |
| 63 |
// Make an exception for newer GPUs + D3D |
| 64 |
args = append(args, "--allowMSAAOnNewIntel", "true") |
| 65 |
} else { |
| 66 |
sampleCount = 0 |
| 67 |
} |
| 68 |
} else if b.Os("ChromeOS") { |
| 69 |
glPrefix = "gles" |
| 70 |
} else if b.GPU("QuadroP400") && b.MatchOs("Ubuntu24.04") { |
| 71 |
sampleCount = 4 |
| 72 |
} |
| 73 |
|
| 74 |
configs = append(configs, glPrefix, "srgb-"+glPrefix) |
| 75 |
|
| 76 |
if b.Os("Ubuntu18") && b.NoExtraConfig() { |
| 77 |
configs = append(configs, glPrefix+"reducedshaders") |
| 78 |
} |
| 79 |
// narrow-gl/gles tests the case of color converting *all* content |
| 80 |
// It hangs on the AndroidOne (Mali400) skbug.com/40042015 |
| 81 |
if !b.GPU("Mali400MP2") { |
| 82 |
configs = append(configs, "narrow-"+glPrefix) |
| 83 |
} |
| 84 |
|
| 85 |
// skbug.com/40041990 The fake ES2 config is used to compare highest available ES version to |
| 86 |
// when we're limited to ES2. We could consider adding a MSAA fake config as well. |
| 87 |
if b.MatchOs("Android") && glPrefix == "gles" { |
| 88 |
// These only support ES2. No point in running twice. |
| 89 |
if !b.GPU("Mali400MP2", "Tegra3") { |
| 90 |
configs = append(configs, "glesfakev2") |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
if sampleCount > 0 { |
| 95 |
configs = append(configs, fmt.Sprintf("%smsaa%d", glPrefix, sampleCount)) |
| 96 |
if b.MatchGpu("QuadroP400", "MaliG77", "AppleM") { |
| 97 |
configs = append(configs, fmt.Sprintf("%sdmsaa", glPrefix)) |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
// We want to test both the OpenGL config and the GLES config on Linux Intel: |
| 102 |
// GL is used by Chrome, GLES is used by ChromeOS. |
| 103 |
if b.MatchGpu("Intel") && b.IsLinux() { |
| 104 |
configs = append(configs, "gles", "srgb-gles") |
| 105 |
} |
| 106 |
|
| 107 |
if b.ExtraConfig("Vulkan") { |
| 108 |
configs = []string{"vk"} |
| 109 |
if !b.MatchOs("Android") { |
| 110 |
// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926, skbug.com/40040308 |
| 111 |
// QuadroP400+Ubuntu24.04 doesn't support msaa8 |
| 112 |
if !b.MatchGpu("Intel") && !(b.GPU("QuadroP400") && b.MatchOs("Ubuntu24.04")) { |
| 113 |
configs = append(configs, "vkmsaa8") |
| 114 |
} |
| 115 |
} |
| 116 |
if b.GPU("QuadroP400", "MaliG77") { |
| 117 |
configs = append(configs, "vkdmsaa") |
| 118 |
} |
| 119 |
} |
| 120 |
if b.ExtraConfig("Metal") && !b.ExtraConfig("Graphite") { |
| 121 |
configs = []string{"mtl"} |
| 122 |
if b.Os("iOS") || b.GPU("AppleM3") { |
| 123 |
configs = append(configs, "mtlmsaa4") |
| 124 |
} else { |
| 125 |
configs = append(configs, "mtlmsaa8") |
| 126 |
} |
| 127 |
if b.Model("iPhone11") { |
| 128 |
configs = append(configs, "mtlreducedshaders") |
| 129 |
} |
| 130 |
} |
| 131 |
|
| 132 |
if b.ExtraConfig("ANGLE") { |
| 133 |
// Test only ANGLE configs. |
| 134 |
configs = []string{"angle_d3d11_es2", "angle_d3d11_es3"} |
| 135 |
if sampleCount > 0 { |
| 136 |
configs = append(configs, fmt.Sprintf("angle_d3d11_es2_msaa%d", sampleCount)) |
| 137 |
configs = append(configs, fmt.Sprintf("angle_d3d11_es3_msaa%d", sampleCount)) |
| 138 |
} |
| 139 |
if b.GPU("QuadroP400") { |
| 140 |
// See skbug.com/40039078 and chromium:693090. |
| 141 |
configs = append(configs, "angle_gl_es2") |
| 142 |
configs = append(configs, "angle_gl_es3") |
| 143 |
if sampleCount > 0 { |
| 144 |
configs = append(configs, fmt.Sprintf("angle_gl_es2_msaa%d", sampleCount)) |
| 145 |
configs = append(configs, fmt.Sprintf("angle_gl_es3_msaa%d", sampleCount)) |
| 146 |
} |
| 147 |
} |
| 148 |
} |
| 149 |
|
| 150 |
if b.ExtraConfig("Graphite") { |
| 151 |
if b.ExtraConfig("Dawn") { |
| 152 |
if b.ExtraConfig("D3D11") { |
| 153 |
configs = []string{"grdawn_d3d11"} |
| 154 |
} |
| 155 |
if b.ExtraConfig("D3D12") { |
| 156 |
configs = []string{"grdawn_d3d12"} |
| 157 |
} |
| 158 |
if b.ExtraConfig("Metal") { |
| 159 |
configs = []string{"grdawn_mtl"} |
| 160 |
} |
| 161 |
if b.ExtraConfig("Vulkan") { |
| 162 |
configs = []string{"grdawn_vk"} |
| 163 |
} |
| 164 |
if b.ExtraConfig("GL") { |
| 165 |
configs = []string{"grdawn_gl"} |
| 166 |
} |
| 167 |
if b.ExtraConfig("GLES") { |
| 168 |
configs = []string{"grdawn_gles"} |
| 169 |
} |
| 170 |
} |
| 171 |
if b.ExtraConfig("Native") { |
| 172 |
if b.ExtraConfig("Metal") { |
| 173 |
configs = []string{"grmtl"} |
| 174 |
} |
| 175 |
if b.ExtraConfig("Vulkan") { |
| 176 |
configs = []string{"grvk"} |
| 177 |
} |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
if b.Os("ChromeOS") { |
| 182 |
// Just run GLES for now - maybe add gles_msaa4 in the future |
| 183 |
configs = []string{"gles"} |
| 184 |
} |
| 185 |
if b.ExtraConfig("SwiftShader") { |
| 186 |
if b.ExtraConfig("Graphite") { |
| 187 |
configs = []string{"grvk"} |
| 188 |
} else { |
| 189 |
configs = []string{"vk", "vkdmsaa"} |
| 190 |
} |
| 191 |
} |
| 192 |
} |
| 193 |
|
| 194 |
args = append(args, "--config") |
| 195 |
args = append(args, configs...) |
| 196 |
|
| 197 |
// Use 4 internal msaa samples on mobile, AppleM*, and with Graphite, otherwise 8. |
| 198 |
args = append(args, "--internalSamples") |
| 199 |
if b.MatchOs("Android") || b.Os("iOS") || b.MatchGpu("AppleM") || b.ExtraConfig("Graphite") { |
| 200 |
args = append(args, "4") |
| 201 |
} else { |
| 202 |
args = append(args, "8") |
| 203 |
} |
| 204 |
|
| 205 |
// By default, we test with GPU threading enabled, unless specifically |
| 206 |
// disabled. |
| 207 |
if b.ExtraConfig("NoGPUThreads") { |
| 208 |
args = append(args, "--gpuThreads", "0") |
| 209 |
} |
| 210 |
|
| 211 |
if b.Debug() || b.ExtraConfig("ASAN") { |
| 212 |
args = append(args, "--loops", "1") |
| 213 |
args = append(args, "--samples", "1") |
| 214 |
// Ensure that the bot framework does not think we have timed out. |
| 215 |
args = append(args, "--keepAlive", "true") |
| 216 |
} |
| 217 |
|
| 218 |
// Some people don't like verbose output. |
| 219 |
verbose := false |
| 220 |
|
| 221 |
match := []string{} |
| 222 |
if b.MatchOs("Android") { |
| 223 |
// Segfaults when run as GPU bench. Very large texture? |
| 224 |
match = append(match, "~blurroundrect") |
| 225 |
match = append(match, "~patch_grid") // skbug.com/40033959 |
| 226 |
match = append(match, "~desk_carsvg") |
| 227 |
} |
| 228 |
if b.Os("iOS") { |
| 229 |
match = append(match, "~blurroundrect") |
| 230 |
match = append(match, "~patch_grid") // skbug.com/40033959 |
| 231 |
match = append(match, "~desk_carsvg") |
| 232 |
match = append(match, "~keymobi") |
| 233 |
match = append(match, "~path_hairline") |
| 234 |
match = append(match, "~GLInstancedArraysBench") // skbug.com/40035868 |
| 235 |
} |
| 236 |
if b.Os("iOS") && b.ExtraConfig("Metal") && !b.ExtraConfig("Graphite") { |
| 237 |
// skbug.com/40041128 |
| 238 |
match = append(match, "~compositing_images_tile_size") |
| 239 |
} |
| 240 |
if b.MatchGpu("Intel") && b.IsLinux() && !b.ExtraConfig("Vulkan") { |
| 241 |
// TODO(dogben): Track down what's causing bots to die. |
| 242 |
verbose = true |
| 243 |
} |
| 244 |
if b.GPU("IntelHD405") && b.IsLinux() && b.ExtraConfig("Vulkan") { |
| 245 |
// skbug.com/40038567 |
| 246 |
match = append(match, "~desk_carsvg.skp_1") |
| 247 |
match = append(match, "~desk_googlehome.skp") |
| 248 |
match = append(match, "~desk_tiger8svg.skp_1") |
| 249 |
match = append(match, "~desk_wowwiki.skp") |
| 250 |
match = append(match, "~desk_ynevsvg.skp_1.1") |
| 251 |
match = append(match, "~desk_nostroke_tiger8svg.skp") |
| 252 |
match = append(match, "~keymobi_booking_com.skp_1") |
| 253 |
match = append(match, "~keymobi_cnn_article.skp_1") |
| 254 |
match = append(match, "~keymobi_forecast_io.skp_1") |
| 255 |
match = append(match, "~keymobi_sfgate.skp_1") |
| 256 |
match = append(match, "~keymobi_techcrunch_com.skp_1.1") |
| 257 |
match = append(match, "~keymobi_techcrunch.skp_1.1") |
| 258 |
match = append(match, "~svgparse_Seal_of_California.svg_1.1") |
| 259 |
match = append(match, "~svgparse_NewYork-StateSeal.svg_1.1") |
| 260 |
match = append(match, "~svgparse_Vermont_state_seal.svg_1") |
| 261 |
match = append(match, "~tabl_gamedeksiam.skp_1.1") |
| 262 |
match = append(match, "~tabl_pravda.skp_1") |
| 263 |
match = append(match, "~top25desk_ebay_com.skp_1.1") |
| 264 |
match = append(match, "~top25desk_ebay.skp_1.1") |
| 265 |
} |
| 266 |
if b.GPU("Tegra3") { |
| 267 |
// skbug.com/338376730 |
| 268 |
match = append(match, "~GM_matrixconvolution_bigger") |
| 269 |
match = append(match, "~GM_matrixconvolution_biggest") |
| 270 |
} |
| 271 |
if b.ExtraConfig("ASAN") && b.CPU() { |
| 272 |
// floor2int_undef benches undefined behavior, so ASAN correctly complains. |
| 273 |
match = append(match, "~^floor2int_undef$") |
| 274 |
} |
| 275 |
if b.Model("Pixel3a") { |
| 276 |
// skbug.com/40040735 |
| 277 |
match = append(match, "~^path_text$") |
| 278 |
match = append(match, "~^path_text_clipped_uncached$") |
| 279 |
} |
| 280 |
if b.Model("Pixel4XL") && b.ExtraConfig("Vulkan") { |
| 281 |
// skbug.com/40040735? |
| 282 |
match = append(match, "~^path_text_clipped_uncached$") |
| 283 |
} |
| 284 |
|
| 285 |
if b.Model("Wembley") { |
| 286 |
// These tests spin forever on the Wembley. |
| 287 |
match = append(match, "~^create_backend_texture") |
| 288 |
match = append(match, "~^draw_coverage") |
| 289 |
match = append(match, "~^compositing_images") |
| 290 |
} |
| 291 |
if b.ExtraConfig("Graphite") && b.ExtraConfig("Dawn") { |
| 292 |
if b.MatchOs("Win10") && b.MatchGpu("RadeonR9M470X") { |
| 293 |
// The Dawn Win10 Radeon allocates too many Vulkan resources in bulk rect tests (b/318725123) |
| 294 |
match = append(match, "~bulkrect_1000_grid_uniqueimages") |
| 295 |
match = append(match, "~bulkrect_1000_random_uniqueimages") |
| 296 |
} |
| 297 |
} |
| 298 |
|
| 299 |
if b.Model(DONT_REDUCE_OPS_TASK_SPLITTING_MODELS...) { |
| 300 |
args = append(args, "--dontReduceOpsTaskSplitting", "true") |
| 301 |
} |
| 302 |
if !b.IsLinux() && b.ExtraConfig("Vulkan") && b.GPU("QuadroP400") { |
| 303 |
// skbug.com/40045386 (desk_carsvg.skp hangs indefinitely on Windows QuadroP400 vkdmsaa configs) |
| 304 |
match = append(match, "~desk_carsvg.skp") |
| 305 |
} |
| 306 |
|
| 307 |
if b.ExtraConfig("DMSAAStats") { |
| 308 |
// Render tiled, single-frame skps with an extremely tall canvas that hopefully allows for |
| 309 |
// us to tile most or all of the content. |
| 310 |
args = append(args, |
| 311 |
"--sourceType", "skp", "--clip", "0,0,1600,16384", "--GPUbenchTileW", "1600", |
| 312 |
"--GPUbenchTileH", "512", "--samples", "1", "--loops", "1", "--config", "gldmsaa", |
| 313 |
"--dmsaaStatsDump") |
| 314 |
// Don't collect stats on the skps generated from vector content. We want these to actually |
| 315 |
// trigger dmsaa. |
| 316 |
match = append(match, "~svg", "~chalkboard", "~motionmark") |
| 317 |
} |
| 318 |
|
| 319 |
// We do not need or want to benchmark the decodes of incomplete images. |
| 320 |
// In fact, in nanobench we assert that the full image decode succeeds. |
| 321 |
match = append(match, "~inc0.gif") |
| 322 |
match = append(match, "~inc1.gif") |
| 323 |
match = append(match, "~incInterlaced.gif") |
| 324 |
match = append(match, "~inc0.jpg") |
| 325 |
match = append(match, "~incGray.jpg") |
| 326 |
match = append(match, "~inc0.wbmp") |
| 327 |
match = append(match, "~inc1.wbmp") |
| 328 |
match = append(match, "~inc0.webp") |
| 329 |
match = append(match, "~inc1.webp") |
| 330 |
match = append(match, "~inc0.ico") |
| 331 |
match = append(match, "~inc1.ico") |
| 332 |
match = append(match, "~inc0.png") |
| 333 |
match = append(match, "~inc1.png") |
| 334 |
match = append(match, "~inc2.png") |
| 335 |
match = append(match, "~inc12.png") |
| 336 |
match = append(match, "~inc13.png") |
| 337 |
match = append(match, "~inc14.png") |
| 338 |
match = append(match, "~inc0.webp") |
| 339 |
match = append(match, "~inc1.webp") |
| 340 |
|
| 341 |
if len(match) > 0 { |
| 342 |
args = append(args, "--match") |
| 343 |
args = append(args, match...) |
| 344 |
} |
| 345 |
|
| 346 |
if verbose { |
| 347 |
args = append(args, "--verbose") |
| 348 |
} |
| 349 |
|
| 350 |
// Add properties indicating which assets the task should use. |
| 351 |
b.recipeProp("do_upload", fmt.Sprintf("%t", doUpload)) |
| 352 |
if !b.GPU() { |
| 353 |
b.asset("skimage") |
| 354 |
b.recipeProp("images", "true") |
| 355 |
} |
| 356 |
b.recipeProp("resources", "true") |
| 357 |
if !b.Os("iOS") { |
| 358 |
b.asset("skp") |
| 359 |
b.recipeProp("skps", "true") |
| 360 |
} |
| 361 |
if b.CPU() && b.MatchOs("Android") { |
| 362 |
// TODO(borenet): Where do these come from? |
| 363 |
b.recipeProp("textTraces", "true") |
| 364 |
} |
| 365 |
|
| 366 |
b.asset("svg") |
| 367 |
b.recipeProp("svgs", "true") |
| 368 |
|
| 369 |
// These properties are plumbed through nanobench and into Perf results. |
| 370 |
nanoProps := map[string]string{ |
| 371 |
"gitHash": specs.PLACEHOLDER_REVISION, |
| 372 |
"issue": specs.PLACEHOLDER_ISSUE, |
| 373 |
"patchset": specs.PLACEHOLDER_PATCHSET, |
| 374 |
"patch_storage": specs.PLACEHOLDER_PATCH_STORAGE, |
| 375 |
"swarming_bot_id": "${SWARMING_BOT_ID}", |
| 376 |
"swarming_task_id": "${SWARMING_TASK_ID}", |
| 377 |
} |
| 378 |
|
| 379 |
if doUpload { |
| 380 |
keysExclude := map[string]bool{ |
| 381 |
"role": true, |
| 382 |
"test_filter": true, |
| 383 |
} |
| 384 |
keys := make([]string, 0, len(b.Parts)) |
| 385 |
for k := range b.Parts { |
| 386 |
keys = append(keys, k) |
| 387 |
} |
| 388 |
sort.Strings(keys) |
| 389 |
args = append(args, "--key") |
| 390 |
for _, k := range keys { |
| 391 |
// We had not been adding this to our traces for a long time. We then started doing |
| 392 |
// performance data on an "OptimizeForSize" build. We didn't want to disrupt the |
| 393 |
// existing traces, so we skip the configuration for Release builds. |
| 394 |
if k == "configuration" && b.Parts[k] == "Release" { |
| 395 |
continue |
| 396 |
} |
| 397 |
if !keysExclude[k] { |
| 398 |
args = append(args, k, b.Parts[k]) |
| 399 |
} |
| 400 |
} |
| 401 |
} |
| 402 |
|
| 403 |
// Finalize the nanobench flags and properties. |
| 404 |
b.recipeProp("nanobench_flags", marshalJson(args)) |
| 405 |
b.recipeProp("nanobench_properties", marshalJson(nanoProps)) |
| 406 |
} |