Skip to content

Commit 7f51661

Browse files
authored
Merge branch 'main' into linalg/fix_wrong_assertion
2 parents ae50df9 + 44fbeb3 commit 7f51661

File tree

16,109 files changed

+1083484
-521036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

16,109 files changed

+1083484
-521036
lines changed

.ci/compute_projects.py

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
PROJECT_DEPENDENCIES = {
2020
"llvm": set(),
2121
"clang": {"llvm"},
22+
"CIR": {"clang", "mlir"},
2223
"bolt": {"clang", "lld", "llvm"},
2324
"clang-tools-extra": {"clang", "llvm"},
2425
"compiler-rt": {"clang", "lld"},
@@ -55,6 +56,7 @@
5556
".ci": {
5657
"llvm",
5758
"clang",
59+
"CIR",
5860
"lld",
5961
"lldb",
6062
"bolt",
@@ -78,6 +80,7 @@
7880
"clang": {"compiler-rt"},
7981
"clang-tools-extra": {"libc"},
8082
"libc": {"libc"},
83+
"compiler-rt": {"compiler-rt"},
8184
".ci": {"compiler-rt", "libc"},
8285
}
8386
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
@@ -98,6 +101,9 @@
98101
"libc", # No Windows Support.
99102
"lldb", # TODO(issues/132800): Needs environment setup.
100103
"bolt", # No Windows Support.
104+
"libcxx",
105+
"libcxxabi",
106+
"libunwind",
101107
}
102108

103109
# These are projects that we should test if the project itself is changed but
@@ -116,6 +122,9 @@
116122
"lldb",
117123
"openmp",
118124
"polly",
125+
"libcxx",
126+
"libcxxabi",
127+
"libunwind",
119128
}
120129

121130
PROJECT_CHECK_TARGETS = {
@@ -128,6 +137,7 @@
128137
"lldb": "check-lldb",
129138
"llvm": "check-llvm",
130139
"clang": "check-clang",
140+
"CIR": "check-clang-cir",
131141
"bolt": "check-bolt",
132142
"lld": "check-lld",
133143
"flang": "check-flang",
@@ -141,6 +151,23 @@
141151

142152
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
143153

154+
# Meta projects are projects that need explicit handling but do not reside
155+
# in their own top level folder. To add a meta project, the start of the path
156+
# for the metaproject should be mapped to the name of the project below.
157+
# Multiple paths can map to the same metaproject.
158+
META_PROJECTS = {
159+
("clang", "lib", "CIR"): "CIR",
160+
("clang", "test", "CIR"): "CIR",
161+
("clang", "include", "clang", "CIR"): "CIR",
162+
("*", "docs"): "docs",
163+
("llvm", "utils", "gn"): "gn",
164+
(".github", "workflows", "premerge.yaml"): ".ci",
165+
("third-party",): ".ci",
166+
}
167+
168+
# Projects that should not run any tests. These need to be metaprojects.
169+
SKIP_PROJECTS = ["docs", "gn"]
170+
144171

145172
def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
146173
projects_with_dependents = set(projects)
@@ -233,21 +260,34 @@ def _compute_runtimes_to_build(
233260
return _exclude_projects(runtimes_to_build, platform)
234261

235262

263+
def _path_matches(matcher: tuple[str], file_path: tuple[str]) -> bool:
264+
if len(file_path) < len(matcher):
265+
return False
266+
for match_part, file_part in zip(matcher, file_path):
267+
if match_part == "*" or file_part == "*":
268+
continue
269+
if match_part != file_part:
270+
return False
271+
return True
272+
273+
274+
def _get_modified_projects_for_file(modified_file: str) -> Set[str]:
275+
modified_projects = set()
276+
path_parts = pathlib.Path(modified_file).parts
277+
for meta_project_files in META_PROJECTS.keys():
278+
if _path_matches(meta_project_files, path_parts):
279+
meta_project = META_PROJECTS[meta_project_files]
280+
if meta_project in SKIP_PROJECTS:
281+
return set()
282+
modified_projects.add(meta_project)
283+
modified_projects.add(pathlib.Path(modified_file).parts[0])
284+
return modified_projects
285+
286+
236287
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
237288
modified_projects = set()
238289
for modified_file in modified_files:
239-
path_parts = pathlib.Path(modified_file).parts
240-
# Exclude files in the docs directory. They do not impact an test
241-
# targets and there is a separate workflow used for ensuring the
242-
# documentation builds.
243-
if len(path_parts) > 2 and path_parts[1] == "docs":
244-
continue
245-
# Exclude files for the gn build. We do not test it within premerge
246-
# and changes occur often enough that they otherwise take up
247-
# capacity.
248-
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
249-
continue
250-
modified_projects.add(pathlib.Path(modified_file).parts[0])
290+
modified_projects.update(_get_modified_projects_for_file(modified_file))
251291
return modified_projects
252292

253293

@@ -267,6 +307,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
267307
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
268308
runtimes_to_test_needs_reconfig
269309
)
310+
311+
# CIR is used as a pseudo-project in this script. It is built as part of the
312+
# clang build, but it requires an explicit option to enable. We set that
313+
# option here, and remove it from the projects_to_build list.
314+
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
315+
projects_to_build.discard("CIR")
316+
270317
# We use a semicolon to separate the projects/runtimes as they get passed
271318
# to the CMake invocation and thus we need to use the CMake list separator
272319
# (;). We use spaces to separate the check targets as they end up getting
@@ -279,6 +326,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
279326
"runtimes_check_targets_needs_reconfig": " ".join(
280327
sorted(runtimes_check_targets_needs_reconfig)
281328
),
329+
"enable_cir": enable_cir,
282330
}
283331

284332

0 commit comments

Comments
 (0)