Skip to content

Commit 42e24cf

Browse files
authored
Merge branch 'main' into users/s.barannikov/decoder-operands-7-arm
2 parents bb5577b + 58e6d02 commit 42e24cf

File tree

5,973 files changed

+285004
-193816
lines changed

Some content is hidden

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

5,973 files changed

+285004
-193816
lines changed

.ci/all_requirements.txt

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

.ci/metrics/metrics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ def github_get_metrics(
370370
started_at = job.started_at
371371
completed_at = job.completed_at
372372

373+
if completed_at is None:
374+
logging.info(
375+
f"Workflow {task.id} is marked completed but has a job without a "
376+
"completion timestamp."
377+
)
378+
continue
379+
373380
# GitHub API can return results where the started_at is slightly
374381
# later then the created_at (or completed earlier than started).
375382
# This would cause a -23h59mn delta, which will show up as +24h

.ci/monolithic-linux.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6464

6565
start-group "ninja"
6666

67-
# Targets are not escaped as they are passed as separate arguments.
68-
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
69-
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
67+
if [[ -n "${targets}" ]]; then
68+
# Targets are not escaped as they are passed as separate arguments.
69+
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
70+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
71+
fi
7072

71-
if [[ "${runtime_targets}" != "" ]]; then
73+
if [[ -n "${runtime_targets}" ]]; then
7274
start-group "ninja Runtimes"
7375

7476
ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
@@ -77,7 +79,7 @@ fi
7779

7880
# Compiling runtimes with just-built Clang and running their tests
7981
# as an additional testing for Clang.
80-
if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
82+
if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
8183
start-group "CMake Runtimes C++26"
8284

8385
cmake \

.ci/monolithic-windows.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
5151

5252
start-group "ninja"
5353

54-
# Targets are not escaped as they are passed as separate arguments.
55-
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
56-
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
54+
if [[ -n "${targets}" ]]; then
55+
# Targets are not escaped as they are passed as separate arguments.
56+
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
57+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
58+
fi
5759

58-
if [[ "${runtime_targets}" != "" ]]; then
60+
if [[ -n "${runtimes_targets}" ]]; then
5961
start-group "ninja runtimes"
6062

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

.ci/premerge_advisor_explain.py

Lines changed: 99 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,91 @@
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+
body = COMMENT_TAG.format(platform=platform.system()) + "\n" + body
43+
comment = {"body": body}
44+
comment_id = get_comment_id(platform.system(), pr)
45+
if comment_id:
46+
comment["id"] = comment_id
47+
return comment
1848

1949

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

51137

52138
if __name__ == "__main__":
53139
parser = argparse.ArgumentParser()
54140
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
141+
parser.add_argument("return_code", help="The build's return code", type=int)
142+
parser.add_argument("github_token", help="Github authentication token", type=str)
143+
parser.add_argument("pr_number", help="The PR number", type=int)
55144
parser.add_argument(
56145
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
57146
)
58147
args = parser.parse_args()
59148

60149
# Skip looking for results on AArch64 for now because the premerge advisor
61150
# service is not available on AWS currently.
62-
if platform.machine() == "arm64":
151+
if platform.machine() == "arm64" or platform.machine() == "aarch64":
63152
sys.exit(0)
64153

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

.ci/premerge_advisor_upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def main(commit_sha, workflow_run_number, build_log_files):
5959

6060
# Skip uploading results on AArch64 for now because the premerge advisor
6161
# service is not available on AWS currently.
62-
if platform.machine() == "arm64":
62+
if platform.machine() == "arm64" or platform.machine() == "aarch64":
6363
sys.exit(0)
6464

6565
main(args.commit_sha, args.workflow_run_number, args.build_log_files)

.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: 9 additions & 8 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 [[ -n "$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
43-
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
47+
if [[ -n "$GITHUB_ACTIONS" ]]; then
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
@@ -58,10 +59,10 @@ trap at-exit EXIT
5859

5960
function start-group {
6061
groupname=$1
61-
if [[ "$GITHUB_ACTIONS" != "" ]]; then
62+
if [[ -n "$GITHUB_ACTIONS" ]]; then
6263
echo "::endgroup"
6364
echo "::group::$groupname"
64-
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
65+
elif [[ -n "$POSTCOMMIT_CI" ]]; then
6566
echo "@@@$STEP@@@"
6667
else
6768
echo "Starting $groupname"
@@ -72,6 +73,6 @@ export PIP_BREAK_SYSTEM_PACKAGES=1
7273
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
7374

7475
# The ARM64 builders run on AWS and don't have access to the GCS cache.
75-
if [[ "$GITHUB_ACTIONS" != "" ]] && [[ "$RUNNER_ARCH" != "ARM64" ]]; then
76+
if [[ -n "$GITHUB_ACTIONS" ]] && [[ "$RUNNER_ARCH" != "ARM64" ]]; then
7677
python .ci/cache_lit_timing_files.py download
7778
fi

.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

0 commit comments

Comments
 (0)