[Openmp-commits] [PATCH] D143196: [Libomptarget] Do not build the GPU plugins if we have no device library

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 2 09:00:59 PST 2023


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield, tianshilei1992, ye-luo, h-vetinari.
Herald added subscribers: kosarev, kerbowa, jvesely.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

The GPU plugins have a dependency on the device libraries. Sometimes we
cannot build the device libraries because the user does not have a valid
`clang` to use or it was explicitly disabled. Currently this leads to a
transitive failure because we cannot meet this dependency. This patch
causes us to not build the GPU plugins if we do not have the device
libraries built. This should at least enable some general OpenMP
offloading via the CPU if nothing else.

Fixes https://github.com/llvm/llvm-project/issues/60457


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143196

Files:
  openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
  openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins/cuda/CMakeLists.txt


Index: openmp/libomptarget/plugins/cuda/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins/cuda/CMakeLists.txt
+++ openmp/libomptarget/plugins/cuda/CMakeLists.txt
@@ -15,6 +15,9 @@
   libomptarget_say("Not building CUDA offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is false")
   return()
 endif()
+if (NOT TARGET omptarget.devicertl.nvptx)
+  libomptarget_say("Not building CUDA offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is built")
+endif()
 
 if (NOT(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$" AND CMAKE_SYSTEM_NAME MATCHES "Linux"))
   libomptarget_say("Not building CUDA offloading plugin: only support CUDA in Linux x86_64, ppc64le, or aarch64 hosts.")
Index: openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -18,6 +18,10 @@
   libomptarget_say("Not building AMDGPU offloading plugin: LIBOMPTARGET_BUILD_AMDGPU_PLUGIN is false")
   return()
 endif()
+if (NOT TARGET omptarget.devicertl.amdgpu)
+  libomptarget_say("Not building AMDGPU offloading plugin: No AMDGPU device library built")
+  return()
+endif()
 
 # as of rocm-3.7, hsa is installed with cmake packages and kmt is found via hsa
 find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
Index: openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
+++ openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
@@ -15,6 +15,9 @@
   libomptarget_say("Not building CUDA NextGen offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is false")
   return()
 endif()
+if (NOT TARGET omptarget.devicertl.nvptx)
+  libomptarget_say("Not building CUDA NextGen offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is built")
+endif()
 
 if (NOT(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$" AND CMAKE_SYSTEM_NAME MATCHES "Linux"))
   libomptarget_say("Not building CUDA NextGen offloading plugin: only support CUDA in Linux x86_64, ppc64le, or aarch64 hosts.")
Index: openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
+++ openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
@@ -18,6 +18,11 @@
   libomptarget_say("Not building AMDGPU NextGen offloading plugin: LIBOMPTARGET_BUILD_AMDGPU_PLUGIN is false")
   return()
 endif()
+if (NOT TARGET omptarget.devicertl.amdgpu)
+  libomptarget_say("Not building AMDGPU NextGen offloading plugin: No AMDGPU device library built")
+  return()
+endif()
+
 
 # as of rocm-3.7, hsa is installed with cmake packages and kmt is found via hsa
 find_package(hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143196.494328.patch
Type: text/x-patch
Size: 3008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230202/b96c7d61/attachment-0001.bin>


More information about the Openmp-commits mailing list