Skip to content

Commit 01d3adc

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW39 2025) (#20230)
2 parents c910aed + 90983fd commit 01d3adc

File tree

10,280 files changed

+946909
-263160
lines changed

Some content is hidden

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

10,280 files changed

+946909
-263160
lines changed

.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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"flang",
5050
},
5151
"lld": {"bolt", "cross-project-tests"},
52-
# TODO(issues/132795): LLDB should be enabled on clang changes.
53-
"clang": {"clang-tools-extra", "cross-project-tests"},
52+
"clang": {"clang-tools-extra", "cross-project-tests", "lldb"},
5453
"mlir": {"flang"},
5554
# Test everything if ci scripts are changed.
5655
".ci": {

.ci/compute_projects_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ def test_clang(self):
8383
)
8484
self.assertEqual(
8585
env_variables["projects_to_build"],
86-
"clang;clang-tools-extra;lld;llvm",
86+
"clang;clang-tools-extra;lld;lldb;llvm",
8787
)
8888
self.assertEqual(
8989
env_variables["project_check_targets"],
90-
"check-clang check-clang-tools",
90+
"check-clang check-clang-tools check-lldb",
9191
)
9292
self.assertEqual(
9393
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
@@ -158,11 +158,11 @@ def test_cir(self):
158158
)
159159
self.assertEqual(
160160
env_variables["projects_to_build"],
161-
"clang;clang-tools-extra;lld;llvm;mlir",
161+
"clang;clang-tools-extra;lld;lldb;llvm;mlir",
162162
)
163163
self.assertEqual(
164164
env_variables["project_check_targets"],
165-
"check-clang check-clang-cir check-clang-tools",
165+
"check-clang check-clang-cir check-clang-tools check-lldb",
166166
)
167167
self.assertEqual(
168168
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"

.github/workflows/libclang-python-tests.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ permissions:
44
contents: read
55

66
on:
7-
workflow_dispatch:
87
push:
98
branches:
109
- 'main'
@@ -13,29 +12,46 @@ on:
1312
- 'clang/tools/libclang/**'
1413
- 'clang/CMakeList.txt'
1514
- '.github/workflows/libclang-python-tests.yml'
16-
- '.github/workflows/llvm-project-tests.yml'
1715
pull_request:
1816
paths:
1917
- 'clang/bindings/python/**'
2018
- 'clang/tools/libclang/**'
2119
- 'clang/CMakeList.txt'
2220
- '.github/workflows/libclang-python-tests.yml'
23-
- '.github/workflows/llvm-project-tests.yml'
2421

2522
jobs:
2623
check-clang-python:
2724
# Build libclang and then run the libclang Python binding's unit tests.
25+
# There is an issue running on "windows-2019".
26+
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
2827
name: Build and run Python unit tests
2928
if: github.repository == 'llvm/llvm-project'
29+
runs-on: ubuntu-24.04
3030
strategy:
3131
fail-fast: false
3232
matrix:
3333
python-version: ["3.8", "3.13"]
34-
uses: ./.github/workflows/llvm-project-tests.yml
35-
with:
36-
build_target: check-clang-python
37-
projects: clang
38-
# There is an issue running on "windows-2019".
39-
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
40-
os_list: '["ubuntu-24.04"]'
41-
python_version: ${{ matrix.python-version }}
34+
steps:
35+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
36+
- name: Setup Python
37+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
- name: Setup ccache
41+
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
42+
with:
43+
max-size: 2G
44+
key: spirv-ubuntu-24.04
45+
variant: sccache
46+
- name: Build and Test
47+
run: |
48+
mkdir build
49+
cmake -GNinja \
50+
-S llvm \
51+
-B build \
52+
-DCMAKE_BUILD_TYPE=Release \
53+
-DLLVM_ENABLE_ASSERTIONS=ON \
54+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
55+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
56+
-DLLVM_ENABLE_PROJECTS=clang
57+
ninja -C build check-clang-python

.github/workflows/llvm-project-tests.yml

Lines changed: 0 additions & 149 deletions
This file was deleted.

.github/workflows/llvm-project-workflow-tests.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)