1cb93a386Sopenharmony_ci// Copyright 2020 The Chromium Authors. All rights reserved.
2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
3cb93a386Sopenharmony_ci// found in the LICENSE file.
4cb93a386Sopenharmony_cipackage gen_tasks_logic
5cb93a386Sopenharmony_ci
6cb93a386Sopenharmony_ciimport (
7cb93a386Sopenharmony_ci	"fmt"
8cb93a386Sopenharmony_ci	"sort"
9cb93a386Sopenharmony_ci
10cb93a386Sopenharmony_ci	"go.skia.org/infra/task_scheduler/go/specs"
11cb93a386Sopenharmony_ci)
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ci// nanobenchFlags generates flags to Nanobench based on the given task properties.
14cb93a386Sopenharmony_cifunc (b *taskBuilder) nanobenchFlags(doUpload bool) {
15cb93a386Sopenharmony_ci	args := []string{
16cb93a386Sopenharmony_ci		"nanobench",
17cb93a386Sopenharmony_ci		"--pre_log",
18cb93a386Sopenharmony_ci	}
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_ci	if b.gpu() {
21cb93a386Sopenharmony_ci		args = append(args, "--gpuStatsDump", "true")
22cb93a386Sopenharmony_ci	}
23cb93a386Sopenharmony_ci
24cb93a386Sopenharmony_ci	args = append(args, "--scales", "1.0", "1.1")
25cb93a386Sopenharmony_ci
26cb93a386Sopenharmony_ci	configs := []string{}
27cb93a386Sopenharmony_ci	if b.cpu() {
28cb93a386Sopenharmony_ci		args = append(args, "--nogpu")
29cb93a386Sopenharmony_ci		configs = append(configs, "8888", "nonrendering")
30cb93a386Sopenharmony_ci
31cb93a386Sopenharmony_ci		if b.extraConfig("BonusConfigs") {
32cb93a386Sopenharmony_ci			configs = []string{
33cb93a386Sopenharmony_ci				"f16",
34cb93a386Sopenharmony_ci				"srgb-rgba",
35cb93a386Sopenharmony_ci				"srgb-f16",
36cb93a386Sopenharmony_ci				"narrow-rgba",
37cb93a386Sopenharmony_ci				"narrow-f16",
38cb93a386Sopenharmony_ci			}
39cb93a386Sopenharmony_ci		}
40cb93a386Sopenharmony_ci
41cb93a386Sopenharmony_ci		if b.model("Nexus7") {
42cb93a386Sopenharmony_ci			args = append(args, "--purgeBetweenBenches") // Debugging skia:8929
43cb93a386Sopenharmony_ci		}
44cb93a386Sopenharmony_ci
45cb93a386Sopenharmony_ci	} else if b.gpu() {
46cb93a386Sopenharmony_ci		args = append(args, "--nocpu")
47cb93a386Sopenharmony_ci
48cb93a386Sopenharmony_ci		glPrefix := "gl"
49cb93a386Sopenharmony_ci		sampleCount := 8
50cb93a386Sopenharmony_ci		if b.os("Android", "iOS") {
51cb93a386Sopenharmony_ci			sampleCount = 4
52cb93a386Sopenharmony_ci			// The NVIDIA_Shield has a regular OpenGL implementation. We bench that
53cb93a386Sopenharmony_ci			// instead of ES.
54cb93a386Sopenharmony_ci			if !b.model("NVIDIA_Shield") {
55cb93a386Sopenharmony_ci				glPrefix = "gles"
56cb93a386Sopenharmony_ci			}
57cb93a386Sopenharmony_ci			// iOS crashes with MSAA (skia:6399)
58cb93a386Sopenharmony_ci			// Nexus7 (Tegra3) does not support MSAA.
59cb93a386Sopenharmony_ci			// MSAA is disabled on Pixel3a (https://b.corp.google.com/issues/143074513).
60cb93a386Sopenharmony_ci			// MSAA is disabled on Pixel5 (https://skbug.com/11152).
61cb93a386Sopenharmony_ci			if b.os("iOS") || b.model("Nexus7", "Pixel3a", "Pixel5") {
62cb93a386Sopenharmony_ci				sampleCount = 0
63cb93a386Sopenharmony_ci			}
64cb93a386Sopenharmony_ci		} else if b.matchGpu("AppleM1") {
65cb93a386Sopenharmony_ci			sampleCount = 4
66cb93a386Sopenharmony_ci		} else if b.matchGpu("Intel") {
67cb93a386Sopenharmony_ci			// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926
68cb93a386Sopenharmony_ci			sampleCount = 0
69cb93a386Sopenharmony_ci		} else if b.os("ChromeOS") {
70cb93a386Sopenharmony_ci			glPrefix = "gles"
71cb93a386Sopenharmony_ci		}
72cb93a386Sopenharmony_ci
73cb93a386Sopenharmony_ci		configs = append(configs, glPrefix, "srgb-"+glPrefix)
74cb93a386Sopenharmony_ci
75cb93a386Sopenharmony_ci		if b.os("Ubuntu18") && b.noExtraConfig() {
76cb93a386Sopenharmony_ci			configs = append(configs, glPrefix+"reducedshaders")
77cb93a386Sopenharmony_ci		}
78cb93a386Sopenharmony_ci		// narrow-gl/gles tests the case of color converting *all* content
79cb93a386Sopenharmony_ci		// It hangs on the AndroidOne (Mali400)  skia:10669
80cb93a386Sopenharmony_ci		if !b.gpu("Mali400MP2") {
81cb93a386Sopenharmony_ci			configs = append(configs, "narrow-"+glPrefix)
82cb93a386Sopenharmony_ci		}
83cb93a386Sopenharmony_ci
84cb93a386Sopenharmony_ci		// skia:10644 The fake ES2 config is used to compare highest available ES version to
85cb93a386Sopenharmony_ci		// when we're limited to ES2. We could consider adding a MSAA fake config as well.
86cb93a386Sopenharmony_ci		if b.os("Android") && glPrefix == "gles" {
87cb93a386Sopenharmony_ci			// These only support ES2. No point in running twice.
88cb93a386Sopenharmony_ci			if !b.gpu("Mali400MP2", "Tegra3") {
89cb93a386Sopenharmony_ci				configs = append(configs, "glesfakev2")
90cb93a386Sopenharmony_ci			}
91cb93a386Sopenharmony_ci		}
92cb93a386Sopenharmony_ci
93cb93a386Sopenharmony_ci		if sampleCount > 0 {
94cb93a386Sopenharmony_ci			configs = append(configs, fmt.Sprintf("%smsaa%d", glPrefix, sampleCount))
95cb93a386Sopenharmony_ci			if b.gpu("QuadroP400", "MaliG77", "AppleM1") {
96cb93a386Sopenharmony_ci				configs = append(configs, fmt.Sprintf("%sdmsaa", glPrefix))
97cb93a386Sopenharmony_ci			}
98cb93a386Sopenharmony_ci		}
99cb93a386Sopenharmony_ci
100cb93a386Sopenharmony_ci		// We want to test both the OpenGL config and the GLES config on Linux Intel:
101cb93a386Sopenharmony_ci		// GL is used by Chrome, GLES is used by ChromeOS.
102cb93a386Sopenharmony_ci		if b.matchGpu("Intel") && b.isLinux() {
103cb93a386Sopenharmony_ci			configs = append(configs, "gles", "srgb-gles")
104cb93a386Sopenharmony_ci		}
105cb93a386Sopenharmony_ci
106cb93a386Sopenharmony_ci		if b.extraConfig("CommandBuffer") {
107cb93a386Sopenharmony_ci			configs = []string{"cmdbuffer_es2"}
108cb93a386Sopenharmony_ci			if !b.matchGpu("Intel") {
109cb93a386Sopenharmony_ci				configs = append(configs, "cmdbuffer_es2_dmsaa")
110cb93a386Sopenharmony_ci			}
111cb93a386Sopenharmony_ci		}
112cb93a386Sopenharmony_ci
113cb93a386Sopenharmony_ci		if b.extraConfig("Vulkan") {
114cb93a386Sopenharmony_ci			configs = []string{"vk"}
115cb93a386Sopenharmony_ci			if b.os("Android") {
116cb93a386Sopenharmony_ci				// skbug.com/9274
117cb93a386Sopenharmony_ci				if !b.model("Pixel2XL") {
118cb93a386Sopenharmony_ci					configs = append(configs, "vkmsaa4")
119cb93a386Sopenharmony_ci				}
120cb93a386Sopenharmony_ci			} else {
121cb93a386Sopenharmony_ci				// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926, skia:9023
122cb93a386Sopenharmony_ci				if !b.matchGpu("Intel") {
123cb93a386Sopenharmony_ci					configs = append(configs, "vkmsaa8")
124cb93a386Sopenharmony_ci				}
125cb93a386Sopenharmony_ci			}
126cb93a386Sopenharmony_ci			if b.gpu("QuadroP400", "MaliG77") {
127cb93a386Sopenharmony_ci				configs = append(configs, "vkdmsaa")
128cb93a386Sopenharmony_ci			}
129cb93a386Sopenharmony_ci		}
130cb93a386Sopenharmony_ci		if b.extraConfig("Metal") {
131cb93a386Sopenharmony_ci			configs = []string{"mtl"}
132cb93a386Sopenharmony_ci			if b.os("iOS") {
133cb93a386Sopenharmony_ci				configs = append(configs, "mtlmsaa4")
134cb93a386Sopenharmony_ci			} else {
135cb93a386Sopenharmony_ci				configs = append(configs, "mtlmsaa8")
136cb93a386Sopenharmony_ci			}
137cb93a386Sopenharmony_ci			if b.model("iPhone11") {
138cb93a386Sopenharmony_ci				configs = append(configs, "mtlreducedshaders")
139cb93a386Sopenharmony_ci			}
140cb93a386Sopenharmony_ci		}
141cb93a386Sopenharmony_ci
142cb93a386Sopenharmony_ci		if b.extraConfig("ANGLE") {
143cb93a386Sopenharmony_ci			// Test only ANGLE configs.
144cb93a386Sopenharmony_ci			configs = []string{"angle_d3d11_es2", "angle_d3d11_es3"}
145cb93a386Sopenharmony_ci			if sampleCount > 0 {
146cb93a386Sopenharmony_ci				configs = append(configs, fmt.Sprintf("angle_d3d11_es2_msaa%d", sampleCount))
147cb93a386Sopenharmony_ci				configs = append(configs, fmt.Sprintf("angle_d3d11_es3_msaa%d", sampleCount))
148cb93a386Sopenharmony_ci			}
149cb93a386Sopenharmony_ci			if b.gpu("QuadroP400") {
150cb93a386Sopenharmony_ci				// See skia:7823 and chromium:693090.
151cb93a386Sopenharmony_ci				configs = append(configs, "angle_gl_es2")
152cb93a386Sopenharmony_ci				configs = append(configs, "angle_gl_es3")
153cb93a386Sopenharmony_ci				if sampleCount > 0 {
154cb93a386Sopenharmony_ci					configs = append(configs, fmt.Sprintf("angle_gl_es2_msaa%d", sampleCount))
155cb93a386Sopenharmony_ci					configs = append(configs, fmt.Sprintf("angle_gl_es3_msaa%d", sampleCount))
156cb93a386Sopenharmony_ci				}
157cb93a386Sopenharmony_ci			}
158cb93a386Sopenharmony_ci		}
159cb93a386Sopenharmony_ci		if b.os("ChromeOS") {
160cb93a386Sopenharmony_ci			// Just run GLES for now - maybe add gles_msaa4 in the future
161cb93a386Sopenharmony_ci			configs = []string{"gles"}
162cb93a386Sopenharmony_ci		}
163cb93a386Sopenharmony_ci		if b.extraConfig("SwiftShader") {
164cb93a386Sopenharmony_ci			configs = []string{"gles", "glesdmsaa"}
165cb93a386Sopenharmony_ci		}
166cb93a386Sopenharmony_ci	}
167cb93a386Sopenharmony_ci
168cb93a386Sopenharmony_ci	args = append(args, "--config")
169cb93a386Sopenharmony_ci	args = append(args, configs...)
170cb93a386Sopenharmony_ci
171cb93a386Sopenharmony_ci	// Use 4 internal msaa samples on mobile and AppleM1, otherwise 8.
172cb93a386Sopenharmony_ci	args = append(args, "--internalSamples")
173cb93a386Sopenharmony_ci	if b.os("Android") || b.os("iOS") || b.matchGpu("AppleM1") {
174cb93a386Sopenharmony_ci		args = append(args, "4")
175cb93a386Sopenharmony_ci	} else {
176cb93a386Sopenharmony_ci		args = append(args, "8")
177cb93a386Sopenharmony_ci	}
178cb93a386Sopenharmony_ci
179cb93a386Sopenharmony_ci	// By default, we test with GPU threading enabled, unless specifically
180cb93a386Sopenharmony_ci	// disabled.
181cb93a386Sopenharmony_ci	if b.extraConfig("NoGPUThreads") {
182cb93a386Sopenharmony_ci		args = append(args, "--gpuThreads", "0")
183cb93a386Sopenharmony_ci	}
184cb93a386Sopenharmony_ci
185cb93a386Sopenharmony_ci	if b.debug() || b.extraConfig("ASAN") || b.extraConfig("Valgrind") {
186cb93a386Sopenharmony_ci		args = append(args, "--loops", "1")
187cb93a386Sopenharmony_ci		args = append(args, "--samples", "1")
188cb93a386Sopenharmony_ci		// Ensure that the bot framework does not think we have timed out.
189cb93a386Sopenharmony_ci		args = append(args, "--keepAlive", "true")
190cb93a386Sopenharmony_ci	}
191cb93a386Sopenharmony_ci
192cb93a386Sopenharmony_ci	// Some people don't like verbose output.
193cb93a386Sopenharmony_ci	verbose := false
194cb93a386Sopenharmony_ci
195cb93a386Sopenharmony_ci	match := []string{}
196cb93a386Sopenharmony_ci	if b.os("Android") {
197cb93a386Sopenharmony_ci		// Segfaults when run as GPU bench. Very large texture?
198cb93a386Sopenharmony_ci		match = append(match, "~blurroundrect")
199cb93a386Sopenharmony_ci		match = append(match, "~patch_grid") // skia:2847
200cb93a386Sopenharmony_ci		match = append(match, "~desk_carsvg")
201cb93a386Sopenharmony_ci	}
202cb93a386Sopenharmony_ci	if b.matchModel("Nexus5") {
203cb93a386Sopenharmony_ci		match = append(match, "~keymobi_shop_mobileweb_ebay_com.skp") // skia:5178
204cb93a386Sopenharmony_ci	}
205cb93a386Sopenharmony_ci	if b.os("iOS") {
206cb93a386Sopenharmony_ci		match = append(match, "~blurroundrect")
207cb93a386Sopenharmony_ci		match = append(match, "~patch_grid") // skia:2847
208cb93a386Sopenharmony_ci		match = append(match, "~desk_carsvg")
209cb93a386Sopenharmony_ci		match = append(match, "~keymobi")
210cb93a386Sopenharmony_ci		match = append(match, "~path_hairline")
211cb93a386Sopenharmony_ci		match = append(match, "~GLInstancedArraysBench") // skia:4714
212cb93a386Sopenharmony_ci	}
213cb93a386Sopenharmony_ci	if b.os("iOS") && b.extraConfig("Metal") {
214cb93a386Sopenharmony_ci		// skia:9799
215cb93a386Sopenharmony_ci		match = append(match, "~compositing_images_tile_size")
216cb93a386Sopenharmony_ci	}
217cb93a386Sopenharmony_ci	if b.matchGpu("Intel") && b.isLinux() && !b.extraConfig("Vulkan") {
218cb93a386Sopenharmony_ci		// TODO(dogben): Track down what's causing bots to die.
219cb93a386Sopenharmony_ci		verbose = true
220cb93a386Sopenharmony_ci	}
221cb93a386Sopenharmony_ci	if b.gpu("IntelHD405") && b.isLinux() && b.extraConfig("Vulkan") {
222cb93a386Sopenharmony_ci		// skia:7322
223cb93a386Sopenharmony_ci		match = append(match, "~desk_carsvg.skp_1")
224cb93a386Sopenharmony_ci		match = append(match, "~desk_googlehome.skp")
225cb93a386Sopenharmony_ci		match = append(match, "~desk_tiger8svg.skp_1")
226cb93a386Sopenharmony_ci		match = append(match, "~desk_wowwiki.skp")
227cb93a386Sopenharmony_ci		match = append(match, "~desk_ynevsvg.skp_1.1")
228cb93a386Sopenharmony_ci		match = append(match, "~desk_nostroke_tiger8svg.skp")
229cb93a386Sopenharmony_ci		match = append(match, "~keymobi_booking_com.skp_1")
230cb93a386Sopenharmony_ci		match = append(match, "~keymobi_cnn_article.skp_1")
231cb93a386Sopenharmony_ci		match = append(match, "~keymobi_forecast_io.skp_1")
232cb93a386Sopenharmony_ci		match = append(match, "~keymobi_sfgate.skp_1")
233cb93a386Sopenharmony_ci		match = append(match, "~keymobi_techcrunch_com.skp_1.1")
234cb93a386Sopenharmony_ci		match = append(match, "~keymobi_techcrunch.skp_1.1")
235cb93a386Sopenharmony_ci		match = append(match, "~svgparse_Seal_of_California.svg_1.1")
236cb93a386Sopenharmony_ci		match = append(match, "~svgparse_NewYork-StateSeal.svg_1.1")
237cb93a386Sopenharmony_ci		match = append(match, "~svgparse_Vermont_state_seal.svg_1")
238cb93a386Sopenharmony_ci		match = append(match, "~tabl_gamedeksiam.skp_1.1")
239cb93a386Sopenharmony_ci		match = append(match, "~tabl_pravda.skp_1")
240cb93a386Sopenharmony_ci		match = append(match, "~top25desk_ebay_com.skp_1.1")
241cb93a386Sopenharmony_ci		match = append(match, "~top25desk_ebay.skp_1.1")
242cb93a386Sopenharmony_ci	}
243cb93a386Sopenharmony_ci	if b.extraConfig("Vulkan") && b.gpu("GTX660") {
244cb93a386Sopenharmony_ci		// skia:8523 skia:9271
245cb93a386Sopenharmony_ci		match = append(match, "~compositing_images")
246cb93a386Sopenharmony_ci	}
247cb93a386Sopenharmony_ci	if b.model("MacBook10.1") && b.extraConfig("CommandBuffer") {
248cb93a386Sopenharmony_ci		match = append(match, "~^desk_micrographygirlsvg.skp_1.1$")
249cb93a386Sopenharmony_ci	}
250cb93a386Sopenharmony_ci	if b.extraConfig("ASAN") && b.cpu() {
251cb93a386Sopenharmony_ci		// floor2int_undef benches undefined behavior, so ASAN correctly complains.
252cb93a386Sopenharmony_ci		match = append(match, "~^floor2int_undef$")
253cb93a386Sopenharmony_ci	}
254cb93a386Sopenharmony_ci	if b.model("AcerChromebook13_CB5_311") && b.gpu() {
255cb93a386Sopenharmony_ci		// skia:7551
256cb93a386Sopenharmony_ci		match = append(match, "~^shapes_rrect_inner_rrect_50_500x500$")
257cb93a386Sopenharmony_ci	}
258cb93a386Sopenharmony_ci	if b.model("Pixel3a") {
259cb93a386Sopenharmony_ci		// skia:9413
260cb93a386Sopenharmony_ci		match = append(match, "~^path_text$")
261cb93a386Sopenharmony_ci		match = append(match, "~^path_text_clipped_uncached$")
262cb93a386Sopenharmony_ci	}
263cb93a386Sopenharmony_ci	if b.model("Pixel3") && b.extraConfig("Vulkan") {
264cb93a386Sopenharmony_ci		// skia:9972
265cb93a386Sopenharmony_ci		match = append(match, "~^path_text_clipped_uncached$")
266cb93a386Sopenharmony_ci	}
267cb93a386Sopenharmony_ci
268cb93a386Sopenharmony_ci	if b.model("Wembley") {
269cb93a386Sopenharmony_ci		// These tests spin forever on the Wembley.
270cb93a386Sopenharmony_ci		match = append(match, "~^create_backend_texture")
271cb93a386Sopenharmony_ci		match = append(match, "~^draw_coverage")
272cb93a386Sopenharmony_ci		match = append(match, "~^compositing_images")
273cb93a386Sopenharmony_ci	}
274cb93a386Sopenharmony_ci
275cb93a386Sopenharmony_ci	if b.model(DONT_REDUCE_OPS_TASK_SPLITTING_MODELS...) {
276cb93a386Sopenharmony_ci		args = append(args, "--dontReduceOpsTaskSplitting", "true")
277cb93a386Sopenharmony_ci	}
278cb93a386Sopenharmony_ci	if b.model("NUC7i5BNK") {
279cb93a386Sopenharmony_ci		args = append(args, "--gpuResourceCacheLimit", "16777216")
280cb93a386Sopenharmony_ci	}
281cb93a386Sopenharmony_ci
282cb93a386Sopenharmony_ci	if b.extraConfig("DMSAAStats") {
283cb93a386Sopenharmony_ci		// Render tiled, single-frame skps with an extremely tall canvas that hopefully allows for
284cb93a386Sopenharmony_ci		// us to tile most or all of the content.
285cb93a386Sopenharmony_ci		args = append(args,
286cb93a386Sopenharmony_ci			"--sourceType", "skp", "--clip", "0,0,1600,16384", "--GPUbenchTileW", "1600",
287cb93a386Sopenharmony_ci			"--GPUbenchTileH", "512", "--samples", "1", "--loops", "1", "--config", "gldmsaa",
288cb93a386Sopenharmony_ci			"--dmsaaStatsDump")
289cb93a386Sopenharmony_ci		// Don't collect stats on the skps generated from vector content. We want these to actually
290cb93a386Sopenharmony_ci		// trigger dmsaa.
291cb93a386Sopenharmony_ci		match = append(match, "~svg", "~chalkboard", "~motionmark")
292cb93a386Sopenharmony_ci	}
293cb93a386Sopenharmony_ci
294cb93a386Sopenharmony_ci	// We do not need or want to benchmark the decodes of incomplete images.
295cb93a386Sopenharmony_ci	// In fact, in nanobench we assert that the full image decode succeeds.
296cb93a386Sopenharmony_ci	match = append(match, "~inc0.gif")
297cb93a386Sopenharmony_ci	match = append(match, "~inc1.gif")
298cb93a386Sopenharmony_ci	match = append(match, "~incInterlaced.gif")
299cb93a386Sopenharmony_ci	match = append(match, "~inc0.jpg")
300cb93a386Sopenharmony_ci	match = append(match, "~incGray.jpg")
301cb93a386Sopenharmony_ci	match = append(match, "~inc0.wbmp")
302cb93a386Sopenharmony_ci	match = append(match, "~inc1.wbmp")
303cb93a386Sopenharmony_ci	match = append(match, "~inc0.webp")
304cb93a386Sopenharmony_ci	match = append(match, "~inc1.webp")
305cb93a386Sopenharmony_ci	match = append(match, "~inc0.ico")
306cb93a386Sopenharmony_ci	match = append(match, "~inc1.ico")
307cb93a386Sopenharmony_ci	match = append(match, "~inc0.png")
308cb93a386Sopenharmony_ci	match = append(match, "~inc1.png")
309cb93a386Sopenharmony_ci	match = append(match, "~inc2.png")
310cb93a386Sopenharmony_ci	match = append(match, "~inc12.png")
311cb93a386Sopenharmony_ci	match = append(match, "~inc13.png")
312cb93a386Sopenharmony_ci	match = append(match, "~inc14.png")
313cb93a386Sopenharmony_ci	match = append(match, "~inc0.webp")
314cb93a386Sopenharmony_ci	match = append(match, "~inc1.webp")
315cb93a386Sopenharmony_ci
316cb93a386Sopenharmony_ci	if len(match) > 0 {
317cb93a386Sopenharmony_ci		args = append(args, "--match")
318cb93a386Sopenharmony_ci		args = append(args, match...)
319cb93a386Sopenharmony_ci	}
320cb93a386Sopenharmony_ci
321cb93a386Sopenharmony_ci	if verbose {
322cb93a386Sopenharmony_ci		args = append(args, "--verbose")
323cb93a386Sopenharmony_ci	}
324cb93a386Sopenharmony_ci
325cb93a386Sopenharmony_ci	// Add properties indicating which assets the task should use.
326cb93a386Sopenharmony_ci	b.recipeProp("do_upload", fmt.Sprintf("%t", doUpload))
327cb93a386Sopenharmony_ci	if !b.gpu() {
328cb93a386Sopenharmony_ci		b.asset("skimage")
329cb93a386Sopenharmony_ci		b.recipeProp("images", "true")
330cb93a386Sopenharmony_ci	}
331cb93a386Sopenharmony_ci	b.recipeProp("resources", "true")
332cb93a386Sopenharmony_ci	if !b.os("iOS") {
333cb93a386Sopenharmony_ci		b.asset("skp")
334cb93a386Sopenharmony_ci		b.recipeProp("skps", "true")
335cb93a386Sopenharmony_ci	}
336cb93a386Sopenharmony_ci	if !b.extraConfig("Valgrind") {
337cb93a386Sopenharmony_ci		b.asset("svg")
338cb93a386Sopenharmony_ci		b.recipeProp("svgs", "true")
339cb93a386Sopenharmony_ci	}
340cb93a386Sopenharmony_ci	if b.cpu() && b.os("Android") {
341cb93a386Sopenharmony_ci		// TODO(borenet): Where do these come from?
342cb93a386Sopenharmony_ci		b.recipeProp("textTraces", "true")
343cb93a386Sopenharmony_ci	}
344cb93a386Sopenharmony_ci
345cb93a386Sopenharmony_ci	// These properties are plumbed through nanobench and into Perf results.
346cb93a386Sopenharmony_ci	nanoProps := map[string]string{
347cb93a386Sopenharmony_ci		"gitHash":          specs.PLACEHOLDER_REVISION,
348cb93a386Sopenharmony_ci		"issue":            specs.PLACEHOLDER_ISSUE,
349cb93a386Sopenharmony_ci		"patchset":         specs.PLACEHOLDER_PATCHSET,
350cb93a386Sopenharmony_ci		"patch_storage":    specs.PLACEHOLDER_PATCH_STORAGE,
351cb93a386Sopenharmony_ci		"swarming_bot_id":  "${SWARMING_BOT_ID}",
352cb93a386Sopenharmony_ci		"swarming_task_id": "${SWARMING_TASK_ID}",
353cb93a386Sopenharmony_ci	}
354cb93a386Sopenharmony_ci
355cb93a386Sopenharmony_ci	if doUpload {
356cb93a386Sopenharmony_ci		keysExclude := map[string]bool{
357cb93a386Sopenharmony_ci			"configuration": true,
358cb93a386Sopenharmony_ci			"role":          true,
359cb93a386Sopenharmony_ci			"test_filter":   true,
360cb93a386Sopenharmony_ci		}
361cb93a386Sopenharmony_ci		keys := make([]string, 0, len(b.parts))
362cb93a386Sopenharmony_ci		for k := range b.parts {
363cb93a386Sopenharmony_ci			keys = append(keys, k)
364cb93a386Sopenharmony_ci		}
365cb93a386Sopenharmony_ci		sort.Strings(keys)
366cb93a386Sopenharmony_ci		args = append(args, "--key")
367cb93a386Sopenharmony_ci		for _, k := range keys {
368cb93a386Sopenharmony_ci			if !keysExclude[k] {
369cb93a386Sopenharmony_ci				args = append(args, k, b.parts[k])
370cb93a386Sopenharmony_ci			}
371cb93a386Sopenharmony_ci		}
372cb93a386Sopenharmony_ci	}
373cb93a386Sopenharmony_ci
374cb93a386Sopenharmony_ci	// Finalize the nanobench flags and properties.
375cb93a386Sopenharmony_ci	b.recipeProp("nanobench_flags", marshalJson(args))
376cb93a386Sopenharmony_ci	b.recipeProp("nanobench_properties", marshalJson(nanoProps))
377cb93a386Sopenharmony_ci}
378