Skip to content

Commit d4bf656

Browse files
committed
Merge branch 'users/kevinsala/omp-dyn-groupprivate-codegen-pr' into users/kevinsala/omp-dyn-groupprivate-rt-pr
2 parents c698b84 + 3a2fe70 commit d4bf656

File tree

19,313 files changed

+1785217
-575280
lines changed

Some content is hidden

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

19,313 files changed

+1785217
-575280
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: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
from google.api_core import exceptions
21+
22+
GCS_PARALLELISM = 100
23+
24+
25+
def _maybe_upload_timing_file(bucket, timing_file_path):
26+
if os.path.exists(timing_file_path):
27+
timing_file_blob = bucket.blob("lit_timing/" + timing_file_path)
28+
timing_file_blob.upload_from_filename(timing_file_path)
29+
30+
31+
def upload_timing_files(storage_client, bucket_name: str):
32+
bucket = storage_client.bucket(bucket_name)
33+
with multiprocessing.pool.ThreadPool(GCS_PARALLELISM) as thread_pool:
34+
futures = []
35+
for timing_file_path in glob.glob("**/.lit_test_times.txt", recursive=True):
36+
futures.append(
37+
thread_pool.apply_async(
38+
_maybe_upload_timing_file, (bucket, timing_file_path)
39+
)
40+
)
41+
for future in futures:
42+
future.get()
43+
print("Done uploading")
44+
45+
46+
def _maybe_download_timing_file(blob):
47+
file_name = blob.name.removeprefix("lit_timing/")
48+
pathlib.Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True)
49+
blob.download_to_filename(file_name)
50+
51+
52+
def download_timing_files(storage_client, bucket_name: str):
53+
bucket = storage_client.bucket(bucket_name)
54+
try:
55+
blobs = bucket.list_blobs(prefix="lit_timing")
56+
except exceptions.ClientError as client_error:
57+
print(
58+
"::warning file=cache_lit_timing_files.py::Failed to list blobs "
59+
"in bucket."
60+
)
61+
sys.exit(0)
62+
with multiprocessing.pool.ThreadPool(GCS_PARALLELISM) as thread_pool:
63+
futures = []
64+
for timing_file_blob in blobs:
65+
futures.append(
66+
thread_pool.apply_async(
67+
_maybe_download_timing_file, (timing_file_blob,)
68+
)
69+
)
70+
for future in futures:
71+
future.wait()
72+
if not future.successful():
73+
print(
74+
"::warning file=cache_lit_timing_files.py::Failed to "
75+
"download lit timing file."
76+
)
77+
continue
78+
print("Done downloading")
79+
80+
81+
if __name__ == "__main__":
82+
if len(sys.argv) != 2:
83+
logging.fatal("Expected usage is cache_lit_timing_files.py <upload/download>")
84+
sys.exit(1)
85+
action = sys.argv[1]
86+
storage_client = storage.Client()
87+
bucket_name = os.environ["CACHE_GCS_BUCKET"]
88+
if action == "download":
89+
download_timing_files(storage_client, bucket_name)
90+
elif action == "upload":
91+
upload_timing_files(storage_client, bucket_name)
92+
else:
93+
logging.fatal("Expected usage is cache_lit_timing_files.py <upload/download>")
94+
sys.exit(1)

.ci/compute_projects.py

Lines changed: 17 additions & 5 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"},
@@ -80,7 +81,9 @@
8081
"clang-tools-extra": {"libc"},
8182
"libc": {"libc"},
8283
"compiler-rt": {"compiler-rt"},
83-
".ci": {"compiler-rt", "libc"},
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,14 +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.
103105
"libcxx",
104106
"libcxxabi",
105107
"libunwind",
108+
"flang-rt",
106109
}
107110

108111
# These are projects that we should test if the project itself is changed but
@@ -140,15 +143,17 @@
140143
"bolt": "check-bolt",
141144
"lld": "check-lld",
142145
"flang": "check-flang",
146+
"flang-rt": "check-flang-rt",
143147
"libc": "check-libc",
144148
"lld": "check-lld",
145149
"lldb": "check-lldb",
146150
"mlir": "check-mlir",
147151
"openmp": "check-openmp",
148152
"polly": "check-polly",
153+
"lit": "check-lit",
149154
}
150155

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

153158
# Meta projects are projects that need explicit handling but do not reside
154159
# in their own top level folder. To add a meta project, the start of the path
@@ -162,8 +167,12 @@
162167
("llvm", "utils", "gn"): "gn",
163168
(".github", "workflows", "premerge.yaml"): ".ci",
164169
("third-party",): ".ci",
170+
("llvm", "utils", "lit"): "lit",
165171
}
166172

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

@@ -311,7 +320,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
311320
# clang build, but it requires an explicit option to enable. We set that
312321
# option here, and remove it from the projects_to_build list.
313322
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
314-
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)
315326

316327
# We use a semicolon to separate the projects/runtimes as they get passed
317328
# to the CMake invocation and thus we need to use the CMake list separator
@@ -333,6 +344,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
333344
current_platform = platform.system()
334345
if len(sys.argv) == 2:
335346
current_platform = sys.argv[1]
336-
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)
337349
for env_variable in env_variables:
338350
print(f"{env_variable}='{env_variables[env_variable]}'")

.ci/compute_projects_test.py

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ def test_clang_windows(self):
110110
["clang/CMakeLists.txt"], "Windows"
111111
)
112112
self.assertEqual(
113-
env_variables["projects_to_build"], "clang;clang-tools-extra;llvm"
113+
env_variables["projects_to_build"], "clang;clang-tools-extra;lld;llvm"
114114
)
115115
self.assertEqual(
116116
env_variables["project_check_targets"], "check-clang check-clang-tools"
117117
)
118-
self.assertEqual(env_variables["runtimes_to_build"], "")
118+
self.assertEqual(env_variables["runtimes_to_build"], "compiler-rt")
119119
self.assertEqual(
120120
env_variables["runtimes_check_targets"],
121-
"",
121+
"check-compiler-rt",
122122
)
123123
self.assertEqual(
124124
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -216,8 +216,8 @@ def test_flang(self):
216216
)
217217
self.assertEqual(env_variables["projects_to_build"], "clang;flang;llvm")
218218
self.assertEqual(env_variables["project_check_targets"], "check-flang")
219-
self.assertEqual(env_variables["runtimes_to_build"], "")
220-
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")
221221
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
222222
self.assertEqual(env_variables["enable_cir"], "OFF")
223223

@@ -293,11 +293,11 @@ def test_ci(self):
293293
)
294294
self.assertEqual(
295295
env_variables["runtimes_to_build"],
296-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
296+
"compiler-rt;flang-rt;libc;libcxx;libcxxabi;libunwind",
297297
)
298298
self.assertEqual(
299299
env_variables["runtimes_check_targets"],
300-
"check-compiler-rt check-libc",
300+
"check-compiler-rt check-flang-rt check-libc",
301301
)
302302
self.assertEqual(
303303
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -318,11 +318,11 @@ def test_windows_ci(self):
318318
)
319319
self.assertEqual(
320320
env_variables["runtimes_to_build"],
321-
"",
321+
"compiler-rt",
322322
)
323323
self.assertEqual(
324324
env_variables["runtimes_check_targets"],
325-
"",
325+
"check-compiler-rt",
326326
)
327327
self.assertEqual(
328328
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -367,11 +367,11 @@ def test_premerge_workflow(self):
367367
)
368368
self.assertEqual(
369369
env_variables["runtimes_to_build"],
370-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
370+
"compiler-rt;flang-rt;libc;libcxx;libcxxabi;libunwind",
371371
)
372372
self.assertEqual(
373373
env_variables["runtimes_check_targets"],
374-
"check-compiler-rt check-libc",
374+
"check-compiler-rt check-flang-rt check-libc",
375375
)
376376
self.assertEqual(
377377
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -402,11 +402,35 @@ def test_third_party_benchmark(self):
402402
)
403403
self.assertEqual(
404404
env_variables["runtimes_to_build"],
405-
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
405+
"compiler-rt;flang-rt;libc;libcxx;libcxxabi;libunwind",
406406
)
407407
self.assertEqual(
408408
env_variables["runtimes_check_targets"],
409-
"check-compiler-rt check-libc",
409+
"check-compiler-rt check-flang-rt check-libc",
410+
)
411+
self.assertEqual(
412+
env_variables["runtimes_check_targets_needs_reconfig"],
413+
"check-cxx check-cxxabi check-unwind",
414+
)
415+
416+
def test_lit(self):
417+
env_variables = compute_projects.get_env_variables(
418+
["llvm/utils/lit/CMakeLists.txt"], "Linux"
419+
)
420+
self.assertEqual(
421+
env_variables["projects_to_build"],
422+
"bolt;clang;clang-tools-extra;flang;lld;lldb;llvm;mlir;polly",
423+
)
424+
self.assertEqual(
425+
env_variables["project_check_targets"],
426+
"check-bolt check-clang check-clang-tools check-flang check-lit check-lld check-lldb check-llvm check-mlir check-polly",
427+
)
428+
self.assertEqual(
429+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
430+
)
431+
self.assertEqual(
432+
env_variables["runtimes_check_targets"],
433+
"",
410434
)
411435
self.assertEqual(
412436
env_variables["runtimes_check_targets_needs_reconfig"],

.ci/generate_test_report_github.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
import generate_test_report_lib
1010

11-
PLATFORM_TITLES = {
12-
"Windows": ":window: Windows x64 Test Results",
13-
"Linux": ":penguin: Linux x64 Test Results",
14-
}
11+
def compute_platform_title() -> str:
12+
logo = ":window:" if platform.system() == "Windows" else ":penguin:"
13+
# On Linux the machine value is x86_64 on Windows it is AMD64.
14+
if platform.machine() == "x86_64" or platform.machine() == "AMD64":
15+
arch = "x64"
16+
else:
17+
arch = platform.machine()
18+
return f"{logo} {platform.system()} {arch} Test Results"
19+
1520

1621
if __name__ == "__main__":
1722
parser = argparse.ArgumentParser()
@@ -22,7 +27,7 @@
2227
args = parser.parse_args()
2328

2429
report = generate_test_report_lib.generate_report_from_files(
25-
PLATFORM_TITLES[platform.system()], args.return_code, args.build_test_logs
30+
compute_platform_title(), args.return_code, args.build_test_logs
2631
)
2732

2833
print(report)

0 commit comments

Comments
 (0)