Skip to content

Commit 336c8da

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into upstream
2 parents 46798de + 17df762 commit 336c8da

File tree

4,915 files changed

+200976
-101983
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,915 files changed

+200976
-101983
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ if [[ "${windows_projects}" != "" ]]; then
128128
limit: 2
129129
timeout_in_minutes: 150
130130
env:
131-
CC: 'cl'
132-
CXX: 'cl'
133-
LD: 'link'
131+
MAX_PARALLEL_COMPILE_JOBS: '16'
132+
MAX_PARALLEL_LINK_JOBS: '4'
134133
commands:
135134
- 'C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64'
136135
- 'bash .ci/monolithic-windows.sh "$(echo ${windows_projects} | tr ' ' ';')" "$(echo ${windows_check_targets})"'

.ci/metrics/metrics.py

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -130,34 +130,6 @@ def get_per_workflow_metrics(
130130
workflow_jobs = workflow_run.jobs()
131131
if workflow_jobs.totalCount == 0:
132132
continue
133-
if workflow_jobs.totalCount > 1:
134-
raise ValueError(
135-
f"Encountered an unexpected number of jobs: {workflow_jobs.totalCount}"
136-
)
137-
138-
created_at = workflow_jobs[0].created_at
139-
started_at = workflow_jobs[0].started_at
140-
completed_at = workflow_jobs[0].completed_at
141-
142-
job_result = int(workflow_jobs[0].conclusion == "success")
143-
if job_result:
144-
# We still might want to mark the job as a failure if one of the steps
145-
# failed. This is required due to use setting continue-on-error in
146-
# the premerge pipeline to prevent sending emails while we are
147-
# testing the infrastructure.
148-
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
149-
# longer in a testing state and we can directly assert the workflow
150-
# result.
151-
for step in workflow_jobs[0].steps:
152-
if step.conclusion != "success":
153-
job_result = 0
154-
break
155-
156-
queue_time = started_at - created_at
157-
run_time = completed_at - started_at
158-
159-
if run_time.seconds == 0:
160-
continue
161133

162134
if (
163135
workflows_to_track[workflow_run.name] is None
@@ -170,20 +142,45 @@ def get_per_workflow_metrics(
170142
):
171143
break
172144

173-
# The timestamp associated with the event is expected by Grafana to be
174-
# in nanoseconds.
175-
created_at_ns = int(created_at.timestamp()) * 10**9
176-
177-
workflow_metrics.append(
178-
JobMetrics(
179-
workflow_run.name,
180-
queue_time.seconds,
181-
run_time.seconds,
182-
job_result,
183-
created_at_ns,
184-
workflow_run.id,
145+
for workflow_job in workflow_jobs:
146+
created_at = workflow_job.created_at
147+
started_at = workflow_job.started_at
148+
completed_at = workflow_job.completed_at
149+
150+
job_result = int(workflow_job.conclusion == "success")
151+
if job_result:
152+
# We still might want to mark the job as a failure if one of the steps
153+
# failed. This is required due to use setting continue-on-error in
154+
# the premerge pipeline to prevent sending emails while we are
155+
# testing the infrastructure.
156+
# TODO(boomanaiden154): Remove this once the premerge pipeline is no
157+
# longer in a testing state and we can directly assert the workflow
158+
# result.
159+
for step in workflow_job.steps:
160+
if step.conclusion != "success":
161+
job_result = 0
162+
break
163+
164+
queue_time = started_at - created_at
165+
run_time = completed_at - started_at
166+
167+
if run_time.seconds == 0:
168+
continue
169+
170+
# The timestamp associated with the event is expected by Grafana to be
171+
# in nanoseconds.
172+
created_at_ns = int(created_at.timestamp()) * 10**9
173+
174+
workflow_metrics.append(
175+
JobMetrics(
176+
workflow_run.name + "-" + workflow_job.name,
177+
queue_time.seconds,
178+
run_time.seconds,
179+
job_result,
180+
created_at_ns,
181+
workflow_run.id,
182+
)
185183
)
186-
)
187184

188185
return workflow_metrics
189186

.ci/monolithic-windows.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ echo "--- cmake"
5050
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
5151
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
5252

53+
export CC=cl
54+
export CXX=cl
55+
export LD=link
56+
5357
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
5458
# on fixing a build reliability issue on the build server, please
5559
# see https://github.com/llvm/llvm-project/pull/82393 and
@@ -72,8 +76,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7276
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
7377
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
7478
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
75-
-D LLVM_PARALLEL_COMPILE_JOBS=16 \
76-
-D LLVM_PARALLEL_LINK_JOBS=4
79+
-D LLVM_PARALLEL_COMPILE_JOBS=${MAX_PARALLEL_COMPILE_JOBS} \
80+
-D LLVM_PARALLEL_LINK_JOBS=${MAX_PARALLEL_LINK_JOBS}
7781

7882
echo "--- ninja"
7983
# Targets are not escaped as they are passed as separate arguments.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Agent image for LLVM org cluster.
2+
# .net 4.8 is required by chocolately package manager.
3+
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
4+
5+
# Restore the default Windows shell for correct batch processing.
6+
SHELL ["cmd", "/S", "/C"]
7+
8+
# Download the Build Tools bootstrapper.
9+
ADD https://aka.ms/vs/16/release/vs_buildtools.exe /TEMP/vs_buildtools.exe
10+
11+
RUN powershell -Command Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
12+
13+
# Download channel for fixed install.
14+
ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel
15+
ADD ${CHANNEL_URL} /TEMP/VisualStudio.chman
16+
17+
# Install Build Tools with C++ workload.
18+
# - Documentation for docker installation
19+
# https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019
20+
# - Documentation on workloads
21+
# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019#c-build-tools
22+
# - Documentation on flags
23+
# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2019
24+
RUN /TEMP/vs_buildtools.exe --quiet --wait --norestart --nocache \
25+
--channelUri C:\TEMP\VisualStudio.chman \
26+
--installChannelUri C:\TEMP\VisualStudio.chman \
27+
--installPath C:\BuildTools \
28+
--add Microsoft.VisualStudio.Workload.VCTools \
29+
--add Microsoft.VisualStudio.Component.VC.ATL \
30+
--includeRecommended \
31+
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
32+
33+
# Register DIA dll (Debug Interface Access) so it can be used to symbolize
34+
# the stack traces. Register dll for 32 and 64 bit.
35+
# see https://developercommunity.visualstudio.com/content/problem/290674/msdia140dll-is-not-registered-on-vs2017-hosts.html
36+
37+
RUN regsvr32 /S "C:\BuildTools\DIA SDK\bin\amd64\msdia140.dll" & \
38+
regsvr32 /S "C:\BuildTools\DIA SDK\bin\msdia140.dll"
39+
40+
# install tools as described in https://llvm.org/docs/GettingStartedVS.html
41+
# and a few more that were not documented...
42+
RUN choco install -y ninja git
43+
# Pin an older version of Python; the current Python 3.10 fails when
44+
# doing "pip install" for the other dependencies, as it fails to find libxml
45+
# while compiling some package.
46+
RUN choco install -y python3 --version 3.9.7
47+
48+
# ActivePerl is currently not installable via Chocolatey, see
49+
# http://disq.us/p/2ipditb. Install StrawberryPerl instead. Unfortunately,
50+
# StrawberryPerl not only installs Perl, but also a redundant C/C++ compiler
51+
# toolchain, and a copy of pkg-config which can cause misdetections for other
52+
# built products, see
53+
# https://github.com/StrawberryPerl/Perl-Dist-Strawberry/issues/11 for further
54+
# details. Remove the redundant and unnecessary parts of the StrawberryPerl
55+
# install.
56+
RUN choco install -y strawberryperl && \
57+
rmdir /q /s c:\strawberry\c && \
58+
del /q c:\strawberry\perl\bin\pkg-config*
59+
60+
# libcxx requires clang(-cl) to be available
61+
RUN choco install -y sccache llvm
62+
RUN pip install psutil
63+
64+
RUN curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-x86_64.zip && \
65+
powershell Expand-Archive llvm-mingw-*-ucrt-x86_64.zip -DestinationPath . && \
66+
del llvm-mingw-*-ucrt-x86_64.zip && \
67+
ren llvm-mingw-20230320-ucrt-x86_64 llvm-mingw
68+
69+
# configure Python encoding
70+
ENV PYTHONIOENCODING=UTF-8
71+
72+
# update the path variable
73+
# C:\Program Files\Git\usr\bin contains a usable bash and other unix tools.
74+
# C:\llvm-mingw\bin contains Clang configured for mingw targets and
75+
# corresponding sysroots. Both the 'llvm' package (with Clang defaulting
76+
# to MSVC targets) and this directory contains executables named
77+
# 'clang.exe' - add this last to let the other one have precedence.
78+
# To use these compilers, use the triple prefixed form, e.g.
79+
# x86_64-w64-mingw32-clang.
80+
# C:\buildtools and SDK paths are ones that are set by c:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 -host_arch=amd64
81+
RUN powershell -Command \
82+
[System.Environment]::SetEnvironmentVariable('PATH', \
83+
[System.Environment]::GetEnvironmentVariable('PATH', 'machine') + ';C:\Program Files\Git\usr\bin;C:\llvm-mingw\bin' \
84+
+ ';C:\BuildTools\Common7\IDE\' \
85+
+ ';C:\BuildTools\Common7\IDE\CommonExt ensions\Microsoft\TeamFoundation\Team Explorer' \
86+
+ ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin' \
87+
+ ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja' \
88+
+ ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer' \
89+
+ ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow' \
90+
+ ';C:\BuildTools\Common7\IDE\VC\VCPackages' \
91+
+ ';C:\BuildTools\Common7\Tools\' \
92+
+ ';C:\BuildTools\Common7\Tools\devinit' \
93+
+ ';C:\BuildTools\MSBuild\Current\Bin' \
94+
+ ';C:\BuildTools\MSBuild\Current\bin\Roslyn' \
95+
+ ';C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64' \
96+
+ ';C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\' \
97+
+ ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64' \
98+
+ ';C:\Program Files (x86)\Windows Kits\10\bin\x64' \
99+
+ ';C:\Windows\Microsoft.NET\Framework64\v4.0.30319' \
100+
,'machine')
101+
102+
# support long file names during git checkout
103+
RUN git config --system core.longpaths true & \
104+
git config --global core.autocrlf false
105+
106+
# handle for debugging of files beeing locked by some processes.
107+
RUN choco install -y handle
108+
109+
RUN pip3 install pywin32 buildbot-worker==2.8.4
110+
111+
ARG RUNNER_VERSION=2.322.0
112+
ENV RUNNER_VERSION=$RUNNER_VERSION
113+
114+
RUN powershell -Command \
115+
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v${env:RUNNER_VERSION}/actions-runner-win-x64-${env:RUNNER_VERSION}.zip -OutFile actions-runner-win.zip ; \
116+
Add-Type -AssemblyName System.IO.Compression.FileSystem ; \
117+
[System.IO.Compression.ZipFile]::ExtractToDirectory('actions-runner-win.zip', $PWD) ;\
118+
rm actions-runner-win.zip
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
FROM docker.io/library/ubuntu:22.04 as base
2+
ENV LLVM_SYSROOT=/opt/llvm
3+
4+
FROM base as stage1-toolchain
5+
ENV LLVM_VERSION=19.1.5
6+
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
wget \
10+
gcc \
11+
g++ \
12+
cmake \
13+
ninja-build \
14+
python3 \
15+
git \
16+
curl \
17+
zlib1g-dev
18+
19+
RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz
20+
21+
WORKDIR /llvm-project-llvmorg-$LLVM_VERSION
22+
23+
# Patch to enable better PGO profile data.
24+
# TODO: Remove this for llvm 20
25+
ADD https://github.com/llvm/llvm-project/commit/738250989ce516f02f809bdfde474a039c77e81f.patch .
26+
27+
RUN patch -p1 < 738250989ce516f02f809bdfde474a039c77e81f.patch
28+
29+
RUN cmake -B ./build -G Ninja ./llvm \
30+
-C ./clang/cmake/caches/BOLT-PGO.cmake \
31+
-DBOOTSTRAP_LLVM_ENABLE_LLD=ON \
32+
-DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \
33+
-DPGO_INSTRUMENT_LTO=Thin \
34+
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
35+
-DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \
36+
-DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \
37+
-DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format;scan-build" \
38+
-DCLANG_DEFAULT_LINKER="lld"
39+
40+
RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution
41+
42+
FROM base as ci-container
43+
44+
COPY --from=stage1-toolchain $LLVM_SYSROOT $LLVM_SYSROOT
45+
46+
# Need to install curl for hendrikmuhs/ccache-action
47+
# Need nodejs for some of the GitHub actions.
48+
# Need perl-modules for clang analyzer tests.
49+
# Need git for SPIRV-Tools tests.
50+
RUN apt-get update && \
51+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
52+
binutils \
53+
cmake \
54+
curl \
55+
git \
56+
libstdc++-11-dev \
57+
ninja-build \
58+
nodejs \
59+
perl-modules \
60+
python3-psutil \
61+
sudo \
62+
63+
# These are needed by the premerge pipeline. Pip is used to install
64+
# dependent python packages and ccache is used for build caching. File and
65+
# tzdata are used for tests.
66+
python3-pip \
67+
ccache \
68+
file \
69+
tzdata
70+
71+
# Install sccache as it is needed by most of the project test workflows and
72+
# cannot be installed by the ccache action when executing as a non-root user.
73+
# TODO(boomanaiden154): This should be switched to being installed with apt
74+
# once we bump to Ubuntu 24.04.
75+
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.7.6/sccache-v0.7.6-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
76+
echo "2902a5e44c3342132f07b62e70cca75d9b23252922faf3b924f449808cc1ae58 /tmp/sccache.tar.gz" | sha256sum -c && \
77+
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
78+
rm /tmp/sccache.tar.gz && \
79+
chmod +x /usr/local/bin/sccache
80+
81+
ENV LLVM_SYSROOT=$LLVM_SYSROOT
82+
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
83+
84+
# Create a new user to avoid test failures related to a lack of expected
85+
# permissions issues in some tests. Set the user id to 1001 as that is the
86+
# user id that Github Actions uses to perform the checkout action.
87+
RUN useradd gha -u 1001 -m -s /bin/bash
88+
89+
# Also add the user to passwordless sudoers so that we can install software
90+
# later on without having to rebuild the container.
91+
RUN adduser gha sudo
92+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
93+
94+
USER gha
95+
WORKDIR /home/gha
96+
97+
FROM ci-container as ci-container-agent
98+
99+
ENV GITHUB_RUNNER_VERSION=2.322.0
100+
101+
RUN mkdir actions-runner && \
102+
cd actions-runner && \
103+
curl -O -L https://github.com/actions/runner/releases/download/v$GITHUB_RUNNER_VERSION/actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \
104+
tar xzf ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \
105+
rm ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz
106+

0 commit comments

Comments
 (0)