[Openmp-commits] [openmp] a05a0c3 - [libomptarget] Add cmake variables to disable building the amdgpu or cuda plugins

Jon Chesterfield via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 6 08:42:35 PST 2021


Author: Jon Chesterfield
Date: 2021-12-06T16:42:26Z
New Revision: a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087

URL: https://github.com/llvm/llvm-project/commit/a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087
DIFF: https://github.com/llvm/llvm-project/commit/a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087.diff

LOG: [libomptarget] Add cmake variables to disable building the amdgpu or cuda plugins

Analogous to the controls on building device runtimes

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D115148

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
    openmp/libomptarget/plugins/cuda/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
index ff740c0877f2b..a2db745f71ae5 100644
--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -12,6 +12,12 @@
 ##===----------------------------------------------------------------------===##
 
 ################################################################################
+set(LIBOMPTARGET_BUILD_AMDGPU_PLUGIN TRUE CACHE BOOL
+  "Whether to build AMDGPU plugin")
+if (NOT LIBOMPTARGET_BUILD_AMDGPU_PLUGIN)
+  libomptarget_say("Not building AMDGPU offloading plugin: LIBOMPTARGET_BUILD_AMDGPU_PLUGIN is false")
+  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)

diff  --git a/openmp/libomptarget/plugins/cuda/CMakeLists.txt b/openmp/libomptarget/plugins/cuda/CMakeLists.txt
index 6ac7c24f41d7b..b438d69af66cc 100644
--- a/openmp/libomptarget/plugins/cuda/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/cuda/CMakeLists.txt
@@ -9,6 +9,13 @@
 # Build a plugin for a CUDA machine if available.
 #
 ##===----------------------------------------------------------------------===##
+set(LIBOMPTARGET_BUILD_CUDA_PLUGIN TRUE CACHE BOOL
+  "Whether to build CUDA plugin")
+if (NOT LIBOMPTARGET_BUILD_CUDA_PLUGIN)
+  libomptarget_say("Not building CUDA offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is false")
+  return()
+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.")
   return()


        


More information about the Openmp-commits mailing list