[PATCH] D80698: Ignore MLIRGPUtoCUDATransforms in the MLIRTestTransforms library when the NVPTX target is disabled

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 02:08:08 PDT 2020


psamolysov created this revision.
psamolysov added reviewers: mehdi_amini, ftynse.
psamolysov added a project: MLIR.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, yaxunl, mgorny.
Herald added a project: LLVM.

When the NVPTX target is enabled, MLIR provides the MLIRGPUtoCUDATransforms conversion library and the MLIRTestTransforms test library as well as the MLIRMlirOptMain one depend on this transform. If a local LLVM build with enabled NVPTX is installed, the information about the libraries and their dependencies is stored into a generated `lib\cmake\mlir\MLIRTargets.cmake` file.

But when NVPTX is disabled and LLVM is build without NVPTX (only with X86 for example), the MLIRGPUtoCUDATransforms conversion library is not created and there is no information about the library in the generated `lib\cmake\mlir\MLIRTargets.cmake` file. Regardless this fact, the MLIRTestTransforms still depends on the conversion library and the `MLIRTargets.cmake` file contains the following line:

  set_target_properties(MLIRTestTransforms PROPERTIES
    INTERFACE_LINK_LIBRARIES "MLIRAffineOps;MLIRAnalysis;MLIREDSC;MLIRGPU;MLIRGPUtoCUDATransforms;...
  )

The patch wraps `MLIRGPUtoCUDATransforms` into a condition: `MLIRTestTransforms` depends on the library iff `MLIR_CUDA_CONVERSIONS_ENABLED` is true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80698

Files:
  mlir/test/lib/Transforms/CMakeLists.txt


Index: mlir/test/lib/Transforms/CMakeLists.txt
===================================================================
--- mlir/test/lib/Transforms/CMakeLists.txt
+++ mlir/test/lib/Transforms/CMakeLists.txt
@@ -1,4 +1,10 @@
 # Exclude tests from libMLIR.so
+if (MLIR_CUDA_CONVERSIONS_ENABLED)
+  set(GPU_TO_CUDA_LIB "MLIRGPUtoCUDATransforms")
+else()
+  set(GPU_TO_CUDA_LIB "")
+endif()
+
 add_mlir_library(MLIRTestTransforms
   TestAllReduceLowering.cpp
   TestBufferPlacement.cpp
@@ -36,7 +42,7 @@
   MLIRAnalysis
   MLIREDSC
   MLIRGPU
-  MLIRGPUtoCUDATransforms
+  ${GPU_TO_CUDA_LIB}
   MLIRLinalgOps
   MLIRLinalgTransforms
   MLIRSCF


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80698.266766.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/fdcc6881/attachment.bin>


More information about the llvm-commits mailing list