[Mlir-commits] [mlir] 72ede60 - [mlir][GPU] Link relevant LLVM components in GPUCommon instead of test

Alex Zinenko llvmlistbot at llvm.org
Thu May 28 11:02:01 PDT 2020


Author: Alex Zinenko
Date: 2020-05-28T20:01:54+02:00
New Revision: 72ede60b75ee90b7f4e33d88e4df18bb6f6dc94a

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

LOG: [mlir][GPU] Link relevant LLVM components in GPUCommon instead of test

D80142 restructured MLIR-to-GPU-binary conversion to support multiple
targets. It also modified cmake files to link relevant LLVM components
in test/lib, which broke shared-library builds, and likely made the
conversions unusable outside mlir-opt (or other tools that link in test
library targets). Link these components to GPUCommon instead.

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

Added: 
    

Modified: 
    mlir/lib/Conversion/GPUCommon/CMakeLists.txt
    mlir/test/lib/Transforms/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/GPUCommon/CMakeLists.txt b/mlir/lib/Conversion/GPUCommon/CMakeLists.txt
index eb7d21f66f73..91c281614214 100644
--- a/mlir/lib/Conversion/GPUCommon/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUCommon/CMakeLists.txt
@@ -1,3 +1,21 @@
+if (MLIR_CUDA_CONVERSIONS_ENABLED)
+  set(NVPTX_LIBS
+    MC
+    NVPTXCodeGen
+    NVPTXDesc
+    NVPTXInfo
+  )
+endif()
+
+if (MLIR_ROCM_CONVERSIONS_ENABLED)
+  set(AMDGPU_LIBS
+    MC
+    AMDGPUCodeGen
+    AMDGPUDesc
+    AMDGPUInfo
+  )
+endif()
+
 add_mlir_conversion_library(MLIRGPUtoGPURuntimeTransforms
   ConvertLaunchFuncToRuntimeCalls.cpp
   ConvertKernelFuncToBlob.cpp
@@ -8,6 +26,8 @@ add_mlir_conversion_library(MLIRGPUtoGPURuntimeTransforms
 
   LINK_COMPONENTS
   Core
+  ${AMDGPU_LIBS}
+  ${NVPTX_LIBS}
 
   LINK_LIBS PUBLIC
   MLIRGPU

diff  --git a/mlir/test/lib/Transforms/CMakeLists.txt b/mlir/test/lib/Transforms/CMakeLists.txt
index 55bf84cb1637..4ea7498d3482 100644
--- a/mlir/test/lib/Transforms/CMakeLists.txt
+++ b/mlir/test/lib/Transforms/CMakeLists.txt
@@ -1,21 +1,3 @@
-if (MLIR_CUDA_CONVERSIONS_ENABLED)
-  set(NVPTX_LIBS
-    MC
-    NVPTXCodeGen
-    NVPTXDesc
-    NVPTXInfo
-  )
-endif()
-
-if (MLIR_ROCM_CONVERSIONS_ENABLED)
-  set(AMDGPU_LIBS
-    MC
-    AMDGPUCodeGen
-    AMDGPUDesc
-    AMDGPUInfo
-  )
-endif()
-
 # Exclude tests from libMLIR.so
 add_mlir_library(MLIRTestTransforms
   TestAllReduceLowering.cpp
@@ -50,10 +32,6 @@ add_mlir_library(MLIRTestTransforms
   MLIRStandardOpsIncGen
   MLIRTestVectorTransformPatternsIncGen
 
-  LINK_COMPONENTS
-  ${AMDGPU_LIBS}
-  ${NVPTX_LIBS}
-
   LINK_LIBS PUBLIC
   MLIRAffineOps
   MLIRAnalysis


        


More information about the Mlir-commits mailing list