Skip to content

Commit f2d3d6a

Browse files
committed
Merge branch 'main' into eng_136303612_upstream_03_1
2 parents 6e1c2ab + 2b42c6c commit f2d3d6a

File tree

4,176 files changed

+315658
-86840
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,176 files changed

+315658
-86840
lines changed

.ci/monolithic-linux.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ start-group "ninja"
6666

6767
# Targets are not escaped as they are passed as separate arguments.
6868
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
69+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
6970

7071
if [[ "${runtime_targets}" != "" ]]; then
7172
start-group "ninja Runtimes"
7273

7374
ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
75+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
7476
fi
7577

7678
# Compiling runtimes with just-built Clang and running their tests
@@ -87,6 +89,7 @@ if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
8789

8890
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
8991
|& tee ninja_runtimes_needs_reconfig1.log
92+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
9093

9194
start-group "CMake Runtimes Clang Modules"
9295

@@ -99,4 +102,5 @@ if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
99102

100103
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
101104
|& tee ninja_runtimes_needs_reconfig2.log
105+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
102106
fi

.ci/monolithic-windows.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ start-group "ninja"
5555

5656
# Targets are not escaped as they are passed as separate arguments.
5757
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
58+
cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
5859

5960
if [[ "${runtime_targets}" != "" ]]; then
6061
start-group "ninja runtimes"
6162

6263
ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
64+
cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
6365
fi

.ci/premerge_advisor_explain.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
"""Script for getting explanations from the premerge advisor."""
5+
6+
import argparse
7+
import os
8+
import platform
9+
import sys
10+
11+
import requests
12+
13+
import generate_test_report_lib
14+
15+
PREMERGE_ADVISOR_URL = (
16+
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/explain"
17+
)
18+
19+
20+
def main(commit_sha: str, build_log_files: list[str]):
21+
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
22+
build_log_files
23+
)
24+
test_failures = generate_test_report_lib.get_failures(junit_objects)
25+
current_platform = f"{platform.system()}-{platform.machine()}".lower()
26+
explanation_request = {
27+
"base_commit_sha": commit_sha,
28+
"platform": current_platform,
29+
"failures": [],
30+
}
31+
if test_failures:
32+
for _, failures in test_failures.items():
33+
for name, failure_messsage in failures:
34+
explanation_request["failures"].append(
35+
{"name": name, "message": failure_messsage}
36+
)
37+
else:
38+
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
39+
for name, failure_message in ninja_failures:
40+
explanation_request["failures"].append(
41+
{"name": name, "message": failure_message}
42+
)
43+
advisor_response = requests.get(PREMERGE_ADVISOR_URL, json=explanation_request)
44+
if advisor_response.status_code == 200:
45+
print(advisor_response.json())
46+
else:
47+
print(advisor_response.reason)
48+
49+
50+
if __name__ == "__main__":
51+
parser = argparse.ArgumentParser()
52+
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
53+
parser.add_argument(
54+
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
55+
)
56+
args = parser.parse_args()
57+
58+
# Skip looking for results on AArch64 for now because the premerge advisor
59+
# service is not available on AWS currently.
60+
if platform.machine() == "arm64":
61+
sys.exit(0)
62+
63+
main(args.commit_sha, args.build_log_files)

.ci/premerge_advisor_upload.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
"""Script for uploading results to the premerge advisor."""
5+
6+
import argparse
7+
import os
8+
import platform
9+
import sys
10+
11+
import requests
12+
13+
import generate_test_report_lib
14+
15+
PREMERGE_ADVISOR_URL = (
16+
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/upload"
17+
)
18+
19+
20+
def main(commit_sha, workflow_run_number, build_log_files):
21+
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
22+
build_log_files
23+
)
24+
test_failures = generate_test_report_lib.get_failures(junit_objects)
25+
source = "pull_request" if "GITHUB_ACTIONS" in os.environ else "postcommit"
26+
current_platform = f"{platform.system()}-{platform.machine()}".lower()
27+
failure_info = {
28+
"source_type": source,
29+
"base_commit_sha": commit_sha,
30+
"source_id": workflow_run_number,
31+
"failures": [],
32+
"platform": current_platform,
33+
}
34+
if test_failures:
35+
for _, failures in test_failures.items():
36+
for name, failure_message in failures:
37+
failure_info["failures"].append(
38+
{"name": name, "message": failure_message}
39+
)
40+
else:
41+
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
42+
for name, failure_message in ninja_failures:
43+
failure_info["failures"].append({"name": name, "message": failure_message})
44+
requests.post(PREMERGE_ADVISOR_URL, json=failure_info)
45+
46+
47+
if __name__ == "__main__":
48+
parser = argparse.ArgumentParser()
49+
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
50+
parser.add_argument("workflow_run_number", help="The run number from GHA.")
51+
parser.add_argument(
52+
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
53+
)
54+
args = parser.parse_args()
55+
56+
# Skip uploading results on AArch64 for now because the premerge advisor
57+
# service is not available on AWS currently.
58+
if platform.machine() == "arm64":
59+
sys.exit(0)
60+
61+
main(args.commit_sha, args.workflow_run_number, args.build_log_files)

.ci/utils.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function at-exit {
2626
mkdir -p artifacts
2727
sccache --show-stats
2828
sccache --show-stats >> artifacts/sccache_stats.txt
29-
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
29+
cp "${MONOREPO_ROOT}"/*.ninja_log artifacts/ || :
3030
cp "${MONOREPO_ROOT}"/*.log artifacts/ || :
3131
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
3232

@@ -38,6 +38,17 @@ function at-exit {
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
4040
fi
41+
42+
if [[ "$retcode" != "0" ]]; then
43+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
44+
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
45+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
46+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
47+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
48+
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
49+
"${MONOREPO_ROOT}"/ninja*.log
50+
fi
51+
fi
4152
}
4253
trap at-exit EXIT
4354

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
/mlir/include/mlir/Interfaces/DestinationStyleOpInterface.* @matthias-springer
5454
/mlir/lib/Interfaces/DestinationStyleOpInterface.* @matthias-springer
5555

56+
# AMDGPU and ROCDL dialects in MLIR.
57+
/mlir/include/mlir/Dialect/AMDGPU @krzysz00 @kuhar
58+
/mlir/lib/Dialect/AMDGPU @krzysz00 @kuhar
59+
/mlir/lib/Conversion/*AMDGPU* @krzysz00 @kuhar
60+
/mlir/lib/Conversion/*ToROCDL @krzysz00 @kuhar
61+
/mlir/include/mlir/Dialect/LLVMIR/ROCDL* @krzysz00 @kuhar
62+
5663
# Bufferization Dialect in MLIR.
5764
/mlir/include/mlir/Dialect/Bufferization @matthias-springer
5865
/mlir/lib/Dialect/Bufferization @matthias-springer
@@ -131,6 +138,7 @@
131138
/mlir/test/python/ @ftynse @makslevental @stellaraccident @rolfmorel
132139
/mlir/python/ @ftynse @makslevental @stellaraccident @rolfmorel
133140
/mlir/lib/Bindings/Python @makslevental @rolfmorel
141+
/mlir/include/Bindings/Python @makslevental @rolfmorel
134142

135143
# MLIR Mem2Reg/SROA
136144
/mlir/**/Transforms/Mem2Reg.* @moxinilian

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
ARG LLVM_VERSION=21.1.0
2+
# FIXME: Use "${LLVM_VERSION%%.*}" instead of "LLVM_VERSION_MAJOR" once we update runners to Ubuntu-26.04 with Buildah >= 1.37
3+
ARG LLVM_VERSION_MAJOR=21
24

35
FROM docker.io/library/ubuntu:24.04 AS llvm-downloader
46
ARG LLVM_VERSION
7+
ARG LLVM_VERSION_MAJOR
58

69
RUN apt-get update && \
710
apt-get install -y wget xz-utils && \
811
wget -O llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/LLVM-${LLVM_VERSION}-Linux-X64.tar.xz && \
912
mkdir -p /llvm-extract && \
1013
tar -xvJf llvm.tar.xz -C /llvm-extract \
1114
# Only unpack these tools to save space on Github runner.
15+
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
16+
LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
1217
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
1318
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
1419
LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format && \
@@ -50,12 +55,27 @@ RUN pip install -r requirements_formatting.txt --break-system-packages && \
5055

5156
FROM base AS ci-container-code-lint
5257
ARG LLVM_VERSION
58+
ARG LLVM_VERSION_MAJOR
5359

54-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy ${LLVM_SYSROOT}/bin/
60+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
61+
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
62+
${LLVM_SYSROOT}/bin/
63+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
64+
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
5565
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
5666

67+
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
68+
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
69+
5770
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
5871

72+
RUN apt-get update && \
73+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
74+
cmake \
75+
ninja-build && \
76+
apt-get clean && \
77+
rm -rf /var/lib/apt/lists/*
78+
5979
# Install dependencies for 'pr-code-lint.yml' job
6080
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
6181
RUN pip install -r requirements_linting.txt --break-system-packages && \

.github/workflows/libcxx-run-benchmarks.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,21 @@ jobs:
6464
path: repo # Avoid nuking the workspace, where we have the Python virtualenv
6565

6666
- name: Run baseline
67+
env:
68+
BENCHMARKS: ${{ steps.vars.outputs.benchmarks }}
6769
run: |
6870
source .venv/bin/activate && cd repo
6971
python -m pip install -r libcxx/utils/requirements.txt
7072
baseline_commit=$(git merge-base ${{ steps.vars.outputs.pr_base }} ${{ steps.vars.outputs.pr_head }})
71-
./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${{ steps.vars.outputs.benchmarks }}
73+
./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed "$BENCHMARKS"
7274
./libcxx/utils/consolidate-benchmarks build/baseline | tee baseline.lnt
7375
7476
- name: Run candidate
77+
env:
78+
BENCHMARKS: ${{ steps.vars.outputs.benchmarks }}
7579
run: |
7680
source .venv/bin/activate && cd repo
77-
./libcxx/utils/test-at-commit --commit ${{ steps.vars.outputs.pr_head }} -B build/candidate -- -sv -j1 --param optimization=speed ${{ steps.vars.outputs.benchmarks }}
81+
./libcxx/utils/test-at-commit --commit ${{ steps.vars.outputs.pr_head }} -B build/candidate -- -sv -j1 --param optimization=speed "$BENCHMARKS"
7882
./libcxx/utils/consolidate-benchmarks build/candidate | tee candidate.lnt
7983
8084
- name: Compare baseline and candidate runs

.github/workflows/pr-code-lint.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run:
2121
shell: bash
2222
container:
23-
image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
23+
image: 'ghcr.io/llvm/ci-ubuntu-24.04-lint'
2424
timeout-minutes: 60
2525
concurrency:
2626
group: ${{ github.workflow }}-${{ github.ref }}
@@ -31,6 +31,11 @@ jobs:
3131
with:
3232
fetch-depth: 2
3333

34+
# FIXME: same as in ".github/workflows/pr-code-format.yml"
35+
- name: Set Safe Directory
36+
run: |
37+
chown -R root $(pwd)
38+
3439
- name: Get changed files
3540
id: changed-files
3641
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
@@ -46,22 +51,6 @@ jobs:
4651
run: |
4752
echo "Changed files:"
4853
echo "$CHANGED_FILES"
49-
50-
# The clang tidy version should always be upgraded to the first version
51-
# of a release cycle (x.1.0) or the last version of a release cycle, or
52-
# if there have been relevant clang-format backports.
53-
- name: Install clang-tidy
54-
uses: aminya/setup-cpp@a276e6e3d1db9160db5edc458e99a30d3b109949 # v1.7.1
55-
with:
56-
clang-tidy: 21.1.0
57-
58-
- name: Setup Python env
59-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
60-
with:
61-
python-version: '3.13'
62-
63-
- name: Install Python dependencies
64-
run: python3 -m pip install -r llvm/utils/git/requirements_linting.txt
6554
6655
# TODO: create special mapping for 'codegen' targets, for now build predefined set
6756
# TODO: add entrypoint in 'compute_projects.py' that only adds a project and its direct dependencies

.github/workflows/premerge.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
with:
6363
fetch-depth: 2
6464
- name: Build and Test
65+
timeout-minutes: 120
6566
continue-on-error: ${{ runner.arch == 'ARM64' }}
6667
run: |
6768
git config --global --add safe.directory '*'
@@ -149,6 +150,7 @@ jobs:
149150
echo "windows-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
150151
echo "windows-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
151152
- name: Build and Test
153+
timeout-minutes: 180
152154
if: ${{ steps.vars.outputs.windows-projects != '' }}
153155
shell: cmd
154156
run: |
@@ -191,7 +193,7 @@ jobs:
191193
uses: llvm/actions/install-ninja@main
192194
- name: Build and Test
193195
run: |
194-
source <(git diff --name-only HEAD~2..HEAD | python3 .ci/compute_projects.py)
196+
source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
195197
196198
if [[ "${projects_to_build}" == "" ]]; then
197199
echo "No projects to build"

0 commit comments

Comments
 (0)