Skip to content

Commit 46f338d

Browse files
authored
Merge branch 'main' into global-fp-trunc-ext
2 parents b200eab + a7d1a65 commit 46f338d

File tree

13,244 files changed

+928668
-280661
lines changed

Some content is hidden

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

13,244 files changed

+928668
-280661
lines changed

.ci/all_requirements.txt

Lines changed: 213 additions & 11 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: 17 additions & 6 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,6 +143,7 @@
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",
@@ -142,7 +152,7 @@
142152
"polly": "check-polly",
143153
}
144154

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

147157
# Meta projects are projects that need explicit handling but do not reside
148158
# in their own top level folder. To add a meta project, the start of the path
@@ -327,6 +337,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
327337
current_platform = platform.system()
328338
if len(sys.argv) == 2:
329339
current_platform = sys.argv[1]
330-
env_variables = get_env_variables(sys.stdin.readlines(), current_platform)
340+
changed_files = [line.strip() for line in sys.stdin.readlines()]
341+
env_variables = get_env_variables(changed_files, current_platform)
331342
for env_variable in env_variables:
332343
print(f"{env_variable}='{env_variables[env_variable]}'")

.ci/compute_projects_test.py

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,14 @@ def test_llvm_windows(self):
4545
env_variables["project_check_targets"],
4646
"check-clang check-clang-tools check-lld check-llvm check-mlir check-polly",
4747
)
48-
self.assertEqual(
49-
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
50-
)
48+
self.assertEqual(env_variables["runtimes_to_build"], "")
5149
self.assertEqual(
5250
env_variables["runtimes_check_targets"],
5351
"",
5452
)
5553
self.assertEqual(
5654
env_variables["runtimes_check_targets_needs_reconfig"],
57-
"check-cxx check-cxxabi check-unwind",
55+
"",
5856
)
5957

6058
def test_llvm_mac(self):
@@ -69,16 +67,14 @@ def test_llvm_mac(self):
6967
env_variables["project_check_targets"],
7068
"check-clang check-clang-tools check-lld check-llvm check-mlir",
7169
)
72-
self.assertEqual(
73-
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
74-
)
70+
self.assertEqual(env_variables["runtimes_to_build"], "")
7571
self.assertEqual(
7672
env_variables["runtimes_check_targets"],
7773
"",
7874
)
7975
self.assertEqual(
8076
env_variables["runtimes_check_targets_needs_reconfig"],
81-
"check-cxx check-cxxabi check-unwind",
77+
"",
8278
)
8379

8480
def test_clang(self):
@@ -87,11 +83,11 @@ def test_clang(self):
8783
)
8884
self.assertEqual(
8985
env_variables["projects_to_build"],
90-
"clang;clang-tools-extra;lld;llvm",
86+
"clang;clang-tools-extra;lld;lldb;llvm",
9187
)
9288
self.assertEqual(
9389
env_variables["project_check_targets"],
94-
"check-clang check-clang-tools",
90+
"check-clang check-clang-tools check-lldb",
9591
)
9692
self.assertEqual(
9793
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
@@ -114,35 +110,59 @@ def test_clang_windows(self):
114110
["clang/CMakeLists.txt"], "Windows"
115111
)
116112
self.assertEqual(
117-
env_variables["projects_to_build"], "clang;clang-tools-extra;llvm"
113+
env_variables["projects_to_build"], "clang;clang-tools-extra;lld;llvm"
118114
)
119115
self.assertEqual(
120116
env_variables["project_check_targets"], "check-clang check-clang-tools"
121117
)
118+
self.assertEqual(env_variables["runtimes_to_build"], "compiler-rt")
122119
self.assertEqual(
123-
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
120+
env_variables["runtimes_check_targets"],
121+
"check-compiler-rt",
124122
)
125123
self.assertEqual(
126-
env_variables["runtimes_check_targets"],
124+
env_variables["runtimes_check_targets_needs_reconfig"],
125+
"",
126+
)
127+
self.assertEqual(env_variables["enable_cir"], "OFF")
128+
129+
def test_compiler_rt(self):
130+
env_variables = compute_projects.get_env_variables(
131+
["compiler-rt/lib/asan/asan_allocator.cpp"], "Linux"
132+
)
133+
self.assertEqual(
134+
env_variables["projects_to_build"],
135+
"clang;lld",
136+
)
137+
self.assertEqual(
138+
env_variables["project_check_targets"],
127139
"",
128140
)
141+
self.assertEqual(env_variables["runtimes_to_build"], "compiler-rt")
142+
self.assertEqual(
143+
env_variables["runtimes_check_targets"],
144+
"check-compiler-rt",
145+
)
129146
self.assertEqual(
130147
env_variables["runtimes_check_targets_needs_reconfig"],
131-
"check-cxx check-cxxabi check-unwind",
148+
"",
149+
)
150+
self.assertEqual(
151+
env_variables["enable_cir"],
152+
"OFF",
132153
)
133-
self.assertEqual(env_variables["enable_cir"], "OFF")
134154

135155
def test_cir(self):
136156
env_variables = compute_projects.get_env_variables(
137157
["clang/lib/CIR/CMakeLists.txt"], "Linux"
138158
)
139159
self.assertEqual(
140160
env_variables["projects_to_build"],
141-
"clang;clang-tools-extra;lld;llvm;mlir",
161+
"clang;clang-tools-extra;lld;lldb;llvm;mlir",
142162
)
143163
self.assertEqual(
144164
env_variables["project_check_targets"],
145-
"check-clang check-clang-cir check-clang-tools",
165+
"check-clang check-clang-cir check-clang-tools check-lldb",
146166
)
147167
self.assertEqual(
148168
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
@@ -196,8 +216,8 @@ def test_flang(self):
196216
)
197217
self.assertEqual(env_variables["projects_to_build"], "clang;flang;llvm")
198218
self.assertEqual(env_variables["project_check_targets"], "check-flang")
199-
self.assertEqual(env_variables["runtimes_to_build"], "")
200-
self.assertEqual(env_variables["runtimes_check_targets"], "")
219+
self.assertEqual(env_variables["runtimes_to_build"], "flang-rt")
220+
self.assertEqual(env_variables["runtimes_check_targets"], "check-flang-rt")
201221
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
202222
self.assertEqual(env_variables["enable_cir"], "OFF")
203223

@@ -273,17 +293,42 @@ def test_ci(self):
273293
)
274294
self.assertEqual(
275295
env_variables["runtimes_to_build"],
276-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
296+
"compiler-rt;flang-rt;libc;libcxx;libcxxabi;libunwind",
277297
)
278298
self.assertEqual(
279299
env_variables["runtimes_check_targets"],
280-
"check-compiler-rt check-libc",
300+
"check-compiler-rt check-flang-rt check-libc",
281301
)
282302
self.assertEqual(
283303
env_variables["runtimes_check_targets_needs_reconfig"],
284304
"check-cxx check-cxxabi check-unwind",
285305
)
286306

307+
def test_windows_ci(self):
308+
env_variables = compute_projects.get_env_variables(
309+
[".ci/compute_projects.py"], "Windows"
310+
)
311+
self.assertEqual(
312+
env_variables["projects_to_build"],
313+
"clang;clang-tools-extra;libclc;lld;llvm;mlir;polly",
314+
)
315+
self.assertEqual(
316+
env_variables["project_check_targets"],
317+
"check-clang check-clang-cir check-clang-tools check-lld check-llvm check-mlir check-polly",
318+
)
319+
self.assertEqual(
320+
env_variables["runtimes_to_build"],
321+
"compiler-rt",
322+
)
323+
self.assertEqual(
324+
env_variables["runtimes_check_targets"],
325+
"check-compiler-rt",
326+
)
327+
self.assertEqual(
328+
env_variables["runtimes_check_targets_needs_reconfig"],
329+
"",
330+
)
331+
287332
def test_lldb(self):
288333
env_variables = compute_projects.get_env_variables(
289334
["lldb/CMakeLists.txt"], "Linux"
@@ -322,11 +367,11 @@ def test_premerge_workflow(self):
322367
)
323368
self.assertEqual(
324369
env_variables["runtimes_to_build"],
325-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
370+
"compiler-rt;flang-rt;libc;libcxx;libcxxabi;libunwind",
326371
)
327372
self.assertEqual(
328373
env_variables["runtimes_check_targets"],
329-
"check-compiler-rt check-libc",
374+
"check-compiler-rt check-flang-rt check-libc",
330375
)
331376
self.assertEqual(
332377
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -357,11 +402,11 @@ def test_third_party_benchmark(self):
357402
)
358403
self.assertEqual(
359404
env_variables["runtimes_to_build"],
360-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
405+
"compiler-rt;flang-rt;libc;libcxx;libcxxabi;libunwind",
361406
)
362407
self.assertEqual(
363408
env_variables["runtimes_check_targets"],
364-
"check-compiler-rt check-libc",
409+
"check-compiler-rt check-flang-rt check-libc",
365410
)
366411
self.assertEqual(
367412
env_variables["runtimes_check_targets_needs_reconfig"],

.ci/generate_test_report_github.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@
44
"""Script to generate a build report for Github."""
55

66
import argparse
7+
import platform
78

89
import generate_test_report_lib
910

11+
PLATFORM_TITLES = {
12+
"Windows": ":window: Windows x64 Test Results",
13+
"Linux": ":penguin: Linux x64 Test Results",
14+
}
15+
1016
if __name__ == "__main__":
1117
parser = argparse.ArgumentParser()
18+
parser.add_argument("return_code", help="The build's return code.", type=int)
1219
parser.add_argument(
13-
"title", help="Title of the test report, without Markdown formatting."
20+
"build_test_logs", help="Paths to JUnit report files and ninja logs.", nargs="*"
1421
)
15-
parser.add_argument("return_code", help="The build's return code.", type=int)
16-
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
1722
args = parser.parse_args()
1823

1924
report = generate_test_report_lib.generate_report_from_files(
20-
args.title, args.return_code, args.junit_files
25+
PLATFORM_TITLES[platform.system()], args.return_code, args.build_test_logs
2126
)
2227

2328
print(report)

0 commit comments

Comments
 (0)