[PATCH] D74041: [MLIR][GPU] Fix build files for mlir-opt.

Stephan Herhut via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 04:55:31 PST 2020


herhut created this revision.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added a project: LLVM.
herhut added reviewers: stephenneuendorffer, ftynse.
herhut added a comment.

There is probably a prettier way to do this but this unblocks building.


The recent refactoring of build files broke building with the MIR CUDA
integration enabled. This fixes it by adding some additional
dependencies to mlir-opt.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74041

Files:
  mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
  mlir/tools/mlir-opt/CMakeLists.txt


Index: mlir/tools/mlir-opt/CMakeLists.txt
===================================================================
--- mlir/tools/mlir-opt/CMakeLists.txt
+++ mlir/tools/mlir-opt/CMakeLists.txt
@@ -18,7 +18,7 @@
   ${LIB_LIBS}
 )
 
-set(LIBS
+set(FULL_LINK_LIBS
   MLIRAnalysis
   MLIRAffineOps
   MLIRAffineToStandard
@@ -68,8 +68,23 @@
   MLIRVectorToLLVM
   MLIRVectorToLoops
 )
+set(LIBS
+  MLIRIR
+  MLIROptMain
+  LLVMSupport
+  LLVMCore
+  LLVMAsmParser
+)
+
 if(MLIR_CUDA_CONVERSIONS_ENABLED)
   list(APPEND LIBS
+    LLVMNVPTXCodeGen
+    LLVMNVPTXDesc
+    LLVMNVPTXInfo
+    MLIRTargetNVVMIR
+  )
+  # Order matters here, so insert at front.
+  list(INSERT FULL_LINK_LIBS 0
     MLIRGPUtoCUDATransforms
   )
 endif()
@@ -78,7 +93,7 @@
 )
 llvm_update_compile_flags(mlir-opt)
 # It is necessary to use whole_archive_link to ensure that all static
-# initializers are called.  However, whole_archive_link libraries cannot
-# also be target_link_libraries
-whole_archive_link(mlir-opt ${LIBS})
-target_link_libraries(mlir-opt PRIVATE MLIRIR MLIROptMain LLVMSupport LLVMCore LLVMAsmParser)
+# initializers are called. However, whole_archive_link libraries cannot
+# also be target_link_libraries.
+whole_archive_link(mlir-opt ${FULL_LINK_LIBS})
+target_link_libraries(mlir-opt PRIVATE ${LIBS})
Index: mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
===================================================================
--- mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
+++ mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
@@ -1,16 +1,16 @@
 if(MLIR_CUDA_CONVERSIONS_ENABLED)
-  llvm_map_components_to_libnames(nvptx "NVPTX")
-
   add_llvm_library(MLIRGPUtoCUDATransforms
     ConvertKernelFuncToCubin.cpp
     ConvertLaunchFuncToCudaCalls.cpp
   )
   target_link_libraries(MLIRGPUtoCUDATransforms
+    LLVMNVPTXCodeGen
+    LLVMNVPTXDesc
+    LLVMNVPTXInfo
     MLIRGPU
     MLIRLLVMIR
     MLIRNVVMIR
     MLIRPass
     MLIRTargetNVVMIR
-    ${nvptx}
   )
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74041.242560.patch
Type: text/x-patch
Size: 1957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200205/906824dc/attachment.bin>


More information about the llvm-commits mailing list