Skip to content

Commit 1a68cb6

Browse files
authored
Merge branch 'main' into hgh/libcxx/nodiscard-native_handle
2 parents ade3d4c + 80ae168 commit 1a68cb6

File tree

4,221 files changed

+150632
-97013
lines changed

Some content is hidden

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

4,221 files changed

+150632
-97013
lines changed

.ci/all_requirements.txt

Lines changed: 192 additions & 2 deletions
Large diffs are not rendered by default.

.ci/monolithic-windows.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ start-group "ninja"
5555
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
5656
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
5757

58-
if [[ "${runtime_targets}" != "" ]]; then
58+
if [[ "${runtimes_targets}" != "" ]]; then
5959
start-group "ninja runtimes"
6060

6161
ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log

.ci/premerge_advisor_explain.py

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,90 @@
44
"""Script for getting explanations from the premerge advisor."""
55

66
import argparse
7-
import os
87
import platform
98
import sys
9+
import json
10+
11+
# TODO(boomanaiden154): Remove the optional call once we can require Python
12+
# 3.10.
13+
from typing import Optional
1014

1115
import requests
16+
import github
17+
import github.PullRequest
1218

1319
import generate_test_report_lib
1420

1521
PREMERGE_ADVISOR_URL = (
1622
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/explain"
1723
)
24+
COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->"
25+
26+
27+
def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> Optional[int]:
28+
platform_comment_tag = COMMENT_TAG.format(platform=platform)
29+
for comment in pr.as_issue().get_comments():
30+
if platform_comment_tag in comment.body:
31+
return comment.id
32+
return None
33+
34+
35+
def get_comment(
36+
github_token: str,
37+
pr_number: int,
38+
body: str,
39+
) -> dict[str, str]:
40+
repo = github.Github(github_token).get_repo("llvm/llvm-project")
41+
pr = repo.get_issue(pr_number).as_pull_request()
42+
comment = {"body": body}
43+
comment_id = get_comment_id(platform.system(), pr)
44+
if comment_id:
45+
comment["id"] = comment_id
46+
return comment
1847

1948

20-
def main(commit_sha: str, build_log_files: list[str]):
49+
def main(
50+
commit_sha: str,
51+
build_log_files: list[str],
52+
github_token: str,
53+
pr_number: int,
54+
return_code: int,
55+
):
56+
"""The main entrypoint for the script.
57+
58+
This function parses failures from files, requests information from the
59+
premerge advisor, and may write a Github comment depending upon the output.
60+
There are four different scenarios:
61+
1. There has never been a previous failure and the job passes - We do not
62+
create a comment. We write out an empty file to the comment path so the
63+
issue-write workflow knows not to create anything.
64+
2. There has never been a previous failure and the job fails - We create a
65+
new comment containing the failure information and any possible premerge
66+
advisor findings.
67+
3. There has been a previous failure and the job passes - We update the
68+
existing comment by passing its ID and a passed message to the
69+
issue-write workflow.
70+
4. There has been a previous failure and the job fails - We update the
71+
existing comment in the same manner as above, but generate the comment
72+
as if we have a failure.
73+
74+
Args:
75+
commit_sha: The base commit SHA for this PR run.
76+
build_log_files: The list of JUnit XML files and ninja logs.
77+
github_token: The token to use to access the Github API.
78+
pr_number: The number of the PR associated with this run.
79+
return_code: The numerical return code of ninja/CMake.
80+
"""
81+
if return_code == 0:
82+
with open("comment", "w") as comment_file_handle:
83+
comment = get_comment(
84+
github_token,
85+
pr_number,
86+
":white_check_mark: With the latest revision this PR passed "
87+
"the premerge checks.",
88+
)
89+
if "id" in comment:
90+
json.dump([comment], comment_file_handle)
2191
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
2292
build_log_files
2393
)
@@ -45,13 +115,31 @@ def main(commit_sha: str, build_log_files: list[str]):
45115
)
46116
if advisor_response.status_code == 200:
47117
print(advisor_response.json())
118+
comments = [
119+
get_comment(
120+
github_token,
121+
pr_number,
122+
generate_test_report_lib.generate_report(
123+
generate_test_report_lib.compute_platform_title(),
124+
return_code,
125+
junit_objects,
126+
ninja_logs,
127+
failure_explanations_list=advisor_response.json(),
128+
),
129+
)
130+
]
131+
with open("comment", "w") as comment_file_handle:
132+
json.dump(comments, comment_file_handle)
48133
else:
49134
print(advisor_response.reason)
50135

51136

52137
if __name__ == "__main__":
53138
parser = argparse.ArgumentParser()
54139
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
140+
parser.add_argument("return_code", help="The build's return code", type=int)
141+
parser.add_argument("github_token", help="Github authentication token", type=str)
142+
parser.add_argument("pr_number", help="The PR number", type=int)
55143
parser.add_argument(
56144
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
57145
)
@@ -62,4 +150,10 @@ def main(commit_sha: str, build_log_files: list[str]):
62150
if platform.machine() == "arm64":
63151
sys.exit(0)
64152

65-
main(args.commit_sha, args.build_log_files)
153+
main(
154+
args.commit_sha,
155+
args.build_log_files,
156+
args.github_token,
157+
args.pr_number,
158+
args.return_code,
159+
)

.ci/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
junitparser==3.2.0
22
google-cloud-storage==3.3.0
3+
PyGithub==2.8.1

.ci/utils.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ function at-exit {
3333
# If building fails there will be no results files.
3434
shopt -s nullglob
3535

36-
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
36+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
3737
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
40+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
41+
$(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \
42+
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
43+
"${MONOREPO_ROOT}"/ninja*.log
4044
fi
4145

4246
if [[ "$retcode" != "0" ]]; then
4347
if [[ "$GITHUB_ACTIONS" != "" ]]; then
44-
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
45-
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
46-
"${MONOREPO_ROOT}"/ninja*.log
4748
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
4849
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
4950
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
HeaderFilterRegex: ''
12
Checks: >
23
-*,
34
clang-diagnostic-*,

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@
6060
/mlir/lib/Conversion/*ToROCDL @krzysz00 @kuhar
6161
/mlir/include/mlir/Dialect/LLVMIR/ROCDL* @krzysz00 @kuhar
6262

63+
# XeGPU and XeVM dialects in MLIR.
64+
/mlir/include/mlir/Dialect/XeGPU @charithaintc @Jianhui-Li
65+
/mlir/lib/Dialect/XeGPU @charithaintc @Jianhui-Li
66+
/mlir/lib/Conversion/*XeGPU* @charithaintc @Jianhui-Li
67+
/mlir/include/mlir/Dialect/XeGPU/Transforms @charithaintc @Jianhui-Li
68+
/mlir/lib/Dialect/XeGPU/Transforms @charithaintc @Jianhui-Li
69+
/mlir/include/mlir/Dialect/LLVMIR/XeVM* @silee2
70+
/mlir/lib/Dialect/LLVMIR/IR/XeVM @silee2
71+
/mlir/lib/Conversion/*XeVM* @silee2
72+
6373
# Bufferization Dialect in MLIR.
6474
/mlir/include/mlir/Dialect/Bufferization @matthias-springer
6575
/mlir/lib/Dialect/Bufferization @matthias-springer

.github/workflows/bazel-checks.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ jobs:
3333
3434
bazel-build:
3535
name: "Bazel Build/Test"
36-
runs-on: llvm-premerge-linux-runners
36+
# Only run on US Central workers so we only have to keep one cache warm as
37+
# the cache buckets are per cluster.
38+
runs-on:
39+
group: llvm-premerge-cluster-us-central
40+
labels: llvm-premerge-linux-runners
3741
if: github.repository == 'llvm/llvm-project'
3842
steps:
3943
- name: Fetch LLVM sources
@@ -44,12 +48,14 @@ jobs:
4448
- name: Setup System Dependencies
4549
run: |
4650
sudo apt-get update
47-
sudo apt-get install -y libmpfr-dev libpfm4-dev
51+
sudo apt-get install -y libmpfr-dev libpfm4-dev m4 libedit-dev
4852
sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb > /tmp/bazelisk.deb
4953
sudo apt-get install -y /tmp/bazelisk.deb
5054
rm /tmp/bazelisk.deb
5155
- name: Build/Test
5256
working-directory: utils/bazel
5357
run: |
5458
bazelisk test --config=ci --sandbox_base="" \
55-
@llvm-project//llvm/unittests:adt_tests
59+
--remote_cache=https://storage.googleapis.com/$CACHE_GCS_BUCKET-bazel \
60+
--google_default_credentials \
61+
@llvm-project//... //...

.github/workflows/build-ci-container-tooling.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
test-command: 'cd $HOME && clang-format --version | grep version && git-clang-format -h | grep usage && black --version | grep black'
3737
- container-name: lint
3838
test-command: 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
39+
- container-name: abi-tests
40+
test-command: 'cd $HOME && abi-compliance-checker --help'
41+
target: abi-tests
3942
steps:
4043
- name: Checkout LLVM
4144
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -52,7 +55,7 @@ jobs:
5255
with:
5356
container-name: ci-ubuntu-24.04-${{ matrix.container-name }}
5457
dockerfile: .github/workflows/containers/github-action-ci-tooling/Dockerfile
55-
target: ci-container-code-${{ matrix.container-name }}
58+
target: ci-container-${{ matrix.target || format('code-{0}', matrix.container-name) }}
5659
test-command: ${{ matrix.test-command }}
5760

5861
push-ci-container:

.github/workflows/build-ci-container-windows.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- build-ci-container-windows
5757
permissions:
5858
packages: write
59-
runs-on: windows-2022
59+
runs-on: ubuntu-24.04
6060
env:
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
steps:
@@ -66,8 +66,12 @@ jobs:
6666
name: container
6767
- name: Push Container
6868
run: |
69-
docker load -i ${{ needs.build-ci-container-windows.outputs.container-filename }}
70-
docker tag ${{ needs.build-ci-container-windows.outputs.container-name-tag }} ${{ needs.build-ci-container-windows.outputs.container-name }}:latest
71-
docker login -u ${{ github.actor }} -p $env:GITHUB_TOKEN ghcr.io
72-
docker push ${{ needs.build-ci-container-windows.outputs.container-name-tag }}
73-
docker push ${{ needs.build-ci-container-windows.outputs.container-name }}:latest
69+
sudo apt-get update
70+
sudo apt-get install -y skopeo
71+
skopeo login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
72+
skopeo copy docker-archive:${{ needs.build-ci-container-windows.outputs.container-filename }} \
73+
--dest-compress-format zstd \
74+
docker://${{ needs.build-ci-container-windows.outputs.container-name-tag }}
75+
skopeo copy docker-archive:${{ needs.build-ci-container-windows.outputs.container-filename }} \
76+
--dest-compress-format zstd \
77+
docker://${{ needs.build-ci-container-windows.outputs.container-name }}:latest

0 commit comments

Comments
 (0)