-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Offload] Remove standalone build in favor of 'runtimes' #162904
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
base: main
Are you sure you want to change the base?
Conversation
Summary: We have supported standalone builds in the past, but these should likely all go through the LLVM runtimes handling instead. This simplifies a lot of leftover code and opens the way for future cleanups. Offload directly depends on LLVM so this makes even more sense, but already several runtimes projects don't allow these sorts of standalone buildds (libc, libcxx).
@llvm/pr-subscribers-offload Author: Joseph Huber (jhuber6) ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/162904.diff 5 Files Affected:
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index b277380783500..30033998a8e55 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -4,12 +4,13 @@
cmake_minimum_required(VERSION 3.20.0)
set(LLVM_SUBPROJECT_TITLE "liboffload")
-# Permit redefining OPENMP_STANDALONE_BUILD when doing a runtimes build.
-if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
- set(OPENMP_STANDALONE_BUILD TRUE)
- project(offload C CXX ASM)
-else()
- set(OPENMP_STANDALONE_BUILD FALSE)
+# Default to C++17.
+set(CMAKE_CXX_STANDARD 17)
+
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ message(FATAL_ERROR "Builds rooted in the offload directory are not supported. "
+ "Builds should be rooted in the runtimes directory instead. "
+ "Please see the documentation at https://openmp.llvm.org/SupportAndFAQ.html for more info.")
endif()
# Check that the library can actually be built.
@@ -26,20 +27,13 @@ endif()
set(OFFLOAD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-if(OPENMP_STANDALONE_BUILD)
- set(OFFLOAD_LIBDIR_SUFFIX "" CACHE STRING
- "Suffix of lib installation directory, e.g. 64 => lib64")
- set(OFFLOAD_INSTALL_LIBDIR "lib${OFFLOAD_LIBDIR_SUFFIX}" CACHE STRING
- "Path where built offload libraries should be installed.")
+# When building in tree we install the runtime according to the LLVM settings.
+if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ set(OFFLOAD_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
+ "Path where built offload libraries should be installed.")
else()
- # When building in tree we install the runtime according to the LLVM settings.
- if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
- set(OFFLOAD_INSTALL_LIBDIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE STRING
- "Path where built offload libraries should be installed.")
- else()
- set(OFFLOAD_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
- "Path where built offload libraries should be installed.")
- endif()
+ set(OFFLOAD_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}" CACHE STRING
+ "Path where built offload libraries should be installed.")
endif()
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -55,67 +49,30 @@ list(INSERT CMAKE_MODULE_PATH 0
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
)
-if (OPENMP_STANDALONE_BUILD)
- # CMAKE_BUILD_TYPE was not set, default to Release.
- if (NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
- endif()
+set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
+# If building in tree, we honor the same install suffix LLVM uses.
+set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
- # Group common settings.
- set(OPENMP_ENABLE_WERROR FALSE CACHE BOOL
- "Enable -Werror flags to turn warnings into errors for supporting compilers.")
- set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING
- "Suffix of lib installation directory, e.g. 64 => lib64")
- # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
- set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
-
- # Used by llvm_add_tool() and tests.
- set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR})
-
- # Group test settings.
- set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
- "C compiler to use for testing OpenMP runtime libraries.")
- set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
- "C++ compiler to use for testing OpenMP runtime libraries.")
- set(OPENMP_TEST_Fortran_COMPILER ${CMAKE_Fortran_COMPILER} CACHE STRING
- "FORTRAN compiler to use for testing OpenMP runtime libraries.")
- set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
-
- set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
- set(CMAKE_CXX_STANDARD_REQUIRED NO)
- set(CMAKE_CXX_EXTENSIONS NO)
+if (NOT MSVC)
+ set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
else()
- set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
- # If building in tree, we honor the same install suffix LLVM uses.
- set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
-
- if (NOT MSVC)
- set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
- set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
- else()
- set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang.exe)
- set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe)
- endif()
-
- # Check for flang
- if (NOT MSVC)
- set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang)
- else()
- set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang.exe)
- endif()
+ set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang.exe)
+ set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe)
+endif()
- # Set fortran test compiler if flang is found
- if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}")
- message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}")
- else()
- unset(OPENMP_TEST_Fortran_COMPILER)
- endif()
+# Check for flang
+if (NOT MSVC)
+ set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang)
+else()
+ set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang.exe)
+endif()
- # If not standalone, set CMAKE_CXX_STANDARD but don't set the global cache value,
- # only set it locally for OpenMP.
- set(CMAKE_CXX_STANDARD 17)
- set(CMAKE_CXX_STANDARD_REQUIRED NO)
- set(CMAKE_CXX_EXTENSIONS NO)
+# Set fortran test compiler if flang is found
+if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}")
+ message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}")
+else()
+ unset(OPENMP_TEST_Fortran_COMPILER)
endif()
# Set the path of all resulting libraries to a unified location so that it can
@@ -260,65 +217,6 @@ if (LIBOMPTARGET_USE_LTO)
list(APPEND offload_link_flags ${CMAKE_CXX_COMPILE_OPTIONS_IPO})
endif()
-if(OPENMP_STANDALONE_BUILD)
- if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- execute_process(
- OUTPUT_STRIP_TRAILING_WHITESPACE
- COMMAND ${CMAKE_CXX_COMPILER} --print-resource-dir
- RESULT_VARIABLE COMMAND_RETURN_CODE
- OUTPUT_VARIABLE COMPILER_RESOURCE_DIR
- )
- endif()
-
- set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
- set(LIBOMP_OMPT_SUPPORT FALSE)
-
- find_path (
- LIBOMP_OMP_TOOLS_INCLUDE_DIR
- NAMES
- omp-tools.h
- HINTS
- ${COMPILER_RESOURCE_DIR}/include
- ${CMAKE_INSTALL_PREFIX}/include
- )
-
- if(LIBOMP_OMP_TOOLS_INCLUDE_DIR)
- set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
- set(LIBOMP_OMPT_SUPPORT TRUE)
- endif()
-
- # LLVM_LIBRARY_DIRS set by find_package(LLVM) in LibomptargetGetDependencies
- find_library (
- LIBOMP_STANDALONE
- NAMES
- omp
- HINTS
- ${CMAKE_INSTALL_PREFIX}/lib
- ${LLVM_LIBRARY_DIRS}
- REQUIRED
- )
-
- find_path (
- LIBOMP_INCLUDE_DIR
- NAMES
- omp.h
- HINTS
- ${COMPILER_RESOURCE_DIR}/include
- ${CMAKE_INSTALL_PREFIX}/include
- )
-
- get_filename_component(LIBOMP_LIBRARY_DIR ${LIBOMP_STANDALONE} DIRECTORY)
-
- set(OPENMP_TEST_FLAGS "" CACHE STRING
- "Extra compiler flags to send to the test compiler.")
- set(OPENMP_TEST_OPENMP_FLAGS ${OPENMP_TEST_COMPILER_OPENMP_FLAGS} CACHE STRING
- "OpenMP compiler flag to use for testing OpenMP runtime libraries.")
- set(LIBOMPTARGET_OPENMP_HEADER_FOLDER "${LIBOMP_INCLUDE_DIR}" CACHE STRING
- "Path to folder containing omp.h")
- set(LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER "${LIBOMP_LIBRARY_DIR}" CACHE STRING
- "Path to folder containing libomp.so, and libLLVMSupport.so with profiling enabled")
-endif()
-
macro(pythonize_bool var)
if (${var})
set(${var} True)
diff --git a/offload/cmake/Modules/LibomptargetGetDependencies.cmake b/offload/cmake/Modules/LibomptargetGetDependencies.cmake
index 2a8bdebf2c1dd..c5ceb0f6b0755 100644
--- a/offload/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/offload/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -10,31 +10,9 @@ include (FindPackageHandleStandardArgs)
# Looking for LLVM...
################################################################################
-if (OPENMP_STANDALONE_BUILD)
- # Complete LLVM package is required for building libomptarget
- # in an out-of-tree mode.
- find_package(LLVM REQUIRED)
- message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
- message(STATUS "Using LLVM in: ${LLVM_DIR}")
- list(APPEND LIBOMPTARGET_LLVM_INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
- list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR})
- include(AddLLVM)
- if(TARGET omptarget)
- message(FATAL_ERROR "CMake target 'omptarget' already exists. "
- "Use an LLVM installation that doesn't expose its 'omptarget' target.")
- endif()
-else()
- # Note that OPENMP_STANDALONE_BUILD is FALSE, when
- # openmp is built with -DLLVM_ENABLE_RUNTIMES="openmp" vs
- # -DLLVM_ENABLE_PROJECTS="openmp", but openmp build
- # is actually done as a standalone project build with many
- # LLVM CMake variables propagated to it.
- list(APPEND LIBOMPTARGET_LLVM_INCLUDE_DIRS
- ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_BINARY_DIR}/include
- )
- message(STATUS
- "Using LLVM include directories: ${LIBOMPTARGET_LLVM_INCLUDE_DIRS}")
-endif()
+list(APPEND LIBOMPTARGET_LLVM_INCLUDE_DIRS
+ ${LLVM_MAIN_INCLUDE_DIR} ${LLVM_BINARY_DIR}/include
+)
################################################################################
# Looking for libffi...
diff --git a/offload/cmake/OpenMPTesting.cmake b/offload/cmake/OpenMPTesting.cmake
index ef8cf34ba0c85..f08ec71e53a54 100644
--- a/offload/cmake/OpenMPTesting.cmake
+++ b/offload/cmake/OpenMPTesting.cmake
@@ -49,29 +49,14 @@ function(find_standalone_test_dependencies)
endif()
endfunction()
-if (${OPENMP_STANDALONE_BUILD})
- find_standalone_test_dependencies()
-
- # Set lit arguments.
- set(DEFAULT_LIT_ARGS "-sv --show-unsupported --show-xfail")
- if (MSVC OR XCODE)
- set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --no-progress-bar")
- endif()
- if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
- set(DEFAULT_LIT_ARGS "${DEFAULT_LIT_ARGS} --time-tests --timeout=1800")
- endif()
- set(OPENMP_LIT_ARGS "${DEFAULT_LIT_ARGS}" CACHE STRING "Options for lit.")
- separate_arguments(OPENMP_LIT_ARGS)
+if (NOT TARGET "FileCheck")
+ message(STATUS "Cannot find 'FileCheck'.")
+ message(WARNING "The check targets will not be available!")
+ set(ENABLE_CHECK_TARGETS FALSE)
else()
- if (NOT TARGET "FileCheck")
- message(STATUS "Cannot find 'FileCheck'.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE)
- else()
- set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
- endif()
- set(OPENMP_NOT_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/not)
+ set(OPENMP_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
endif()
+set(OPENMP_NOT_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/not)
set(OFFLOAD_DEVICE_INFO_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-offload-device-info)
set(OFFLOAD_TBLGEN_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/offload-tblgen)
@@ -120,50 +105,28 @@ function(set_test_compiler_information dir)
endif()
endfunction()
-if (${OPENMP_STANDALONE_BUILD})
- # Detect compiler that should be used for testing.
- # We cannot use ExternalProject_Add() because its configuration runs when this
- # project is built which is too late for detecting the compiler...
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DetectTestCompiler)
- execute_process(
- COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${CMAKE_CURRENT_SOURCE_DIR}/../openmp/cmake/DetectTestCompiler
- -DCMAKE_C_COMPILER=${OPENMP_TEST_C_COMPILER}
- -DCMAKE_CXX_COMPILER=${OPENMP_TEST_CXX_COMPILER}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DetectTestCompiler
- OUTPUT_VARIABLE DETECT_COMPILER_OUT
- ERROR_VARIABLE DETECT_COMPILER_ERR
- RESULT_VARIABLE DETECT_COMPILER_RESULT)
- if (DETECT_COMPILER_RESULT)
- message(STATUS "Could not detect test compilers.")
- message(WARNING "The check targets will not be available!")
- set(ENABLE_CHECK_TARGETS FALSE)
- else()
- set_test_compiler_information(${CMAKE_CURRENT_BINARY_DIR}/DetectTestCompiler)
- endif()
+# Set the information that we know.
+set(OPENMP_TEST_COMPILER_ID "Clang")
+# Cannot use CLANG_VERSION because we are not guaranteed that this is already set.
+set(OPENMP_TEST_COMPILER_VERSION "${LLVM_VERSION}")
+set(OPENMP_TEST_COMPILER_VERSION_MAJOR "${LLVM_VERSION_MAJOR}")
+set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
+# Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
+# CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
+# around that, until it is fixed there.
+if("${CMAKE_THREAD_LIBS_INIT}" STREQUAL "-lpthread")
+ set(OPENMP_TEST_COMPILER_THREAD_FLAGS "-pthread")
else()
- # Set the information that we know.
- set(OPENMP_TEST_COMPILER_ID "Clang")
- # Cannot use CLANG_VERSION because we are not guaranteed that this is already set.
- set(OPENMP_TEST_COMPILER_VERSION "${LLVM_VERSION}")
- set(OPENMP_TEST_COMPILER_VERSION_MAJOR "${LLVM_VERSION_MAJOR}")
- set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
- # Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
- # CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
- # around that, until it is fixed there.
- if("${CMAKE_THREAD_LIBS_INIT}" STREQUAL "-lpthread")
- set(OPENMP_TEST_COMPILER_THREAD_FLAGS "-pthread")
- else()
- set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
- endif()
- if(TARGET tsan)
- set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 1)
- else()
- set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 0)
- endif()
- set(OPENMP_TEST_COMPILER_HAS_OMP_H 1)
- set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS}")
- set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1)
+ set(OPENMP_TEST_COMPILER_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
endif()
+if(TARGET tsan)
+ set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 1)
+else()
+ set(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS 0)
+endif()
+set(OPENMP_TEST_COMPILER_HAS_OMP_H 1)
+set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp ${OPENMP_TEST_COMPILER_THREAD_FLAGS}")
+set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1)
# Function to set compiler features for use in lit.
function(update_test_compiler_features)
@@ -211,30 +174,20 @@ function(add_offload_testsuite target comment)
set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
endif()
- if (${OPENMP_STANDALONE_BUILD})
- set(LIT_ARGS ${OPENMP_LIT_ARGS} ${ARG_ARGS})
- add_custom_target(${target}
- COMMAND ${Python3_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE} ${LIT_ARGS} ${ARG_UNPARSED_ARGUMENTS}
- COMMENT ${comment}
- DEPENDS ${ARG_DEPENDS}
- USES_TERMINAL
+ if (ARG_EXCLUDE_FROM_CHECK_ALL)
+ add_lit_testsuite(${target}
+ ${comment}
+ ${ARG_UNPARSED_ARGUMENTS}
+ EXCLUDE_FROM_CHECK_ALL
+ DEPENDS clang FileCheck not ${ARG_DEPENDS}
+ ARGS ${ARG_ARGS}
)
else()
- if (ARG_EXCLUDE_FROM_CHECK_ALL)
- add_lit_testsuite(${target}
- ${comment}
- ${ARG_UNPARSED_ARGUMENTS}
- EXCLUDE_FROM_CHECK_ALL
- DEPENDS clang FileCheck not ${ARG_DEPENDS}
- ARGS ${ARG_ARGS}
- )
- else()
- add_lit_testsuite(${target}
- ${comment}
- ${ARG_UNPARSED_ARGUMENTS}
- DEPENDS clang FileCheck not ${ARG_DEPENDS}
- ARGS ${ARG_ARGS}
- )
- endif()
+ add_lit_testsuite(${target}
+ ${comment}
+ ${ARG_UNPARSED_ARGUMENTS}
+ DEPENDS clang FileCheck not ${ARG_DEPENDS}
+ ARGS ${ARG_ARGS}
+ )
endif()
endfunction()
diff --git a/offload/test/CMakeLists.txt b/offload/test/CMakeLists.txt
index 711621de9075d..40da2a7d573ee 100644
--- a/offload/test/CMakeLists.txt
+++ b/offload/test/CMakeLists.txt
@@ -12,7 +12,7 @@ else()
set(LIBOMPTARGET_DEBUG False)
endif()
-if (NOT OPENMP_STANDALONE_BUILD AND "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
+if ("compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
set(LIBOMPTARGET_TEST_GPU_PGO True)
else()
set(LIBOMPTARGET_TEST_GPU_PGO False)
diff --git a/openmp/docs/SupportAndFAQ.rst b/openmp/docs/SupportAndFAQ.rst
index f5a84784c8de8..c7d8bfa56e238 100644
--- a/openmp/docs/SupportAndFAQ.rst
+++ b/openmp/docs/SupportAndFAQ.rst
@@ -90,6 +90,20 @@ invocation.
For Nvidia offload, please see :ref:`build_nvidia_offload_capable_compiler`.
For AMDGPU offload, please see :ref:`build_amdgpu_offload_capable_compiler`.
+For a standalone build, users are expected to use the LLVM runtimes directory.
+
+.. code-block:: sh
+
+ $> cd llvm-project # The llvm-project checkout
+ $> mkdir build
+ $> cd build
+ $> cmake ../runtimes -G Ninja \
+ -DLLVM_BINARY_DIR="${PATH_TO_LLVM}"
+ -DLLVM_ENABLE_RUNTIMES="openmp;offload"
+ -DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
+ -DCMAKE_INSTALL_PREFIX=<PATH> \ # Where the libraries will live
+ $> ninja install
+
.. note::
The compiler that generates the offload code should be the same (version) as
the compiler that builds the OpenMP device runtimes. The OpenMP host runtime
|
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") | ||
set(CMAKE_CXX_STANDARD_REQUIRED NO) | ||
set(CMAKE_CXX_EXTENSIONS NO) | ||
if (NOT MSVC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even support Windows? Lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, it's probably copied from somewhere else way back when. Honestly though, we should at least try for CUDA. I know that the HSA plugin won't work, but the CUDA driver shares the same API I think. Maybe when @Meinersbur is bored one day he can try building it on Windows and seeing if it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We build it for Windows with the L0 Plugin and works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like pretty mechanical. LGTM.
Thanks, I'll let this sit for a bit until I get an OK from Ethan since he's working on removing the one user of this i know of. |
${LLVM_MAIN_INCLUDE_DIR} ${LLVM_BINARY_DIR}/include | ||
) | ||
message(STATUS | ||
"Using LLVM include directories: ${LIBOMPTARGET_LLVM_INCLUDE_DIRS}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keeping the message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless information when we only build through LLVM
Summary:
We have supported standalone builds in the past, but these should likely
all go through the LLVM runtimes handling instead. This simplifies a lot
of leftover code and opens the way for future cleanups. Offload directly
depends on LLVM so this makes even more sense, but already several
runtimes projects don't allow these sorts of standalone buildds (libc,
libcxx).