Debian Codegraph @

bazel/device_specific_configs/device_specific_configs.go

raw
1 // Copyright 2023 Google LLC
2 //
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 package device_specific_configs
7
8 import (
9 "fmt"
10 "sort"
11 )
12
13 // Config represents a Bazel config that communicates information about the device under test.
14 //
15 // This struct is used to generate file //bazel/devicesrc.
16 //
17 // Configurations of this kind should not be used to set build time settings, such as the target
18 // Bazel platform (e.g. Linux, Android), optimization level (e.g. Debug, Release) or local vs. RBE.
19 // For that kind of information, please pass a second --config flag using one of the configurations
20 // defined in //bazel/buildrc.
21 type Config struct {
22 // Name of the config (the <foo> that gets passed to Bazel via --config=<foo>).
23 Name string
24
25 // Any device-specific key/value pairs to include in Gold and Perf traces produced by GM and
26 // benchmark tests, except for keys "cpu_or_gpu" and "cpu_or_gpu_value". See fields CPU and GPU.
27 Keys map[string]string
28
29 // CPU is the name of the CPU on this device.
30 //
31 // When a GM or benchmark test case is executed, the corresponding test runner will set the
32 // "cpu_or_gpu_value" key of the resulting Gold or Perf trace with the contents of this field
33 // if the test case is CPU-bound, in which case it will also set the "cpu_or_gpu" key to "CPU".
34 CPU string
35
36 // GPU is the name of the GPU on this device.
37 //
38 // This field is the GPU analogous of the CPU field; see its documentation for details.
39 GPU string
40
41 // SwarmingDimensions are the Swarming dimensions that a CI task must exhibit in order to get
42 // scheduled to run on a machine that corresponds with the device under test indicated by the
43 // Bazel config.
44 SwarmingDimensions map[string]string
45 }
46
47 // Model returns the "model" key in the Keys dictionary.
48 func (d Config) Model() string {
49 model, ok := d.Keys["model"]
50 if !ok {
51 // Should never happen. We have a unit test that ensures all configs have this key.
52 panic(fmt.Sprintf("config %q does not contain key \"model\"", d.Name))
53 }
54 return model
55 }
56
57 // TestRunnerArgs returns the command-line arguments that should be passed to the Bazel test
58 // target.
59 func (d Config) TestRunnerArgs() []string {
60 args := []string{
61 // Pass the name of the Bazel configuration as an argument. Android tests use this to infer the
62 // model of the device under test. Specifically, adb_test_runner.go will take device-specific
63 // setup and teardown steps based on the model. C++ tests running on the same machine as Bazel
64 // will ignore this flag.
65 "--device-specific-bazel-config",
66 d.Name,
67 }
68
69 // Sort keys for determinism.
70 var keys []string
71 for key := range d.Keys {
72 keys = append(keys, key)
73 }
74 sort.Strings(keys)
75
76 // Add key/value pairs.
77 args = append(args, "--key")
78 for _, key := range keys {
79 args = append(args, key, d.Keys[key])
80 }
81
82 if d.CPU != "" {
83 args = append(args, "--cpuName", d.CPU)
84 }
85
86 if d.GPU != "" {
87 args = append(args, "--gpuName", d.GPU)
88 }
89
90 return args
91 }
92
93 // Configs contains all known device-specific Bazel configs.
94 //
95 // The contents of this map are used to generate file //bazel/devicesrc.
96 //
97 // TODO(lovisolo): Populate field SwarmingDimensions for all configs.
98 var Configs = map[string]Config{
99 "AlphaR2": {
100 Name: "AlphaR2",
101 Keys: map[string]string{
102 "arch": "x86_64",
103 "model": "AlphaR2",
104 "os": "Win10",
105 },
106 GPU: "RadeonR9M470X",
107 },
108 "AndroidOne": {
109 Name: "AndroidOne",
110 Keys: map[string]string{
111 "arch": "arm",
112 "model": "AndroidOne",
113 "os": "Android",
114 },
115 GPU: "Mali400MP2",
116 },
117 "GCE_Debian10_AVX2": {
118 Name: "GCE_Debian10_AVX2",
119 Keys: map[string]string{
120 "arch": "x86_64",
121 "model": "GCE",
122 "os": "Debian10",
123 },
124 CPU: "AVX2",
125 GPU: "SwiftShader",
126 },
127 "GCE_Debian10_AVX512": {
128 Name: "GCE_Debian10_AVX512",
129 Keys: map[string]string{
130 "arch": "x86_64",
131 "model": "GCE",
132 "os": "Debian10",
133 },
134 CPU: "AVX512",
135 GPU: "SwiftShader",
136 },
137 "GCE_Debian10_Rome": {
138 Name: "GCE_Debian10_Rome",
139 Keys: map[string]string{
140 "arch": "x86_64",
141 "model": "GCE",
142 "os": "Debian10",
143 },
144 CPU: "Rome",
145 GPU: "SwiftShader",
146 },
147 "GCE_Win2019_AVX2": {
148 Name: "GCE_Win2019_AVX2",
149 Keys: map[string]string{
150 "arch": "x86_64",
151 "model": "GCE",
152 "os": "Win2019",
153 },
154 CPU: "AVX2",
155 GPU: "SwiftShader",
156 },
157 "GCE_Win2019_AVX512": {
158 Name: "GCE_Win2019_AVX512",
159 Keys: map[string]string{
160 "arch": "x86_64",
161 "model": "GCE",
162 "os": "Win2019",
163 },
164 CPU: "AVX512",
165 GPU: "SwiftShader",
166 },
167 "GCE_Win2019_Rome": {
168 Name: "GCE_Win2019_Rome",
169 Keys: map[string]string{
170 "arch": "x86_64",
171 "model": "GCE",
172 "os": "Win2019",
173 },
174 CPU: "Rome",
175 GPU: "SwiftShader",
176 },
177 "GCE_x86_Debian10_AVX2": {
178 Name: "GCE_x86_Debian10_AVX2",
179 Keys: map[string]string{
180 "arch": "x86",
181 "model": "GCE",
182 "os": "Debian10",
183 },
184 CPU: "AVX2",
185 GPU: "SwiftShader",
186 },
187 "GCE_x86_Debian10_AVX512": {
188 Name: "GCE_x86_Debian10_AVX512",
189 Keys: map[string]string{
190 "arch": "x86",
191 "model": "GCE",
192 "os": "Debian10",
193 },
194 CPU: "AVX512",
195 GPU: "SwiftShader",
196 },
197 "GCE_x86_Debian10_Rome": {
198 Name: "GCE_x86_Debian10_Rome",
199 Keys: map[string]string{
200 "arch": "x86",
201 "model": "GCE",
202 "os": "Debian10",
203 },
204 CPU: "Rome",
205 GPU: "SwiftShader",
206 },
207 "GCE_x86_Win2019_AVX2": {
208 Name: "GCE_x86_Win2019_AVX2",
209 Keys: map[string]string{
210 "arch": "x86",
211 "model": "GCE",
212 "os": "Win2019",
213 },
214 CPU: "AVX2",
215 GPU: "SwiftShader",
216 },
217 "GCE_x86_Win2019_AVX512": {
218 Name: "GCE_x86_Win2019_AVX512",
219 Keys: map[string]string{
220 "arch": "x86",
221 "model": "GCE",
222 "os": "Win2019",
223 },
224 CPU: "AVX512",
225 GPU: "SwiftShader",
226 },
227 "GCE_x86_Win2019_Rome": {
228 Name: "GCE_x86_Win2019_Rome",
229 Keys: map[string]string{
230 "arch": "x86",
231 "model": "GCE",
232 "os": "Win2019",
233 },
234 CPU: "Rome",
235 GPU: "SwiftShader",
236 },
237 "GalaxyS20": {
238 Name: "GalaxyS20",
239 Keys: map[string]string{
240 "arch": "arm64",
241 "model": "GalaxyS20",
242 "os": "Android",
243 },
244 GPU: "MaliG77",
245 },
246 "GalaxyS7_G930FD": {
247 Name: "GalaxyS7_G930FD",
248 Keys: map[string]string{
249 "arch": "arm64",
250 "model": "GalaxyS7_G930FD",
251 "os": "Android",
252 },
253 GPU: "MaliT880",
254 },
255 "Golo_wasm_Ubuntu18": {
256 Name: "Golo_wasm_Ubuntu18",
257 Keys: map[string]string{
258 "arch": "wasm",
259 "model": "Golo",
260 "os": "Ubuntu18",
261 },
262 GPU: "QuadroP400",
263 },
264 "Golo_wasm_Win10": {
265 Name: "Golo_wasm_Win10",
266 Keys: map[string]string{
267 "arch": "wasm",
268 "model": "Golo",
269 "os": "Win10",
270 },
271 GPU: "QuadroP400",
272 },
273 "Golo_x86_64_Ubuntu18": {
274 Name: "Golo_x86_64_Ubuntu18",
275 Keys: map[string]string{
276 "arch": "x86_64",
277 "model": "Golo",
278 "os": "Ubuntu18",
279 },
280 GPU: "QuadroP400",
281 },
282 "Golo_x86_64_Win10": {
283 Name: "Golo_x86_64_Win10",
284 Keys: map[string]string{
285 "arch": "x86_64",
286 "model": "Golo",
287 "os": "Win10",
288 },
289 GPU: "QuadroP400",
290 },
291 "JioNext": {
292 Name: "JioNext",
293 Keys: map[string]string{
294 "arch": "arm",
295 "model": "JioNext",
296 "os": "Android",
297 },
298 CPU: "SnapdragonQM215",
299 GPU: "Adreno308",
300 },
301 "MacBook10.1": {
302 Name: "MacBook10.1",
303 Keys: map[string]string{
304 "arch": "x86_64",
305 "model": "MacBook10.1",
306 "os": "Mac10.13",
307 },
308 GPU: "IntelHD615",
309 },
310 "MacBookAir7.2": {
311 Name: "MacBookAir7.2",
312 Keys: map[string]string{
313 "arch": "x86_64",
314 "model": "MacBookAir7.2",
315 "os": "Mac10.15.1",
316 },
317 GPU: "IntelHD6000",
318 },
319 "MacBookPro11.5_Mac10.13": {
320 Name: "MacBookPro11.5_Mac10.13",
321 Keys: map[string]string{
322 "arch": "x86_64",
323 "model": "MacBookPro11.5",
324 "os": "Mac10.13",
325 },
326 CPU: "AVX2",
327 GPU: "RadeonHD8870M",
328 },
329 "MacBookPro11.5_Mac10.15.7": {
330 Name: "MacBookPro11.5_Mac10.15.7",
331 Keys: map[string]string{
332 "arch": "x86_64",
333 "model": "MacBookPro11.5",
334 "os": "Mac10.15.7",
335 },
336 CPU: "AVX2",
337 GPU: "RadeonHD8870M",
338 },
339 "MacBookPro16.2": {
340 Name: "MacBookPro16.2",
341 Keys: map[string]string{
342 "arch": "x86_64",
343 "model": "MacBookPro16.2",
344 "os": "Mac12",
345 },
346 CPU: "AppleIntel",
347 GPU: "IntelIrisPlus",
348 },
349 "MacMini7.1_Mac10.13": {
350 Name: "MacMini7.1_Mac10.13",
351 Keys: map[string]string{
352 "arch": "x86_64",
353 "model": "MacMini7.1",
354 "os": "Mac10.13",
355 },
356 CPU: "AVX2",
357 GPU: "IntelIris5100",
358 },
359 "MacMini7.1_Mac10.14": {
360 Name: "MacMini7.1_Mac10.14",
361 Keys: map[string]string{
362 "arch": "x86_64",
363 "model": "MacMini7.1",
364 "os": "Mac10.14",
365 },
366 CPU: "AVX2",
367 GPU: "IntelIris5100",
368 },
369 "MacMini7.1_Mac10.15.7": {
370 Name: "MacMini7.1_Mac10.15.7",
371 Keys: map[string]string{
372 "arch": "x86_64",
373 "model": "MacMini7.1",
374 "os": "Mac10.15.7",
375 },
376 CPU: "AVX2",
377 GPU: "IntelIris5100",
378 },
379 "MacMini9.1_Mac11": {
380 Name: "MacMini9.1_Mac11",
381 Keys: map[string]string{
382 "arch": "arm64",
383 "model": "MacMini9.1",
384 "os": "Mac11",
385 },
386 CPU: "AppleM1",
387 GPU: "AppleM1",
388 },
389 "MacMini9.1_Mac12": {
390 Name: "MacMini9.1_Mac12",
391 Keys: map[string]string{
392 "arch": "arm64",
393 "model": "MacMini9.1",
394 "os": "Mac12",
395 },
396 CPU: "AppleM1",
397 GPU: "AppleM1",
398 },
399 "MacMini9.1_Mac13": {
400 Name: "MacMini9.1_Mac13",
401 Keys: map[string]string{
402 "arch": "arm64",
403 "model": "MacMini9.1",
404 "os": "Mac13",
405 },
406 CPU: "AppleM1",
407 GPU: "AppleM1",
408 },
409 "NUC11TZi5_Debian11": {
410 Name: "NUC11TZi5_Debian11",
411 Keys: map[string]string{
412 "arch": "x86_64",
413 "model": "NUC11TZi5",
414 "os": "Debian11",
415 },
416 CPU: "AVX2",
417 GPU: "IntelIrisXe",
418 },
419 "NUC11TZi5_Win10": {
420 Name: "NUC11TZi5_Win10",
421 Keys: map[string]string{
422 "arch": "x86_64",
423 "model": "NUC11TZi5",
424 "os": "Win10",
425 },
426 CPU: "AVX2",
427 GPU: "IntelIrisXe",
428 },
429 "NUC5PPYH": {
430 Name: "NUC5PPYH",
431 Keys: map[string]string{
432 "arch": "x86_64",
433 "model": "NUC5PPYH",
434 "os": "Debian10",
435 },
436 GPU: "IntelHD405",
437 },
438 "NUC5i7RYH": {
439 Name: "NUC5i7RYH",
440 Keys: map[string]string{
441 "arch": "x86_64",
442 "model": "NUC5i7RYH",
443 "os": "Win10",
444 },
445 CPU: "AVX2",
446 GPU: "IntelIris6100",
447 },
448 "NUC6i5SYK": {
449 Name: "NUC6i5SYK",
450 Keys: map[string]string{
451 "arch": "x86_64",
452 "model": "NUC6i5SYK",
453 "os": "Win10",
454 },
455 GPU: "IntelIris540",
456 },
457 "NUC8i5BEK": {
458 Name: "NUC8i5BEK",
459 Keys: map[string]string{
460 "arch": "x86_64",
461 "model": "NUC8i5BEK",
462 "os": "Win10",
463 },
464 GPU: "IntelIris655",
465 },
466 "NUC9i7QN_Debian11": {
467 Name: "NUC9i7QN_Debian11",
468 Keys: map[string]string{
469 "arch": "x86_64",
470 "model": "NUC9i7QN",
471 "os": "Debian11",
472 },
473 CPU: "AVX2",
474 GPU: "RTX3060",
475 // Based on
476 // https://skia.googlesource.com/skia/+/5606ef899116266132253e979a793fea97f12604/infra/bots/gen_tasks_logic/gen_tasks_logic.go#952.
477 SwarmingDimensions: map[string]string{
478 "os": "Debian-11.5",
479 "cpu": "x86-64-i7-9750H",
480 },
481 },
482 "NUC9i7QN_Win10": {
483 Name: "NUC9i7QN_Win10",
484 Keys: map[string]string{
485 "arch": "x86_64",
486 "model": "NUC9i7QN",
487 "os": "Win10",
488 },
489 CPU: "AVX2",
490 GPU: "RTX3060",
491 },
492 "NUCD34010WYKH": {
493 Name: "NUCD34010WYKH",
494 Keys: map[string]string{
495 "arch": "x86_64",
496 "model": "NUCD34010WYKH",
497 "os": "Win10",
498 },
499 GPU: "IntelHD4400",
500 },
501 "NUCDE3815TYKHE": {
502 Name: "NUCDE3815TYKHE",
503 Keys: map[string]string{
504 "arch": "x86_64",
505 "model": "NUCDE3815TYKHE",
506 "os": "Debian10",
507 },
508 GPU: "IntelBayTrail",
509 },
510 "Nexus7": {
511 Name: "Nexus7",
512 Keys: map[string]string{
513 "arch": "arm",
514 "model": "Nexus7",
515 "os": "Android",
516 },
517 GPU: "Tegra3",
518 },
519 "P30": {
520 Name: "P30",
521 Keys: map[string]string{
522 "arch": "arm64",
523 "model": "P30",
524 "os": "Android",
525 },
526 GPU: "MaliG76",
527 },
528 "Pixel4": {
529 Name: "Pixel4",
530 Keys: map[string]string{
531 "arch": "arm64",
532 "model": "Pixel4",
533 "os": "Android",
534 },
535 CPU: "Snapdragon855",
536 GPU: "Adreno640",
537 },
538 "Pixel4XL": {
539 Name: "Pixel4XL",
540 Keys: map[string]string{
541 "arch": "arm64",
542 "model": "Pixel4XL",
543 "os": "Android",
544 },
545 GPU: "Adreno640",
546 },
547 "Pixel5": {
548 Name: "Pixel5",
549 Keys: map[string]string{
550 "arch": "arm64",
551 "model": "Pixel5",
552 "os": "Android",
553 },
554 GPU: "Adreno620",
555 // Based on
556 // https://skia.googlesource.com/skia/+/f8daeeb7f092abe1674bc2303c0781f9fb1756ab/infra/bots/gen_tasks_logic/gen_tasks_logic.go#836.
557 SwarmingDimensions: map[string]string{
558 "os": "Android",
559 "device_type": "redfin",
560 "device_os": "RD1A.200810.022.A4",
561 },
562 },
563 "Pixel5_Android12": {
564 Name: "Pixel5_Android12",
565 Keys: map[string]string{
566 "arch": "arm64",
567 "model": "Pixel5",
568 "os": "Android12",
569 },
570 GPU: "Adreno620",
571 // Based on
572 // https://skia.googlesource.com/skia/+/f8daeeb7f092abe1674bc2303c0781f9fb1756ab/infra/bots/gen_tasks_logic/gen_tasks_logic.go#910.
573 SwarmingDimensions: map[string]string{
574 "os": "Android",
575 "device_type": "redfin",
576 "device_os": "SP2A.220305.012",
577 },
578 },
579 "Pixel6": {
580 Name: "Pixel6",
581 Keys: map[string]string{
582 "arch": "arm64",
583 "model": "Pixel6",
584 "os": "Android",
585 },
586 GPU: "MaliG78",
587 },
588 "Pixel7": {
589 Name: "Pixel7",
590 Keys: map[string]string{
591 "arch": "arm64",
592 "model": "Pixel7",
593 "os": "Android",
594 },
595 GPU: "MaliG710",
596 },
597 "RUBYR5_Debian11": {
598 Name: "RUBYR5_Debian11",
599 Keys: map[string]string{
600 "arch": "x86_64",
601 "model": "RUBYR5",
602 "os": "Debian11",
603 },
604 GPU: "RadeonVega6",
605 },
606 "RUBYR5_Win10": {
607 Name: "RUBYR5_Win10",
608 Keys: map[string]string{
609 "arch": "x86_64",
610 "model": "RUBYR5",
611 "os": "Win10",
612 },
613 GPU: "RadeonVega6",
614 },
615 "VMware7.1_Mac10.13": {
616 Name: "VMware7.1_Mac10.13",
617 Keys: map[string]string{
618 "arch": "x86_64",
619 "model": "VMware7.1",
620 "os": "Mac10.13",
621 },
622 CPU: "AVX",
623 },
624 "VMware7.1_Mac10.14": {
625 Name: "VMware7.1_Mac10.14",
626 Keys: map[string]string{
627 "arch": "x86_64",
628 "model": "VMware7.1",
629 "os": "Mac10.14",
630 },
631 CPU: "AVX",
632 },
633 "VMware7.1_Mac10.15.7": {
634 Name: "VMware7.1_Mac10.15.7",
635 Keys: map[string]string{
636 "arch": "x86_64",
637 "model": "VMware7.1",
638 "os": "Mac10.15.7",
639 },
640 CPU: "AVX",
641 },
642 "Wembley": {
643 Name: "Wembley",
644 Keys: map[string]string{
645 "arch": "arm",
646 "model": "Wembley",
647 "os": "Android",
648 },
649 GPU: "PowerVRGE8320",
650 },
651 "iPadPro": {
652 Name: "iPadPro",
653 Keys: map[string]string{
654 "arch": "arm64",
655 "model": "iPadPro",
656 "os": "iOS",
657 },
658 GPU: "PowerVRGT7800",
659 },
660 "iPhone7": {
661 Name: "iPhone7",
662 Keys: map[string]string{
663 "arch": "arm64",
664 "model": "iPhone7",
665 "os": "iOS",
666 },
667 GPU: "PowerVRGT7600",
668 },
669 "iPhone8": {
670 Name: "iPhone8",
671 Keys: map[string]string{
672 "arch": "arm64",
673 "model": "iPhone8",
674 "os": "iOS",
675 },
676 GPU: "AppleA11",
677 },
678 }