@@ -7,6 +7,7 @@ import operator
77import os
88import re
99from collections import defaultdict
10+ from datetime import timedelta
1011from dataclasses import dataclass
1112from functools import reduce
1213from pathlib import Path
@@ -108,38 +109,6 @@ LLVM_BRANCHES = {
108109 LLVM_RELEASE_20 : VersionedBranch (ref = "llvmorg-20.1.8" , version = Version (20 , 1 , 8 )),
109110}
110111
111- # At any given time, Halide has a main branch, which supports (at least)
112- # the LLVM main branch and the most recent release branch (and maybe one older).
113- #
114- # We also support previous release branches; a release branch tracks *only* the
115- # corresponding version of LLVM (i.e., Halide 13 is 'release/13.x' and is only
116- # built/tested against LLVM13, even though it might still work with other LLVM versions).
117- #
118- # Note that we deliberately chose branch names that match LLVM's conventions.
119- #
120- # (Note that there are older releases of Halide that we no longer bother to build/test regularly.)
121-
122- HALIDE_MAIN = "main"
123- HALIDE_RELEASE_21 = "release_21"
124-
125- _HALIDE_RELEASES = [
126- HALIDE_RELEASE_21 ,
127- ]
128-
129- HALIDE_BRANCHES = {
130- HALIDE_MAIN : VersionedBranch (ref = "main" , version = Version (22 , 0 , 0 )),
131- HALIDE_RELEASE_21 : VersionedBranch (ref = "release/21.x" , version = Version (21 , 0 , 0 )),
132- }
133-
134- # Given a halide branch, return the 'native' llvm version we expect to use with it.
135- # For halide release branches, this is the corresponding llvm release branch; for
136- # halide main, it's llvm main.
137- LLVM_FOR_HALIDE = {
138- HALIDE_MAIN : [LLVM_MAIN , LLVM_RELEASE_22 , LLVM_RELEASE_21 , LLVM_RELEASE_20 ],
139- HALIDE_RELEASE_21 : [LLVM_RELEASE_21 ],
140- }
141-
142-
143112# WORKERS
144113
145114# The 'workers' list defines the set of recognized buildworkers. Each element is
@@ -205,7 +174,7 @@ class BuilderType:
205174 setup. (If we ever need to do so, compiler should be added to this.)
206175 """
207176
208- def __init__ (self , arch , bits , os , halide_branch , llvm_branch , sanitizer = None ):
177+ def __init__ (self , arch , bits , os , llvm_branch , sanitizer = None ):
209178 assert arch in ["arm" , "x86" ]
210179 assert bits in [32 , 64 ]
211180 assert os in ["linux" , "windows" , "osx" ]
@@ -214,13 +183,9 @@ class BuilderType:
214183 self .arch = arch
215184 self .bits = bits
216185 self .os = os
217- self .halide_branch = halide_branch
218186 self .llvm_branch = llvm_branch
219187 self .sanitizer = sanitizer
220188
221- assert self .halide_branch , "halide_branch is required"
222- assert self .halide_branch in HALIDE_BRANCHES , f"unknown branch { self .halide_branch } "
223-
224189 if self .sanitizer :
225190 assert self .sanitizer in _SANITIZERS
226191
@@ -305,11 +270,7 @@ class BuilderType:
305270 a = ["halide" ]
306271 if self .sanitizer :
307272 a .append (self .sanitizer )
308- a .append (self .halide_branch )
309- if self .halide_branch == HALIDE_MAIN :
310- # Halide master is built against multiple LLVM versions,
311- # so append that here for clarity
312- a .append (f"llvm_{ LLVM_BRANCHES [self .llvm_branch ].shortversion } " )
273+ a .append (f"llvm_{ LLVM_BRANCHES [self .llvm_branch ].shortversion } " )
313274 a .append (self .halide_target ())
314275 return "-" .join (a )
315276
@@ -343,14 +304,14 @@ def get_install_path(builder_type, *subpaths):
343304 return get_builddir_subpath (os .path .join (s , * subpaths ))
344305
345306
346- def add_get_source_steps (factory , builder_type ):
307+ def add_get_source_steps (factory ):
347308 factory .addStep (
348309 GitHub (
349310 name = "Get Halide source" ,
350311 locks = [performance_lock .access ("counting" )],
351312 workdir = get_source_path (),
352313 repourl = "https://github.com/halide/Halide.git" ,
353- branch = HALIDE_BRANCHES [ builder_type . halide_branch ]. ref ,
314+ branch = "main" ,
354315 mode = "incremental" ,
355316 )
356317 )
@@ -1228,7 +1189,7 @@ def add_test_steps(factory, builder_type):
12281189def create_build_factory (builder_type ):
12291190 factory = BuildFactory ()
12301191 add_env_setup_step (factory , builder_type )
1231- add_get_source_steps (factory , builder_type )
1192+ add_get_source_steps (factory )
12321193 add_create_venv_step (factory , builder_type )
12331194 add_install_llvm_step (factory , builder_type )
12341195 add_build_steps (factory , builder_type )
@@ -1249,7 +1210,7 @@ def get_interesting_targets():
12491210 yield arch , bits , os
12501211
12511212
1252- def create_builder (arch , bits , os , halide_branch , llvm_branch ):
1213+ def create_builder (arch , bits , os , llvm_branch ):
12531214 # Always do a build with no sanitizers
12541215 sanitizers = [None ]
12551216
@@ -1258,7 +1219,7 @@ def create_builder(arch, bits, os, halide_branch, llvm_branch):
12581219 # sanitizers.extend(_SANITIZERS)
12591220
12601221 for san in sanitizers :
1261- builder_type = BuilderType (arch , bits , os , halide_branch , llvm_branch , san )
1222+ builder_type = BuilderType (arch , bits , os , llvm_branch , san )
12621223 if san and not builder_type .handles_sanitizers ():
12631224 continue
12641225
@@ -1275,54 +1236,34 @@ def create_builder(arch, bits, os, halide_branch, llvm_branch):
12751236
12761237
12771238def create_builders ():
1239+ # Create the builders for testing pull requests to main.
12781240 for arch , bits , os in get_interesting_targets ():
1279- # Create the builders for testing pull requests to releases.
1280- for halide_branch in _HALIDE_RELEASES :
1281- for llvm_branch in LLVM_FOR_HALIDE [halide_branch ]:
1282- yield from create_builder (arch , bits , os , halide_branch , llvm_branch )
1283-
1284- # Create the builders for testing pull requests to main.
1285- yield from create_builder (arch , bits , os , HALIDE_MAIN , LLVM_MAIN )
1241+ yield from create_builder (arch , bits , os , LLVM_MAIN )
12861242
12871243 # Test pull requests for Halide master against the current and previous LLVM, for at least one target.
12881244 for llvm_branch in LLVM_BRANCHES :
12891245 if llvm_branch != LLVM_MAIN :
1290- yield from create_builder ("x86" , 64 , "linux" , HALIDE_MAIN , llvm_branch )
1291-
1292-
1293- def create_scheduler (halide_branch ):
1294- def is_base_branch (br ):
1295- return any (br == hl .ref for hl in HALIDE_BRANCHES .values ())
1296-
1297- def is_pr_branch (br ):
1298- # If it's not one of the well-known branches, assume it's a pull request
1299- return not is_base_branch (br )
1300-
1301- def github_base_branch_matches (change ):
1302- ref = change .properties .getProperty ("basename" )
1303- return ref == HALIDE_BRANCHES [halide_branch ].ref
1304-
1305- builders = [b for b in c ["builders" ] if b .builder_type .halide_branch == halide_branch ]
1306- if builders :
1307- # NOT SingleBranchScheduler, because this can process changes from many branches (all PRs)
1308- builder_names = [str (b .name ) for b in builders ]
1309- yield AnyBranchScheduler (
1310- name = "halide-" + halide_branch ,
1311- change_filter = ChangeFilter (category = "pull" , branch_fn = is_pr_branch , filter_fn = github_base_branch_matches ),
1312- treeStableTimer = 60 * 5 , # seconds
1313- builderNames = builder_names ,
1314- )
1315-
1316- yield ForceScheduler (name = "force-halide-" + halide_branch , builderNames = builder_names )
1317-
1318-
1319- def create_schedulers ():
1320- for halide_branch in HALIDE_BRANCHES :
1321- yield from create_scheduler (halide_branch )
1246+ yield from create_builder ("x86" , 64 , "linux" , llvm_branch )
13221247
13231248
13241249c ["builders" ] = list (create_builders ())
1325- c ["schedulers" ] = list (create_schedulers ())
1250+
1251+ c ["schedulers" ] = [
1252+ AnyBranchScheduler (
1253+ name = "halide-main" ,
1254+ change_filter = ChangeFilter (
1255+ category = "pull" ,
1256+ branch_fn = lambda br : br != "main" ,
1257+ filter_fn = lambda ch : ch .properties .getProperty ("basename" ) == "main" ,
1258+ ),
1259+ treeStableTimer = timedelta (minutes = 3 ).total_seconds (),
1260+ builderNames = [b1 .name for b1 in c ["builders" ]],
1261+ ),
1262+ ForceScheduler (
1263+ name = "force-halide-main" ,
1264+ builderNames = [b1 .name for b1 in c ["builders" ]],
1265+ ),
1266+ ]
13261267
13271268
13281269# GitHub pull request filter
0 commit comments