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

LLVM_ENABLE_RUNTIMES=flang-rt for flang-aarch64-out-of-tree #388

Merged

Conversation

Meinersbur
Copy link
Member

@Meinersbur Meinersbur commented Feb 22, 2025

Make FlangBuilder.getFlangOutOfTreeBuildFactory build the flang-rt runtime as an out-of-tree runtimes build with additional steps.

Fixes some issues with FlangBuilder too:

  • Clears the build directories with the clean_obj flag set. Usually buildbot deletes the build directory whenever a CMakeLists.txt in a depends_on_projects subdirectory changes to get a clean build. Otherwise, an incompatible CMakeCache.txt will carry on forever.
  • Add flang and flang-rt as depends_on_projects. Otherwise, changes in these subdirectories do not trigger a build. Even worse, breaking commits will be attributed to the next commit in llvm/clang/mlir/openmp, as happed in e.g. https://lab.llvm.org/buildbot/#/builders/53/builds/11759 (commit causing failure was llvm/llvm-project@fe8b323)

This PR is not strictly necessary for llvm/llvm-project#124126, it just wouldn't build the runtime anymore.

Affected builders:

  • flang-aarch64-out-of-tree

Affected workers:

  • linaro-flang-aarch64-out-of-tree

Verfied locally on x86_64.

@Meinersbur Meinersbur marked this pull request as ready for review February 25, 2025 09:06
@Meinersbur Meinersbur changed the title Make flang-aarch64-out-of-tree build flang-rt LLVM_ENABLE_RUNTIMES=flang-rt for flang-aarch64-out-of-tree Feb 26, 2025
Copy link
Contributor

@luporl luporl left a comment

Choose a reason for hiding this comment

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

I have tested the changes on AArch64, but manually only, using cmake invocations extracted from these sources. There were no issues in the configure, build and check stages.

Overall the changes look good to me, but as I'm not very familiar with zorg, it would be better if someone else could review this PR too, especially the changes to clean build directories and those around enable_projects.

Comment on lines +108 to +114
# Use the Fortran compiler from the previous step.
flang_rt_cmake_args += [
util.Interpolate(
f"-DCMAKE_Fortran_COMPILER=%(prop:builddir)s/{flang_obj_dir}/bin/flang"
),
"-DCMAKE_Fortran_COMPILER_WORKS=ON",
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we want to use the C/C++ compiler from the previous step too?

Copy link
Member Author

@Meinersbur Meinersbur Mar 5, 2025

Choose a reason for hiding this comment

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

This would be possible, but not necessary. We already many builders that are using the bootstrapping build (which by design use just-built Clang to build the runtime), keeping at least one that also tests compilation with gcc might be a good idea. The other one that explicitly uses gcc, flang-runtime-cuda-gcc, is a bootstrapping build, therefore effectively changed to use Clang to build flang-rt in #393.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that the existing bot does not use the clang from the previous step, so I'm in favour of leaving this as it is just for that reason.

We have other 2 stage bots that enable flang, and I expect most out of tree problems to be found by a single stage build anyway.

Comment on lines +108 to +114
# Use the Fortran compiler from the previous step.
flang_rt_cmake_args += [
util.Interpolate(
f"-DCMAKE_Fortran_COMPILER=%(prop:builddir)s/{flang_obj_dir}/bin/flang"
),
"-DCMAKE_Fortran_COMPILER_WORKS=ON",
]
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that the existing bot does not use the clang from the previous step, so I'm in favour of leaving this as it is just for that reason.

We have other 2 stage bots that enable flang, and I expect most out of tree problems to be found by a single stage build anyway.

Copy link
Contributor

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

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

LGTM

(and thanks for all the effort you've been putting into this!)

@Meinersbur Meinersbur merged commit f754b71 into llvm:main Mar 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants