12
12
from examples .models import MODEL_NAME_TO_MODEL
13
13
from examples .recipes .xnnpack_optimization import MODEL_NAME_TO_OPTIONS
14
14
15
- BUILD_TOOLS = [
16
- "buck2" ,
17
- "cmake" ,
18
- ]
19
- DEFAULT_RUNNER = "linux.2xlarge"
20
- RUNNERS = {
21
- # This one runs OOM on smaller runner, the root cause is unclear (T163016365)
22
- "w2l" : "linux.12xlarge" ,
23
- "ic4" : "linux.12xlarge" ,
24
- "resnet50" : "linux.12xlarge" ,
25
- # This one causes timeout on smaller runner, the root cause is unclear (T161064121)
26
- "dl3" : "linux.12xlarge" ,
27
- "emformer_join" : "linux.12xlarge" ,
15
+ # NB: Skip buck2 on MacOS to cut down the number of combinations we
16
+ # need to run there as the number of MacOS runner is limited. Buck2
17
+ # build and test has already been covered on Linux
18
+ BUILD_TOOLS = {
19
+ "buck2" : {"linux" },
20
+ "cmake" : {"linux" , "macos" },
28
21
}
22
+ DEFAULT_RUNNERS = {
23
+ "linux" : "linux.2xlarge" ,
24
+ "macos" : "macos-m1-12" ,
25
+ }
26
+ CUSTOM_RUNNERS = {
27
+ "linux" : {
28
+ # This one runs OOM on smaller runner, the root cause is unclear (T163016365)
29
+ "w2l" : "linux.12xlarge" ,
30
+ "ic4" : "linux.12xlarge" ,
31
+ "resnet50" : "linux.12xlarge" ,
32
+ # This one causes timeout on smaller runner, the root cause is unclear (T161064121)
33
+ "dl3" : "linux.12xlarge" ,
34
+ "emformer_join" : "linux.12xlarge" ,
35
+ }
36
+ }
37
+
38
+
39
+ def parse_args () -> Any :
40
+ from argparse import ArgumentParser
41
+
42
+ parser = ArgumentParser ("Gather all models to test on CI for the target OS" )
43
+ parser .add_argument (
44
+ "--target-os" ,
45
+ type = str ,
46
+ choices = ["linux" , "macos" ],
47
+ default = "linux" ,
48
+ help = "the target OS" ,
49
+ )
50
+ return parser .parse_args ()
29
51
30
52
31
53
def set_output (name : str , val : Any ) -> None :
@@ -45,6 +67,9 @@ def export_models_for_ci() -> None:
45
67
"""
46
68
This gathers all the example models that we want to test on GitHub OSS CI
47
69
"""
70
+ args = parse_args ()
71
+ target_os = args .target_os
72
+
48
73
# This is the JSON syntax for configuration matrix used by GitHub
49
74
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
50
75
models = {"include" : []}
@@ -58,20 +83,31 @@ def export_models_for_ci() -> None:
58
83
name in MODEL_NAME_TO_OPTIONS
59
84
and MODEL_NAME_TO_OPTIONS [name ].xnnpack_delegation ,
60
85
}
61
- for build_tool in BUILD_TOOLS :
86
+ for build_tool in BUILD_TOOLS .keys ():
87
+ if target_os not in BUILD_TOOLS [build_tool ]:
88
+ continue
89
+
62
90
for q_config in quantization_configs :
63
91
for d_config in delegation_configs :
64
- models ["include" ].append (
65
- {
66
- "build-tool" : build_tool ,
67
- "model" : name ,
68
- "xnnpack_quantization" : q_config ,
69
- "xnnpack_delegation" : d_config ,
70
- "runner" : RUNNERS .get (name , DEFAULT_RUNNER ),
71
- # demo_backend_delegation test only supports add_mul model
72
- "demo_backend_delegation" : name == "add_mul" ,
73
- }
74
- )
92
+ record = {
93
+ "build-tool" : build_tool ,
94
+ "model" : name ,
95
+ "xnnpack_quantization" : q_config ,
96
+ "xnnpack_delegation" : d_config ,
97
+ "runner" : DEFAULT_RUNNERS .get (target_os , "linux.2xlarge" ),
98
+ # demo_backend_delegation test only supports add_mul model
99
+ "demo_backend_delegation" : name == "add_mul" ,
100
+ }
101
+
102
+ # NB: Some model requires much bigger Linux runner to avoid
103
+ # running OOM. The team is investigating the root cause
104
+ if target_os in CUSTOM_RUNNERS and name in CUSTOM_RUNNERS .get (
105
+ target_os , {}
106
+ ):
107
+ record ["runner" ] = CUSTOM_RUNNERS [target_os ][name ]
108
+
109
+ models ["include" ].append (record )
110
+
75
111
set_output ("models" , json .dumps (models ))
76
112
77
113
0 commit comments