-
Notifications
You must be signed in to change notification settings - Fork 106
LLVM_ENABLE_RUNTIMES=flang-rt for flang-aarch64-out-of-tree #388
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
from zorg.buildbot.commands.CmakeCommand import CmakeCommand | ||
from zorg.buildbot.process.factory import LLVMBuildFactory | ||
from zorg.buildbot.builders.UnifiedTreeBuilder import addNinjaSteps, getCmakeWithNinjaBuildFactory | ||
from buildbot.plugins import util, steps | ||
import os | ||
|
||
def getFlangOutOfTreeBuildFactory( | ||
checks = None, | ||
clean = False, | ||
llvm_extra_configure_args = None, | ||
flang_extra_configure_args = None, | ||
flang_rt_extra_configure_args = None, | ||
env = None, | ||
**kwargs): | ||
|
||
if env is None: | ||
env = dict() | ||
|
||
f = getCmakeWithNinjaBuildFactory( | ||
depends_on_projects=['llvm','clang','mlir','openmp'], | ||
depends_on_projects=['llvm','clang','mlir','openmp','flang','flang-rt'], | ||
enable_projects=['llvm','clang','mlir'], | ||
enable_runtimes=['openmp'], | ||
luporl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
obj_dir="build_llvm", | ||
checks=[], | ||
clean=clean, | ||
|
@@ -25,6 +30,12 @@ def getFlangOutOfTreeBuildFactory( | |
if checks is None: | ||
checks = ['check-all'] | ||
|
||
cleanBuildRequested = ( | ||
lambda step: step.build.getProperty("clean") | ||
or step.build.getProperty("clean_obj") | ||
or clean | ||
) | ||
|
||
# Make a local copy of the flang configure args, as we are going to modify that. | ||
if flang_extra_configure_args: | ||
flang_cmake_args = flang_extra_configure_args[:] | ||
|
@@ -52,6 +63,16 @@ def getFlangOutOfTreeBuildFactory( | |
LLVMBuildFactory.pathRelativeTo(clang_dir, flang_obj_dir)), | ||
]) | ||
|
||
f.addStep( | ||
steps.RemoveDirectory( | ||
name=f"clean-{flang_obj_dir}-dir", | ||
dir=flang_obj_dir, | ||
haltOnFailure=False, | ||
flunkOnFailure=False, | ||
doStepIf=cleanBuildRequested, | ||
) | ||
) | ||
|
||
# We can't use addCmakeSteps as that would use the path in f.llvm_srcdir. | ||
f.addStep(CmakeCommand(name="cmake-configure-flang", | ||
haltOnFailure=True, | ||
|
@@ -71,4 +92,58 @@ def getFlangOutOfTreeBuildFactory( | |
stage_name="flang", | ||
**kwargs) | ||
|
||
## Build Flang-RT as a standalone runtime | ||
flang_rt_obj_dir = "build_flang-rt" | ||
|
||
flang_rt_cmake_args = ["-GNinja"] | ||
if flang_rt_extra_configure_args: | ||
flang_rt_cmake_args += flang_rt_extra_configure_args | ||
|
||
# Use LLVM from the getCmakeWithNinjaBuildFactory step. | ||
flang_rt_cmake_args += [ | ||
util.Interpolate(f"-DLLVM_BINARY_DIR=%(prop:builddir)s/{f.obj_dir}"), | ||
"-DLLVM_ENABLE_RUNTIMES=flang-rt", | ||
] | ||
|
||
# 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", | ||
] | ||
Comment on lines
+108
to
+114
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
||
f.addStep( | ||
steps.RemoveDirectory( | ||
name=f"clean-{flang_rt_obj_dir}-dir", | ||
dir=flang_rt_obj_dir, | ||
haltOnFailure=False, | ||
flunkOnFailure=False, | ||
doStepIf=cleanBuildRequested, | ||
) | ||
) | ||
|
||
f.addStep( | ||
CmakeCommand( | ||
name="cmake-configure-flang-rt", | ||
haltOnFailure=True, | ||
description=["CMake", "configure", "Flang-RT"], | ||
options=flang_rt_cmake_args, | ||
path=LLVMBuildFactory.pathRelativeTo( | ||
os.path.join(f.monorepo_dir, "runtimes"), flang_rt_obj_dir | ||
), | ||
env=env, | ||
workdir=flang_rt_obj_dir, | ||
**kwargs, | ||
) | ||
) | ||
|
||
addNinjaSteps( | ||
f, | ||
obj_dir=flang_rt_obj_dir, | ||
checks=['check-flang-rt'], | ||
DavidSpickett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
env=env, | ||
stage_name="flang-rt", | ||
**kwargs) | ||
|
||
return f |
Uh oh!
There was an error while loading. Please reload this page.