[PATCH] D47888: [Polly] Back out of GPU Codegen if NVPTX is not available

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 08:39:04 PDT 2018


philip.pfaffe created this revision.
philip.pfaffe added reviewers: Meinersbur, grosser.
Herald added subscribers: bollu, mgorny.
Herald added a reviewer: bollu.

When enabling GPU codegen in polly, CMake will fail if NVPTX is not a target
supported by the LLVM polly is being built against. In that case, GPU codegen
should be switched off.


Repository:
  rPLO Polly

https://reviews.llvm.org/D47888

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -97,14 +97,17 @@
 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 
 option(POLLY_ENABLE_GPGPU_CODEGEN "Enable GPGPU code generation feature" OFF)
+set(GPU_CODEGEN FALSE)
 if (POLLY_ENABLE_GPGPU_CODEGEN)
   # Do not require CUDA/OpenCL, as GPU code generation test cases can be run
   # without a CUDA/OpenCL library.
-  FIND_PACKAGE(CUDA)
-  FIND_PACKAGE(OpenCL)
-  set(GPU_CODEGEN TRUE)
-else(POLLY_ENABLE_GPGPU_CODEGEN)
-  set(GPU_CODEGEN FALSE)
+  if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)
+    FIND_PACKAGE(CUDA)
+    FIND_PACKAGE(OpenCL)
+    set(GPU_CODEGEN TRUE)
+  else()
+    message(WARNING "The LLVM NVPTX target is required for GPU code generation")
+  endif()
 endif(POLLY_ENABLE_GPGPU_CODEGEN)
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47888.150343.patch
Type: text/x-patch
Size: 841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180607/6c7d23a8/attachment.bin>


More information about the llvm-commits mailing list