[Openmp-commits] [llvm] [openmp] [OpenMP] Change build of OpenMP device runtime to be a separate runtime (PR #136729)
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Mon Apr 28 06:53:34 PDT 2025
================
@@ -122,35 +130,41 @@ else()
get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include)
endif()
-# Build host runtime library, after LIBOMPTARGET variables are set since they are needed
-# to enable time profiling support in the OpenMP runtime.
-add_subdirectory(runtime)
-
-set(ENABLE_OMPT_TOOLS ON)
-# Currently tools are not tested well on Windows or MacOS X.
-if (APPLE OR WIN32)
- set(ENABLE_OMPT_TOOLS OFF)
-endif()
+# Use the current compiler target to determine the appropriate runtime to build.
+if("${LLVM_DEFAULT_TARGET_TRIPLE}" MATCHES "^amdgcn|^nvptx" OR
+ "${CMAKE_CXX_COMPILER_TARGET}" MATCHES "^amdgcn|^nvptx")
+ add_subdirectory(device)
----------------
Meinersbur wrote:
The device-side `omp_get_device_num()` (defined in `libomptarget.so`, not `libomp.so`) only returns `omp_get_initial_device()`, which is wrong for any kind of offloading.
After trying out what actuall happens I found that it actually executes the [Fortran wrapper](https://github.com/llvm/llvm-project/blob/642453c6bab896f792fa86a61837ea32ae46ae48/openmp/runtime/src/kmp_ftn_entry.h#L1544-L1546) (in `libomp.so`). It also incorrectly assumes it is always executing on the host. That looks like a bug.
https://github.com/llvm/llvm-project/pull/136729
More information about the Openmp-commits
mailing list