2929LINUX_CPU_TEST_RUNNER = "linux.2xlarge"
3030# contains 1 gpu
3131LINUX_CUDA_TEST_RUNNER = "linux.4xlarge.nvidia.gpu"
32+ # contains 4 gpus
33+ LINUX_ROCM_TEST_RUNNER = "linux.rocm.gpu"
3234LINUX_RUNNERS = {
3335 LINUX_CPU_TEST_RUNNER ,
3436 LINUX_CUDA_TEST_RUNNER ,
37+ LINUX_ROCM_TEST_RUNNER ,
38+ }
39+
40+ LINUX_DISTRIBUTED_GPU_RUNNERS = {
41+ LINUX_CUDA_TEST_RUNNER : "linux.8xlarge.nvidia.gpu" ,
42+ LINUX_ROCM_TEST_RUNNER : LINUX_ROCM_TEST_RUNNER ,
43+ }
44+
45+ LINUX_MULTIGPU_RUNNERS = {
46+ LINUX_CUDA_TEST_RUNNER : "linux.16xlarge.nvidia.gpu" ,
47+ LINUX_ROCM_TEST_RUNNER : LINUX_ROCM_TEST_RUNNER ,
3548}
3649
3750MACOS_TEST_RUNNER_10_15 = "macos-10.15"
4659 WINDOWS_CUDA_TEST_RUNNER ,
4760 LINUX_CUDA_TEST_RUNNER ,
4861}
62+ ROCM_RUNNERS = {
63+ LINUX_ROCM_TEST_RUNNER ,
64+ }
4965CPU_RUNNERS = {
5066 WINDOWS_CPU_TEST_RUNNER ,
5167 LINUX_CPU_TEST_RUNNER ,
5571LABEL_CIFLOW_BAZEL = "ciflow/bazel"
5672LABEL_CIFLOW_CPU = "ciflow/cpu"
5773LABEL_CIFLOW_CUDA = "ciflow/cuda"
74+ LABEL_CIFLOW_ROCM = "ciflow/rocm"
5875LABEL_CIFLOW_DOCS = "ciflow/docs"
5976LABEL_CIFLOW_DEFAULT = "ciflow/default"
6077LABEL_CIFLOW_LIBTORCH = "ciflow/libtorch"
7693LABEL_CIFLOW_MACOS = "ciflow/macos"
7794LABEL_CIFLOW_TRUNK = "ciflow/trunk"
7895LABEL_CIFLOW_BINARIES = "ciflow/binaries"
79- LABEL_CIFLOW_BINARIES_WHEEL = "ciflow/binaries/wheel "
80- LABEL_CIFLOW_BINARIES_CONDA = "ciflow/binaries/conda "
81- LABEL_CIFLOW_BINARIES_LIBTORCH = "ciflow/binaries/libtorch "
96+ LABEL_CIFLOW_BINARIES_WHEEL = "ciflow/binaries_wheel "
97+ LABEL_CIFLOW_BINARIES_CONDA = "ciflow/binaries_conda "
98+ LABEL_CIFLOW_BINARIES_LIBTORCH = "ciflow/binaries_libtorch "
8299
83100
84101@dataclass
85102class CIFlowConfig :
86103 # For use to enable workflows to run on pytorch/pytorch-canary
87104 run_on_canary : bool = False
88105 labels : Set [str ] = field (default_factory = set )
89- trigger_action : str = 'unassigned'
90- trigger_actor : str = 'pytorchbot'
91- root_job_condition : str = ''
92- label_conditions : str = ''
93106 # Certain jobs might not want to be part of the ciflow/[all,trunk] workflow
94107 isolated_workflow : bool = False
95108
96- def gen_root_job_condition (self ) -> None :
97- # CIFlow conditions:
98- # - Workflow should always run on push
99- # - CIFLOW_DEFAULT workflows should run on PRs even if no `ciflow/` labels on PR
100- # - Otherwise workflow should be scheduled on all qualifying events
101- label_conditions = [f"contains(github.event.pull_request.labels.*.name, '{ label } ')" for label in sorted (self .labels )]
102- self .label_conditions = ' || ' .join (label_conditions )
103- repo_condition = "github.repository_owner == 'pytorch'" if self .run_on_canary else "github.repository == 'pytorch/pytorch'"
104- push_event = "github.event_name == 'push'"
105- scheduled_event = "github.event_name == 'schedule'"
106- pr_updated_event = f"github.event_name == 'pull_request' && github.event.action != '{ self .trigger_action } '"
107- if LABEL_CIFLOW_DEFAULT in self .labels :
108- run_with_no_labels = f"({ pr_updated_event } ) && " \
109- f"!contains(join(github.event.pull_request.labels.*.name), '{ LABEL_CIFLOW_PREFIX } ')"
110- else :
111- run_with_no_labels = "false"
112- self .root_job_condition = f"${{{{ ({ repo_condition } ) && (\n " \
113- f" ({ push_event } ) ||\n " \
114- f" ({ scheduled_event } ) ||\n " \
115- f" ({ self .label_conditions } ) ||\n " \
116- f" ({ run_with_no_labels } ))\n " \
117- f" }}}}"
118-
119- def reset_root_job (self ) -> None :
120- self .root_job_condition = ''
121-
122109 def __post_init__ (self ) -> None :
123110 if not self .isolated_workflow :
124111 self .labels .add (LABEL_CIFLOW_ALL )
125112 if LABEL_CIFLOW_SCHEDULED not in self .labels :
126113 self .labels .add (LABEL_CIFLOW_TRUNK )
127114 assert all (label .startswith (LABEL_CIFLOW_PREFIX ) for label in self .labels )
128- self .gen_root_job_condition ()
129115
130116
131117@dataclass
@@ -164,6 +150,8 @@ class CIWorkflow:
164150
165151 # Optional fields
166152 test_runner_type : str = ''
153+ multigpu_runner_type : str = ''
154+ distributed_gpu_runner_type : str = ''
167155 ciflow_config : CIFlowConfig = field (default_factory = CIFlowConfig )
168156 cuda_version : str = ''
169157 docker_image_base : str = ''
@@ -172,13 +160,15 @@ class CIWorkflow:
172160 build_generates_artifacts : bool = True
173161 build_with_debug : bool = False
174162 is_scheduled : str = ''
163+ is_default : bool = False
175164 num_test_shards : int = 1
176165 only_run_smoke_tests_on_pull_request : bool = False
177166 num_test_shards_on_pull_request : int = - 1
178167 distributed_test : bool = True
179168 fx2trt_test : bool = False
180169 timeout_after : int = 240
181170 xcode_version : str = ''
171+ only_on_pr : bool = False
182172
183173 # The following variables will be set as environment variables,
184174 # so it's easier for both shell and Python scripts to consume it if false is represented as the empty string.
@@ -205,6 +195,12 @@ def __post_init__(self) -> None:
205195 if self .fx2trt_test :
206196 self .enable_fx2trt_test = 1
207197
198+ self .multigpu_runner_type = LINUX_MULTIGPU_RUNNERS .get (self .test_runner_type , "linux.16xlarge.nvidia.gpu" )
199+ self .distributed_gpu_runner_type = LINUX_DISTRIBUTED_GPU_RUNNERS .get (self .test_runner_type , "linux.8xlarge.nvidia.gpu" )
200+
201+ if LABEL_CIFLOW_DEFAULT in self .ciflow_config .labels :
202+ self .is_default = True
203+
208204 # If num_test_shards_on_pull_request is not user-defined, default to num_test_shards unless we are
209205 # only running smoke tests on the pull request.
210206 if self .num_test_shards_on_pull_request == - 1 :
@@ -223,7 +219,6 @@ def assert_valid(self) -> None:
223219 assert self .test_runner_type in WINDOWS_RUNNERS , err_message
224220
225221 assert LABEL_CIFLOW_ALL in self .ciflow_config .labels
226- assert LABEL_CIFLOW_ALL in self .ciflow_config .label_conditions
227222 if self .arch == 'linux' :
228223 assert LABEL_CIFLOW_LINUX in self .ciflow_config .labels
229224 if self .arch == 'windows' :
@@ -235,6 +230,8 @@ def assert_valid(self) -> None:
235230 assert self .test_runner_type != ''
236231 if self .test_runner_type in CUDA_RUNNERS :
237232 assert LABEL_CIFLOW_CUDA in self .ciflow_config .labels
233+ if self .test_runner_type in ROCM_RUNNERS :
234+ assert LABEL_CIFLOW_ROCM in self .ciflow_config .labels
238235 if self .test_runner_type in CPU_RUNNERS and not self .exclude_test :
239236 assert LABEL_CIFLOW_CPU in self .ciflow_config .labels
240237 if self .is_scheduled :
@@ -576,6 +573,17 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
576573 labels = set ([LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_LINUX , LABEL_CIFLOW_CPU ]),
577574 ),
578575 ),
576+ CIWorkflow (
577+ arch = "linux" ,
578+ build_environment = "linux-bionic-rocm4.5-py3.7" ,
579+ docker_image_base = f"{ DOCKER_REGISTRY } /pytorch/pytorch-linux-bionic-rocm4.5-py3.7" ,
580+ test_runner_type = LINUX_ROCM_TEST_RUNNER ,
581+ num_test_shards = 2 ,
582+ only_on_pr = True ,
583+ ciflow_config = CIFlowConfig (
584+ labels = set ([LABEL_CIFLOW_LINUX , LABEL_CIFLOW_ROCM ]),
585+ ),
586+ ),
579587 CIWorkflow (
580588 arch = "linux" ,
581589 build_environment = "libtorch-linux-xenial-cuda11.3-py3.7-gcc7" ,
@@ -619,8 +627,10 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
619627 num_test_shards = 2 ,
620628 distributed_test = False ,
621629 enable_noarch_test = 1 ,
630+ # Disabled, see https://github.com/pytorch/pytorch/issues/71732
631+ # enable_xla_test=1,
622632 ciflow_config = CIFlowConfig (
623- labels = {LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_LINUX , LABEL_CIFLOW_CPU , LABEL_CIFLOW_NOARCH },
633+ labels = {LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_LINUX , LABEL_CIFLOW_CPU , LABEL_CIFLOW_XLA , LABEL_CIFLOW_NOARCH },
624634 ),
625635 ),
626636 CIWorkflow (
@@ -824,8 +834,8 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
824834 DockerWorkflow (
825835 build_environment = "docker-builds" ,
826836 docker_images = sorted (DOCKER_IMAGES ),
827- # Run every Wednesday to ensure they can build
828- is_scheduled = "1 * * * 3" ,
837+ # Run every Wednesday at 3:01am to ensure they can build
838+ is_scheduled = "1 3 * * 3" ,
829839 ),
830840]
831841
@@ -835,7 +845,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
835845 package_type = "manywheel" ,
836846 build_configs = generate_binary_build_matrix .generate_wheels_matrix (),
837847 ciflow_config = CIFlowConfig (
838- labels = {LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_WHEEL },
848+ labels = {LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_WHEEL },
839849 isolated_workflow = True ,
840850 ),
841851 ),
@@ -844,7 +854,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
844854 package_type = "conda" ,
845855 build_configs = generate_binary_build_matrix .generate_conda_matrix (),
846856 ciflow_config = CIFlowConfig (
847- labels = {LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_CONDA },
857+ labels = {LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_CONDA },
848858 isolated_workflow = True ,
849859 ),
850860 ),
@@ -856,7 +866,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
856866 generate_binary_build_matrix .CXX11_ABI
857867 ),
858868 ciflow_config = CIFlowConfig (
859- labels = {LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_LIBTORCH },
869+ labels = {LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_LIBTORCH },
860870 isolated_workflow = True ,
861871 ),
862872 ),
@@ -868,7 +878,7 @@ def generate_workflow_file(self, workflow_template: jinja2.Template) -> None:
868878 generate_binary_build_matrix .PRE_CXX11_ABI
869879 ),
870880 ciflow_config = CIFlowConfig (
871- labels = {LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_LIBTORCH },
881+ labels = {LABEL_CIFLOW_DEFAULT , LABEL_CIFLOW_BINARIES , LABEL_CIFLOW_BINARIES_LIBTORCH },
872882 isolated_workflow = True ,
873883 ),
874884 ),
0 commit comments