Skip to content

Commit a85c3fb

Browse files
committed
[CIR][CUDA] Support for built-in CUDA surface type
1 parent 7f66a20 commit a85c3fb

File tree

239 files changed

+53349
-0
lines changed

Some content is hidden

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

239 files changed

+53349
-0
lines changed

.ci/generate-buildkite-pipeline-premerge

+141
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
#!/usr/bin/env bash
23
#===----------------------------------------------------------------------===##
34
#
@@ -136,3 +137,143 @@ if [[ "${windows_projects}" != "" ]]; then
136137
- 'bash .ci/monolithic-windows.sh "$(echo ${windows_projects} | tr ' ' ';')" "$(echo ${windows_check_targets})"'
137138
EOF
138139
fi
140+
=======
141+
#!/usr/bin/env bash
142+
#===----------------------------------------------------------------------===##
143+
#
144+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
145+
# See https://llvm.org/LICENSE.txt for license information.
146+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
147+
#
148+
#===----------------------------------------------------------------------===##
149+
150+
#
151+
# This file generates a Buildkite pipeline that triggers the various CI jobs for
152+
# the LLVM project during pre-commit CI.
153+
#
154+
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
155+
#
156+
# As this outputs a yaml file, it's possible to log messages to stderr or
157+
# prefix with "#".
158+
159+
160+
set -eu
161+
set -o pipefail
162+
163+
# Environment variables script works with:
164+
165+
# Set by buildkite
166+
: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:=}
167+
: ${BUILDKITE_COMMIT:=}
168+
: ${BUILDKITE_BRANCH:=}
169+
# Fetch origin to have an up to date merge base for the diff.
170+
git fetch origin
171+
# List of files affected by this commit
172+
: ${MODIFIED_FILES:=$(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)}
173+
# Filter rules for generic windows tests
174+
: ${WINDOWS_AGENTS:='{"queue": "windows"}'}
175+
# Filter rules for generic linux tests
176+
: ${LINUX_AGENTS:='{"queue": "linux"}'}
177+
178+
reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')"
179+
if [[ "${reviewID}" != "" ]]; then
180+
buildMessage="https://llvm.org/${reviewID}"
181+
else
182+
buildMessage="Push to branch ${BUILDKITE_BRANCH}"
183+
fi
184+
185+
cat <<EOF
186+
steps:
187+
EOF
188+
189+
echo "Files modified:" >&2
190+
echo "$MODIFIED_FILES" >&2
191+
modified_dirs=$(echo "$MODIFIED_FILES" | cut -d'/' -f1 | sort -u)
192+
echo "Directories modified:" >&2
193+
echo "$modified_dirs" >&2
194+
195+
. ./.ci/compute-projects.sh
196+
197+
# Project specific pipelines.
198+
199+
# If libc++ or one of the runtimes directories changed.
200+
if echo "$modified_dirs" | grep -q -E "^(libcxx|libcxxabi|libunwind|runtimes|cmake)$"; then
201+
cat <<EOF
202+
- trigger: "libcxx-ci"
203+
build:
204+
message: "${buildMessage}"
205+
commit: "${BUILDKITE_COMMIT}"
206+
branch: "${BUILDKITE_BRANCH}"
207+
EOF
208+
fi
209+
210+
# Generic pipeline for projects that have not defined custom steps.
211+
#
212+
# Individual projects should instead define the pre-commit CI tests that suits their
213+
# needs while letting them run on the infrastructure provided by LLVM.
214+
215+
# Figure out which projects need to be built on each platform
216+
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
217+
modified_projects="$(keep-modified-projects ${all_projects})"
218+
219+
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))
220+
linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
221+
linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
222+
223+
linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
224+
linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
225+
linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
226+
227+
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test 1 ${modified_projects}))
228+
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
229+
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
230+
231+
# Generate the appropriate pipeline
232+
if [[ "${linux_projects}" != "" ]]; then
233+
cat <<EOF
234+
- label: ':linux: Linux x64'
235+
artifact_paths:
236+
- 'artifacts/**/*'
237+
- '*_result.json'
238+
- 'build/test-results.*.xml'
239+
agents: ${LINUX_AGENTS}
240+
retry:
241+
automatic:
242+
- exit_status: -1 # Agent was lost
243+
limit: 2
244+
- exit_status: 255 # Forced agent shutdown
245+
limit: 2
246+
timeout_in_minutes: 120
247+
env:
248+
CC: 'clang'
249+
CXX: 'clang++'
250+
commands:
251+
- './.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"'
252+
EOF
253+
fi
254+
255+
if [[ "${windows_projects}" != "" ]]; then
256+
cat <<EOF
257+
- label: ':windows: Windows x64'
258+
artifact_paths:
259+
- 'artifacts/**/*'
260+
- '*_result.json'
261+
- 'build/test-results.*.xml'
262+
agents: ${WINDOWS_AGENTS}
263+
retry:
264+
automatic:
265+
- exit_status: -1 # Agent was lost
266+
limit: 2
267+
- exit_status: 255 # Forced agent shutdown
268+
limit: 2
269+
timeout_in_minutes: 150
270+
env:
271+
CC: 'cl'
272+
CXX: 'cl'
273+
LD: 'link'
274+
commands:
275+
- 'C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64'
276+
- 'bash .ci/monolithic-windows.sh "$(echo ${windows_projects} | tr ' ' ';')" "$(echo ${windows_check_targets})"'
277+
EOF
278+
fi
279+
>>>>>>> 9a2a7a370a31 ([CIR][CUDA] Support for built-in CUDA surface type)

.ci/monolithic-linux.sh

+148
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
#!/usr/bin/env bash
23
#===----------------------------------------------------------------------===##
34
#
@@ -143,3 +144,150 @@ if [[ "${runtimes}" != "" ]]; then
143144

144145
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
145146
fi
147+
=======
148+
#!/usr/bin/env bash
149+
#===----------------------------------------------------------------------===##
150+
#
151+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
152+
# See https://llvm.org/LICENSE.txt for license information.
153+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
154+
#
155+
#===----------------------------------------------------------------------===##
156+
157+
#
158+
# This script performs a monolithic build of the monorepo and runs the tests of
159+
# most projects on Linux. This should be replaced by per-project scripts that
160+
# run only the relevant tests.
161+
#
162+
163+
set -ex
164+
set -o pipefail
165+
166+
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
167+
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
168+
INSTALL_DIR="${BUILD_DIR}/install"
169+
rm -rf "${BUILD_DIR}"
170+
171+
ccache --zero-stats
172+
173+
if [[ -n "${CLEAR_CACHE:-}" ]]; then
174+
echo "clearing cache"
175+
ccache --clear
176+
fi
177+
178+
function at-exit {
179+
retcode=$?
180+
181+
mkdir -p artifacts
182+
ccache --print-stats > artifacts/ccache_stats.txt
183+
184+
# If building fails there will be no results files.
185+
shopt -s nullglob
186+
if command -v buildkite-agent 2>&1 >/dev/null
187+
then
188+
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
189+
"linux-x64-test-results" $retcode "${BUILD_DIR}"/test-results.*.xml
190+
fi
191+
}
192+
trap at-exit EXIT
193+
194+
projects="${1}"
195+
targets="${2}"
196+
197+
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
198+
199+
echo "--- cmake"
200+
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
201+
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
202+
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
203+
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
204+
-D LLVM_ENABLE_PROJECTS="${projects}" \
205+
-G Ninja \
206+
-D CMAKE_BUILD_TYPE=Release \
207+
-D LLVM_ENABLE_ASSERTIONS=ON \
208+
-D LLVM_BUILD_EXAMPLES=ON \
209+
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
210+
-D LLVM_LIT_ARGS="${lit_args}" \
211+
-D LLVM_ENABLE_LLD=ON \
212+
-D CMAKE_CXX_FLAGS=-gmlt \
213+
-D LLVM_CCACHE_BUILD=ON \
214+
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
215+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
216+
217+
echo "--- ninja"
218+
# Targets are not escaped as they are passed as separate arguments.
219+
ninja -C "${BUILD_DIR}" -k 0 ${targets}
220+
221+
runtimes="${3}"
222+
runtime_targets="${4}"
223+
224+
# Compiling runtimes with just-built Clang and running their tests
225+
# as an additional testing for Clang.
226+
if [[ "${runtimes}" != "" ]]; then
227+
if [[ "${runtime_targets}" == "" ]]; then
228+
echo "Runtimes to build are specified, but targets are not."
229+
exit 1
230+
fi
231+
232+
echo "--- ninja install-clang"
233+
234+
ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
235+
236+
RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
237+
INSTALL_DIR="${BUILD_DIR}/install"
238+
mkdir -p ${RUNTIMES_BUILD_DIR}
239+
240+
echo "--- cmake runtimes C++03"
241+
242+
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
243+
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
244+
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
245+
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
246+
-D LIBCXX_CXX_ABI=libcxxabi \
247+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
248+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
249+
-D LIBCXX_TEST_PARAMS="std=c++03" \
250+
-D LIBCXXABI_TEST_PARAMS="std=c++03" \
251+
-D LLVM_LIT_ARGS="${lit_args}"
252+
253+
echo "--- ninja runtimes C++03"
254+
255+
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
256+
257+
echo "--- cmake runtimes C++26"
258+
259+
rm -rf "${RUNTIMES_BUILD_DIR}"
260+
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
261+
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
262+
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
263+
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
264+
-D LIBCXX_CXX_ABI=libcxxabi \
265+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
266+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
267+
-D LIBCXX_TEST_PARAMS="std=c++26" \
268+
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
269+
-D LLVM_LIT_ARGS="${lit_args}"
270+
271+
echo "--- ninja runtimes C++26"
272+
273+
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
274+
275+
echo "--- cmake runtimes clang modules"
276+
277+
rm -rf "${RUNTIMES_BUILD_DIR}"
278+
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
279+
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
280+
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
281+
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
282+
-D LIBCXX_CXX_ABI=libcxxabi \
283+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
284+
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
285+
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
286+
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
287+
-D LLVM_LIT_ARGS="${lit_args}"
288+
289+
echo "--- ninja runtimes clang modules"
290+
291+
ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
292+
fi
293+
>>>>>>> 9a2a7a370a31 ([CIR][CUDA] Support for built-in CUDA surface type)

.ci/monolithic-windows.sh

+83
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
#!/usr/bin/env bash
23
#===----------------------------------------------------------------------===##
34
#
@@ -78,3 +79,85 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7879
echo "--- ninja"
7980
# Targets are not escaped as they are passed as separate arguments.
8081
ninja -C "${BUILD_DIR}" -k 0 ${targets}
82+
=======
83+
#!/usr/bin/env bash
84+
#===----------------------------------------------------------------------===##
85+
#
86+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
87+
# See https://llvm.org/LICENSE.txt for license information.
88+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
89+
#
90+
#===----------------------------------------------------------------------===##
91+
92+
#
93+
# This script performs a monolithic build of the monorepo and runs the tests of
94+
# most projects on Windows. This should be replaced by per-project scripts that
95+
# run only the relevant tests.
96+
#
97+
98+
set -ex
99+
set -o pipefail
100+
101+
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
102+
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
103+
104+
rm -rf "${BUILD_DIR}"
105+
106+
if [[ -n "${CLEAR_CACHE:-}" ]]; then
107+
echo "clearing sccache"
108+
rm -rf "$SCCACHE_DIR"
109+
fi
110+
111+
sccache --zero-stats
112+
function at-exit {
113+
retcode=$?
114+
115+
mkdir -p artifacts
116+
sccache --show-stats >> artifacts/sccache_stats.txt
117+
118+
# If building fails there will be no results files.
119+
shopt -s nullglob
120+
if command -v buildkite-agent 2>&1 >/dev/null
121+
then
122+
python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
123+
"windows-x64-test-results" $retcode "${BUILD_DIR}"/test-results.*.xml
124+
fi
125+
}
126+
trap at-exit EXIT
127+
128+
projects="${1}"
129+
targets="${2}"
130+
131+
echo "--- cmake"
132+
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
133+
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
134+
135+
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
136+
# on fixing a build reliability issue on the build server, please
137+
# see https://github.com/llvm/llvm-project/pull/82393 and
138+
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
139+
# for further information.
140+
# We limit the number of parallel compile jobs to 24 control memory
141+
# consumption and improve build reliability.
142+
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
143+
-D LLVM_ENABLE_PROJECTS="${projects}" \
144+
-G Ninja \
145+
-D CMAKE_BUILD_TYPE=Release \
146+
-D LLVM_ENABLE_ASSERTIONS=ON \
147+
-D LLVM_BUILD_EXAMPLES=ON \
148+
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
149+
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests" \
150+
-D COMPILER_RT_BUILD_ORC=OFF \
151+
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
152+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
153+
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
154+
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
155+
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
156+
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
157+
-D LLVM_PARALLEL_COMPILE_JOBS=16 \
158+
-D LLVM_PARALLEL_LINK_JOBS=4
159+
160+
echo "--- ninja"
161+
# Targets are not escaped as they are passed as separate arguments.
162+
ninja -C "${BUILD_DIR}" -k 0 ${targets}
163+
>>>>>>> 9a2a7a370a31 ([CIR][CUDA] Support for built-in CUDA surface type)

0 commit comments

Comments
 (0)