Skip to content

Commit 02bb6da

Browse files
authored
Merge branch 'main' into windows-release-build
2 parents d2dcb30 + f3703f3 commit 02bb6da

File tree

21,838 files changed

+1847840
-667936
lines changed

Some content is hidden

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

21,838 files changed

+1847840
-667936
lines changed

.ci/all_requirements.txt

Lines changed: 220 additions & 14 deletions
Large diffs are not rendered by default.

.ci/cache_lit_timing_files.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
"""Caches .lit_test_times.txt files between premerge invocations.
5+
6+
.lit_test_times.txt files are used by lit to order tests to best take advantage
7+
of parallelism. Having them around and up to date can result in a ~15%
8+
improvement in test times. This script downloading cached test time files and
9+
uploading new versions to the GCS buckets used for caching.
10+
"""
11+
12+
import sys
13+
import os
14+
import logging
15+
import multiprocessing.pool
16+
import pathlib
17+
import glob
18+
19+
from google.cloud import storage
20+
21+
GCS_PARALLELISM = 100
22+
23+
24+
def _maybe_upload_timing_file(bucket, timing_file_path):
25+
if os.path.exists(timing_file_path):
26+
timing_file_blob = bucket.blob("lit_timing/" + timing_file_path)
27+
timing_file_blob.upload_from_filename(timing_file_path)
28+
29+
30+
def upload_timing_files(storage_client, bucket_name: str):
31+
bucket = storage_client.bucket(bucket_name)
32+
with multiprocessing.pool.ThreadPool(GCS_PARALLELISM) as thread_pool:
33+
futures = []
34+
for timing_file_path in glob.glob("**/.lit_test_times.txt", recursive=True):
35+
futures.append(
36+
thread_pool.apply_async(
37+
_maybe_upload_timing_file, (bucket, timing_file_path)
38+
)
39+
)
40+
for future in futures:
41+
future.get()
42+
print("Done uploading")
43+
44+
45+
def _maybe_download_timing_file(blob):
46+
file_name = blob.name.removeprefix("lit_timing/")
47+
pathlib.Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True)
48+
blob.download_to_filename(file_name)
49+
50+
51+
def download_timing_files(storage_client, bucket_name: str):
52+
bucket = storage_client.bucket(bucket_name)
53+
blobs = bucket.list_blobs(prefix="lit_timing")
54+
with multiprocessing.pool.ThreadPool(GCS_PARALLELISM) as thread_pool:
55+
futures = []
56+
for timing_file_blob in blobs:
57+
futures.append(
58+
thread_pool.apply_async(
59+
_maybe_download_timing_file, (timing_file_blob,)
60+
)
61+
)
62+
for future in futures:
63+
future.get()
64+
print("Done downloading")
65+
66+
67+
if __name__ == "__main__":
68+
if len(sys.argv) != 2:
69+
logging.fatal("Expected usage is cache_lit_timing_files.py <upload/download>")
70+
sys.exit(1)
71+
action = sys.argv[1]
72+
storage_client = storage.Client()
73+
bucket_name = os.environ["CACHE_GCS_BUCKET"]
74+
if action == "download":
75+
download_timing_files(storage_client, bucket_name)
76+
elif action == "upload":
77+
upload_timing_files(storage_client, bucket_name)
78+
else:
79+
logging.fatal("Expected usage is cache_lit_timing_files.py <upload/download>")
80+
sys.exit(1)

.ci/compute_projects.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"libc": {"clang", "lld"},
2727
"openmp": {"clang", "lld"},
2828
"flang": {"llvm", "clang"},
29+
"flang-rt": {"flang"},
2930
"lldb": {"llvm", "clang"},
3031
"libclc": {"llvm", "clang"},
3132
"lld": {"llvm"},
@@ -49,8 +50,7 @@
4950
"flang",
5051
},
5152
"lld": {"bolt", "cross-project-tests"},
52-
# TODO(issues/132795): LLDB should be enabled on clang changes.
53-
"clang": {"clang-tools-extra", "cross-project-tests"},
53+
"clang": {"clang-tools-extra", "cross-project-tests", "lldb"},
5454
"mlir": {"flang"},
5555
# Test everything if ci scripts are changed.
5656
".ci": {
@@ -80,7 +80,10 @@
8080
"clang": {"compiler-rt"},
8181
"clang-tools-extra": {"libc"},
8282
"libc": {"libc"},
83-
".ci": {"compiler-rt", "libc"},
83+
"compiler-rt": {"compiler-rt"},
84+
"flang": {"flang-rt"},
85+
"flang-rt": {"flang-rt"},
86+
".ci": {"compiler-rt", "libc", "flang-rt"},
8487
}
8588
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
8689
"llvm": {"libcxx", "libcxxabi", "libunwind"},
@@ -95,11 +98,14 @@
9598

9699
EXCLUDE_WINDOWS = {
97100
"cross-project-tests", # TODO(issues/132797): Tests are failing.
98-
"compiler-rt", # TODO(issues/132798): Tests take excessive time.
99101
"openmp", # TODO(issues/132799): Does not detect perl installation.
100102
"libc", # No Windows Support.
101103
"lldb", # TODO(issues/132800): Needs environment setup.
102104
"bolt", # No Windows Support.
105+
"libcxx",
106+
"libcxxabi",
107+
"libunwind",
108+
"flang-rt",
103109
}
104110

105111
# These are projects that we should test if the project itself is changed but
@@ -118,6 +124,9 @@
118124
"lldb",
119125
"openmp",
120126
"polly",
127+
"libcxx",
128+
"libcxxabi",
129+
"libunwind",
121130
}
122131

123132
PROJECT_CHECK_TARGETS = {
@@ -134,15 +143,17 @@
134143
"bolt": "check-bolt",
135144
"lld": "check-lld",
136145
"flang": "check-flang",
146+
"flang-rt": "check-flang-rt",
137147
"libc": "check-libc",
138148
"lld": "check-lld",
139149
"lldb": "check-lldb",
140150
"mlir": "check-mlir",
141151
"openmp": "check-openmp",
142152
"polly": "check-polly",
153+
"lit": "check-lit",
143154
}
144155

145-
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
156+
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc", "flang-rt"}
146157

147158
# Meta projects are projects that need explicit handling but do not reside
148159
# in their own top level folder. To add a meta project, the start of the path
@@ -156,8 +167,12 @@
156167
("llvm", "utils", "gn"): "gn",
157168
(".github", "workflows", "premerge.yaml"): ".ci",
158169
("third-party",): ".ci",
170+
("llvm", "utils", "lit"): "lit",
159171
}
160172

173+
# Projects that should run tests but cannot be explicitly built.
174+
SKIP_BUILD_PROJECTS = ["CIR", "lit"]
175+
161176
# Projects that should not run any tests. These need to be metaprojects.
162177
SKIP_PROJECTS = ["docs", "gn"]
163178

@@ -305,7 +320,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
305320
# clang build, but it requires an explicit option to enable. We set that
306321
# option here, and remove it from the projects_to_build list.
307322
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
308-
projects_to_build.discard("CIR")
323+
# Remove any metaprojects from the list of projects to build.
324+
for project in SKIP_BUILD_PROJECTS:
325+
projects_to_build.discard(project)
309326

310327
# We use a semicolon to separate the projects/runtimes as they get passed
311328
# to the CMake invocation and thus we need to use the CMake list separator
@@ -327,6 +344,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
327344
current_platform = platform.system()
328345
if len(sys.argv) == 2:
329346
current_platform = sys.argv[1]
330-
env_variables = get_env_variables(sys.stdin.readlines(), current_platform)
347+
changed_files = [line.strip() for line in sys.stdin.readlines()]
348+
env_variables = get_env_variables(changed_files, current_platform)
331349
for env_variable in env_variables:
332350
print(f"{env_variable}='{env_variables[env_variable]}'")

0 commit comments

Comments
 (0)