Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Premerge] Add flang-rt #128678

Merged
merged 20 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .ci/compute-projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ function compute-projects-to-test() {
shift
projects=${@}
for project in ${projects}; do
echo "${project}"
case ${project} in
lld)
for p in bolt cross-project-tests; do
for p in lld bolt cross-project-tests; do
echo $p
done
;;
llvm)
for p in bolt clang clang-tools-extra lld lldb mlir polly; do
for p in llvm bolt clang clang-tools-extra lld lldb mlir polly; do
echo $p
done
# Flang is not stable in Windows CI at the moment
Expand All @@ -36,21 +35,30 @@ function compute-projects-to-test() {
;;
clang)
# lldb is temporarily removed to alleviate Linux pre-commit CI waiting times
for p in clang-tools-extra compiler-rt cross-project-tests; do
for p in clang clang-tools-extra compiler-rt cross-project-tests; do
echo $p
done
;;
clang-tools-extra)
echo libc
for p in clang-tools-extra libc; do
echo $p
done
;;
mlir)
echo mlir
# Flang is not stable in Windows CI at the moment
if [[ $isForWindows == 0 ]]; then
echo flang
fi
;;
flang-rt)
# Flang is not stable in Windows CI at the moment
if [[ $isForWindows == 0 ]]; then
echo flang
fi
;;
*)
# Nothing to do
echo "${project}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this moved?

Copy link
Member Author

@Meinersbur Meinersbur Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the old location, it would always output the project, including "flang-rt". I could have added an if-condition to not print flang-rt, or filter it out afterwards in like in exclude-linux/exclude-windows but that doesn't seem its purpose, or just let it add it to "LLVM_ENABLE_PROJECTS" even though it it ignored there (like "llvm"). I found the best solution is to change the function to let each case decide whether to prints itself, which would also e.g. allow to not print "llvm" at some point.

I tried to avoid modifying https://github.com/llvm/llvm-project/blob/main/.ci/generate-buildkite-pipeline-premerge itself, there are copies of that code, like in https://github.com/llvm/llvm-project/blob/main/.github/workflows/premerge.yaml, but I could not get around changing all_projects.

;;
esac
done
Expand All @@ -65,6 +73,11 @@ function compute-runtimes-to-test() {
echo $p
done
;;
flang)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a patch touches flang-rt and flang, it seems like we might end up with some duplication given the cyclical dependency here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the case. compute-runtimes-to-test receives the aguments to "LLVM_ENABLE_PROJECTS" and prints the arguments to "LLVM_ENABLE_RUNTIMES". There is no function for the reverse direction.

If you one day rewrite the mechanism, consider giving different names to "top-level directory in the repository", "valid argument to LLVM_ENABLE_PROJECTS", and "valid argument to LLVM_ENABLE_RUNTIMES". They are currently all called "projects" in some form.

for p in flang-rt; do
echo $p
done
;;
*)
# Nothing to do
;;
Expand Down
2 changes: 1 addition & 1 deletion .ci/generate-buildkite-pipeline-premerge
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fi
# needs while letting them run on the infrastructure provided by LLVM.

# Figure out which projects need to be built on each platform
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang flang-rt libc libclc lld lldb llvm mlir openmp polly pstl"
modified_projects="$(keep-modified-projects ${all_projects})"

linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))
Expand Down
10 changes: 10 additions & 0 deletions .ci/monolithic-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D CMAKE_CXX_FLAGS=-gmlt \
-D LLVM_CCACHE_BUILD=ON \
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
-D FLANG_ENABLE_FLANG_RT=OFF \
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"

echo "--- ninja"
Expand Down Expand Up @@ -95,6 +96,9 @@ if [[ "${runtimes}" != "" ]]; then
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
-D CMAKE_Fortran_COMPILER_WORKS=ON \
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
-D LIBCXX_CXX_ABI=libcxxabi \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
Expand All @@ -113,6 +117,9 @@ if [[ "${runtimes}" != "" ]]; then
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
-D CMAKE_Fortran_COMPILER_WORKS=ON \
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
-D LIBCXX_CXX_ABI=libcxxabi \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
Expand All @@ -131,6 +138,9 @@ if [[ "${runtimes}" != "" ]]; then
cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
-D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
-D CMAKE_Fortran_COMPILER="${BUILD_DIR}/bin/flang" \
-D CMAKE_Fortran_COMPILER_WORKS=ON \
-D LLVM_BINARY_DIR="${BUILD_DIR}" \
-D LLVM_ENABLE_RUNTIMES="${runtimes}" \
-D LIBCXX_CXX_ABI=libcxxabi \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
Expand Down
2 changes: 1 addition & 1 deletion flang-rt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ $ ninja install

## Configuration Option Reference

Flang-RT has the followign configuration options. This is in
Flang-RT has the following configuration options. This is in
addition to the build options the LLVM_ENABLE_RUNTIMES mechanism and
CMake itself provide.

Expand Down