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

Enable Flang-RT for all Flang builders. #333

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
93 changes: 46 additions & 47 deletions buildbot/osuosl/master/config/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1932,8 +1932,8 @@
'builddir': "offload-runtime-openmp-amdgpu",
'factory' : OpenMPBuilder.getOpenMPCMakeBuildFactory(
clean=True,
enable_runtimes=['openmp', 'offload'],
depends_on_projects=['llvm', 'clang', 'flang', 'lld', 'offload', 'openmp'],
enable_runtimes=['openmp', 'offload', 'flang-rt'],
depends_on_projects=['llvm', 'clang', 'flang', 'flang-rt', 'lld', 'offload', 'openmp'],
extraCmakeArgs=[
"-DCMAKE_BUILD_TYPE=Release",
"-DCLANG_DEFAULT_LINKER=lld",
Expand All @@ -1952,7 +1952,7 @@
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_CFLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_LDLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
],
add_lit_checks=["check-clang", "check-flang", "check-offload"],
add_lit_checks=["check-clang", "check-flang", "check-flang-rt", "check-offload"],
add_openmp_lit_args=["--time-tests", "--timeout 100"],
)},

Expand Down Expand Up @@ -1997,8 +1997,8 @@
'builddir': "openmp-offload-amdgpu-clang-flang",
'factory' : OpenMPBuilder.getOpenMPCMakeBuildFactory(
clean=True,
enable_runtimes=['compiler-rt', 'openmp', 'offload'],
depends_on_projects=['llvm','clang','lld', 'offload', 'openmp', 'mlir', 'flang', 'compiler-rt'],
enable_runtimes=['compiler-rt', 'openmp', 'offload', 'flang-rt'],
depends_on_projects=['llvm','clang','lld', 'offload', 'openmp', 'mlir', 'flang', 'flang-rt', 'compiler-rt'],
extraCmakeArgs=[
"-DCMAKE_BUILD_TYPE=Release",
"-DCLANG_DEFAULT_LINKER=lld",
Expand Down Expand Up @@ -2027,7 +2027,7 @@
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_CFLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_LDLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
],
add_lit_checks=["check-flang", "check-offload"],
add_lit_checks=["check-flang", "check-flang-rt", "check-offload"],
add_openmp_lit_args=["--time-tests", "--timeout 100"],
)},

Expand All @@ -2039,8 +2039,8 @@
'factory' : OpenMPBuilder.getOpenMPCMakeBuildFactory(
clean=True,
test=False, # we have no GPU avail, skip runtime tests
enable_runtimes=['openmp', 'compiler-rt', 'offload'],
depends_on_projects=['llvm','clang', 'flang', 'lld', 'mlir', 'offload', 'openmp', 'compiler-rt'],
enable_runtimes=['openmp', 'compiler-rt', 'offload', 'flang-rt'],
depends_on_projects=['llvm','clang', 'flang', 'flang-rt', 'lld', 'mlir', 'offload', 'openmp', 'compiler-rt'],
extraCmakeArgs=[
"-DCMAKE_BUILD_TYPE=Release",
"-DCLANG_DEFAULT_LINKER=lld",
Expand All @@ -2060,7 +2060,7 @@
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_CFLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_LDLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
],
add_lit_checks=["check-clang", "check-flang", "check-llvm", "check-lld", "check-mlir"],
add_lit_checks=["check-clang", "check-flang", "check-flang-rt", "check-llvm", "check-lld", "check-mlir"],
add_openmp_lit_args=["--time-tests", "--timeout 100"],
)},

Expand All @@ -2071,8 +2071,8 @@
'factory' : OpenMPBuilder.getOpenMPCMakeBuildFactory(
clean=True,
test=True,
enable_runtimes=['openmp', 'compiler-rt', 'offload'],
depends_on_projects=['llvm','clang', 'flang', 'lld', 'mlir', 'offload', 'openmp', 'compiler-rt'],
enable_runtimes=['openmp', 'compiler-rt', 'offload', 'flang-rt'],
depends_on_projects=['llvm','clang', 'flang', 'flang-rt', 'lld', 'mlir', 'offload', 'openmp', 'compiler-rt'],
extraCmakeArgs=[
"-DCMAKE_BUILD_TYPE=Release",
"-DCLANG_DEFAULT_LINKER=lld",
Expand All @@ -2093,7 +2093,7 @@
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_CFLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_LDLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
],
add_lit_checks=["check-clang", "check-flang", "check-llvm", "check-lld", "check-mlir", "check-offload"],
add_lit_checks=["check-clang", "check-flang", "check-flang-rt", "check-llvm", "check-lld", "check-mlir", "check-offload"],
add_openmp_lit_args=["--time-tests", "--timeout 100", "--xfail=affinity/format/proc_bind.c"],
)},

Expand All @@ -2104,8 +2104,8 @@
'factory' : OpenMPBuilder.getOpenMPCMakeBuildFactory(
clean=True,
test=True,
enable_runtimes=['openmp', 'compiler-rt', 'offload'],
depends_on_projects=['llvm','clang', 'flang', 'lld', 'mlir', 'offload', 'openmp', 'compiler-rt'],
enable_runtimes=['openmp', 'compiler-rt', 'offload', 'flang-rt'],
depends_on_projects=['llvm','clang', 'flang', 'flang-rt', 'lld', 'mlir', 'offload', 'openmp', 'compiler-rt'],
extraCmakeArgs=[
"-DCMAKE_BUILD_TYPE=Release",
"-DCLANG_DEFAULT_LINKER=lld",
Expand All @@ -2126,7 +2126,7 @@
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_CFLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
"-DTEST_SUITE_SOLLVEVV_OFFLOADING_LDLAGS=-fopenmp-targets=amdgcn-amd-amdhsa;-Xopenmp-target=amdgcn-amd-amdhsa",
],
add_lit_checks=["check-clang", "check-flang", "check-llvm", "check-lld", "check-mlir", "check-offload"],
add_lit_checks=["check-clang", "check-flang", "check-flang-rt", "check-llvm", "check-lld", "check-mlir", "check-offload"],
add_openmp_lit_args=["--time-tests", "--timeout 100", "--xfail=affinity/format/proc_bind.c"],
)},

Expand Down Expand Up @@ -2319,8 +2319,8 @@
'builddir': "flang-aarch64-dylib",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','openmp'],
checks=['check-flang', 'check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt','openmp'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DLLVM_BUILD_LLVM_DYLIB=ON",
Expand All @@ -2334,8 +2334,8 @@
'builddir': "flang-aarch64-sharedlibs",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','openmp'],
checks=['check-flang', 'check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt','openmp'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DBUILD_SHARED_LIBS=ON",
Expand Down Expand Up @@ -2367,8 +2367,8 @@
'builddir': "flang-aarch64-debug-reverse-iteration",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','openmp'],
checks=['check-flang','check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt','openmp'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DCMAKE_BUILD_TYPE=Debug",
Expand All @@ -2383,8 +2383,8 @@
'builddir': "flang-aarch64-libcxx",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang'],
checks=['check-flang','check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DLLVM_INSTALL_UTILS=ON",
Expand All @@ -2403,8 +2403,8 @@
'builddir': "flang-aarch64-release",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','openmp'],
checks=['check-flang','check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt','openmp'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DCMAKE_BUILD_TYPE=Release",
Expand All @@ -2418,8 +2418,8 @@
'builddir': "flang-aarch64-rel-assert",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','openmp'],
checks=['check-flang','check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt','openmp'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DLLVM_ENABLE_ASSERTIONS=ON",
Expand All @@ -2434,8 +2434,8 @@
'builddir': "flang-aarch64-latest-gcc",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','openmp'],
checks=['check-flang','check-flang-rt'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt','openmp'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=AArch64",
"-DLLVM_INSTALL_UTILS=ON",
Expand All @@ -2451,7 +2451,7 @@
'workernames' : ["alcf-theta-flang"],
'builddir': "flang-x86_64-knl-linux",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
depends_on_projects=['llvm','mlir','clang','flang'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt'],
extra_configure_args=[
"-DLLVM_TARGETS_TO_BUILD=X86",
"-DCMAKE_C_COMPILER=gcc",
Expand All @@ -2467,8 +2467,8 @@
'builddir': 'ppc64le-flang-rhel-clang-build',
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
clean=True,
depends_on_projects=['llvm', 'mlir', 'clang', 'flang','openmp'],
checks=['check-flang'],
depends_on_projects=['llvm', 'mlir', 'clang', 'flang', 'flang-rt', 'openmp'],
checks=['check-flang','check-flang-rt'],
extra_configure_args=[
'-DLLVM_TARGETS_TO_BUILD=PowerPC',
'-DLLVM_INSTALL_UTILS=ON',
Expand All @@ -2490,8 +2490,8 @@
'workernames' : ["minipc-ryzen-win"],
'builddir': "flang-x86_64-windows",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
depends_on_projects=['llvm','mlir','clang','flang'],
checks=['check-flang'],
depends_on_projects=['llvm','mlir','clang','flang','flang-rt'],
checks=['check-flang','check-flang-rt'],
install_dir="flang.install",
extra_configure_args=[
"-DCLANG_ENABLE_STATIC_ANALYZER=OFF",
Expand Down Expand Up @@ -3118,17 +3118,15 @@
'workernames' : ["as-builder-7"],
'builddir': "flang-runtime-cuda-gcc",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
depends_on_projects=["flang"],
depends_on_projects=["flang","flang-rt"],
vvereschaka marked this conversation as resolved.
Show resolved Hide resolved
clean=True,
checks=[],
src_to_build_dir="flang/runtime",
targets=["FortranRuntime"],
extra_configure_args=[
"-DCMAKE_BUILD_TYPE=Release",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DLLVM_ENABLE_ASSERTIONS=ON",
"-DBUILD_SHARED_LIBS=OFF",
"-DFLANG_EXPERIMENTAL_CUDA_RUNTIME=ON",
"-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA",
"-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc",
"-DCMAKE_CXX_COMPILER=/usr/bin/g++",
"-DCMAKE_C_COMPILER=/usr/bin/gcc",
Expand All @@ -3138,7 +3136,7 @@
"-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache",
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
"-DCMAKE_C_COMPILER_LAUNCHER=ccache",
util.Interpolate("-DFLANG_LIBCUDACXX_PATH=%(prop:nv_cccl_root_path)s/libcudacxx"),
util.Interpolate("-DFLANG_RT_LIBCUDACXX_PATH=%(prop:nv_cccl_root_path)s/libcudacxx"),
],
env={
'CCACHE_DIR' : util.Interpolate("%(prop:builddir)s/ccache-db"),
Expand All @@ -3156,7 +3154,7 @@
stages = [
dict(
name = "clang",
depends_on_projects = ["llvm", "clang", "clang-tools-extra", "lld", "openmp"],
depends_on_projects = ["llvm", "clang", "clang-tools-extra", "lld", "openmp", "flang"],
enable_runtimes = ["compiler-rt"],
cmake_definitions = {
"LLVM_CCACHE_BUILD" : "ON",
Expand All @@ -3172,16 +3170,17 @@
),
dict(
name = "flang-runtime",
depends_on_projects = ["flang"],
depends_on_projects = ["flang-rt"],
vvereschaka marked this conversation as resolved.
Show resolved Hide resolved
cmake_definitions = {
"CMAKE_BUILD_TYPE" : "Release",
"CMAKE_C_COMPILER" : util.Interpolate("%(prop:builddir)s/install-clang/bin/clang"),
"CMAKE_CXX_COMPILER" : util.Interpolate("%(prop:builddir)s/install-clang/bin/clang++"),
"FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD" : "host_device",
"FLANG_OMP_DEVICE_ARCHITECTURES" : "sm_50;sm_60;sm_70;sm_80",
"CMAKE_Fortran_COMPILER" : util.Interpolate("%(prop:builddir)s/install-clang/bin/flang"),
vvereschaka marked this conversation as resolved.
Show resolved Hide resolved
"FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT" : "OpenMP",
"FLANG_RT_DEVICE_ARCHITECTURES" : "sm_50;sm_60;sm_70;sm_80",
},
targets = ["FortranRuntime"],
src_to_build_dir = "flang/runtime",
targets = ["flang_rt"],
Copy link
Contributor

Choose a reason for hiding this comment

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

must be "flang-rt" instead of "flang_rt"

cmake --build . --target flang_rt
ninja: error: unknown target 'flang_rt', did you mean 'flang-rt'?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, ... and no. Both targets should exist. flang-rt for all non-EXCLUDE_FROM_ALL artifacts, flang_rt for only the artifact called flang_rt (usually libflang_rt.a) which corresponds to the old FortranRuntime. I don't know why it does not exist.

Anyway, changing it to flang-rt.

src_to_build_dir = "flang-rt",
Copy link
Contributor

Choose a reason for hiding this comment

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

this line must be removed. There is no llvm-project/flang-rt project's folder. Should be used default (llvm).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I misunderstood the purpose of this paramters. I assumed it was the CMake build directory.

For runtimes it should be runtimes, which corresponds to https://github.com/llvm/llvm-project/blob/main/runtimes/CMakeLists.txt. It contains the boilerplate for an out-of-source build of any runtime project like flang-rt, like llvm/CMakeLists.txt is for all LLVM_ENABLE_PROJECTS.

),
],
env = {
Expand Down Expand Up @@ -3309,7 +3308,7 @@
'builddir': "premerge-monolithic-windows",
'factory' : UnifiedTreeBuilder.getCmakeWithNinjaWithMSVCBuildFactory(
vs="autodetect",
depends_on_projects=["clang-tools-extra", "clang", "flang", "libclc", "lld", "llvm", "mlir", "polly", "pstl"],
depends_on_projects=["clang-tools-extra", "clang", "flang", "flang-rt", "libclc", "lld", "llvm", "mlir", "polly", "pstl"],
checks=["check-all"],
install_pip_requirements = True,
extra_configure_args=[
Expand All @@ -3329,7 +3328,7 @@
'workernames': ["premerge-linux-1"],
'builddir': "premerge-monolithic-linux",
'factory': UnifiedTreeBuilder.getCmakeWithNinjaBuildFactory(
depends_on_projects=["bolt", "clang", "clang-tools-extra", "compiler-rt", "flang", "libc", "libclc", "lld", "llvm", "mlir", "polly", "pstl"],
depends_on_projects=["bolt", "clang", "clang-tools-extra", "compiler-rt", "flang", "flang-rt", "libc", "libclc", "lld", "llvm", "mlir", "polly", "pstl"],
install_pip_requirements = True,
extra_configure_args=[
"-DCMAKE_BUILD_TYPE=Release",
Expand Down
1 change: 1 addition & 0 deletions zorg/buildbot/builders/ClangBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def _getClangCMakeBuildFactory(
depends_on_projects.append('libunwind')
if checkout_flang:
depends_on_projects.append('flang')
depends_on_projects.append('flang-rt')
depends_on_projects.append('mlir')

f = LLVMBuildFactory(
Expand Down
1 change: 1 addition & 0 deletions zorg/buildbot/process/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"libcxxabi",
"libunwind",
"openmp",
"flang-rt",
])

class LLVMBuildFactory(BuildFactory):
Expand Down