================
@@ -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:

[serious] What happens with host offloading? They also need device-like 
functions such as `omp_get_device_num()`. The [device-side 
implementation](https://github.com/llvm/llvm-project/blob/11a3de7e98785b0df8f2010fb22c10c0590d2707/offload/DeviceRTL/src/State.cpp#L424)
 and [host-side 
implementation](https://github.com/llvm/llvm-project/blob/11a3de7e98785b0df8f2010fb22c10c0590d2707/offload/libomptarget/OpenMP/API.cpp#L83-L91)
 are different. This also matter when e.g. offloading to a remote cluster 
(non-GPU) node via MPI.

I don't think we should (or can) assume that the triple determines whether it 
is executing on the host or device.

https://github.com/llvm/llvm-project/pull/136729
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to