[Mlir-commits] [mlir] d661b4b - [mlir][test] Fix linking error post test-lower-to-nvvm

Nicolas Vasilache llvmlistbot at llvm.org
Mon Jul 17 09:43:37 PDT 2023


Author: Nicolas Vasilache
Date: 2023-07-17T18:43:32+02:00
New Revision: d661b4b57504b965a37dc30b79bdd5ac36fca9ec

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

LOG: [mlir][test] Fix linking error post test-lower-to-nvvm

Added: 
    mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp

Modified: 
    mlir/test/lib/Dialect/CMakeLists.txt
    mlir/test/lib/Dialect/GPU/CMakeLists.txt

Removed: 
    mlir/test/lib/Dialect/NVVM/CMakeLists.txt
    mlir/test/lib/Dialect/NVVM/TestLowerToNVVM.cpp


################################################################################
diff  --git a/mlir/test/lib/Dialect/CMakeLists.txt b/mlir/test/lib/Dialect/CMakeLists.txt
index 9344a73d2a037b..48bde69e017004 100644
--- a/mlir/test/lib/Dialect/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/CMakeLists.txt
@@ -10,7 +10,6 @@ add_subdirectory(LLVM)
 add_subdirectory(Math)
 add_subdirectory(MemRef)
 add_subdirectory(NVGPU)
-add_subdirectory(NVVM)
 add_subdirectory(SCF)
 add_subdirectory(Shape)
 add_subdirectory(SPIRV)

diff  --git a/mlir/test/lib/Dialect/GPU/CMakeLists.txt b/mlir/test/lib/Dialect/GPU/CMakeLists.txt
index 55819048275da2..02db0799d55c94 100644
--- a/mlir/test/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/GPU/CMakeLists.txt
@@ -1,23 +1,49 @@
 # Exclude tests from libMLIR.so
-add_mlir_library(MLIRGPUTestPasses
-  TestConvertGPUKernelToCubin.cpp
-  TestConvertGPUKernelToHsaco.cpp
-  TestGpuMemoryPromotion.cpp
-  TestGpuRewrite.cpp
+get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
 
-  EXCLUDE_FROM_LIBMLIR
+set(LIBS
+  ${conversion_libs}
 
-  LINK_LIBS PUBLIC
   MLIRAffineDialect
+  MLIRAnalysis
+  MLIRArithDialect
+  MLIRBuiltinToLLVMIRTranslation
+  MLIRExecutionEngine
   MLIRFuncDialect
   MLIRGPUDialect
   MLIRGPUToGPURuntimeTransforms
+  MLIRGPUTransforms
+  MLIRIR
+  MLIRLLVMDialect
+  MLIRLLVMCommonConversion
   MLIRLLVMToLLVMIRTranslation
+  MLIRToLLVMIRTranslationRegistration
+  MLIRMemRefDialect
+  MLIRMemRefToLLVM
   MLIRNVVMDialect
   MLIRNVVMToLLVMIRTranslation
   MLIRPass
   MLIRROCDLDialect
   MLIRROCDLToLLVMIRTranslation
   MLIRSCFDialect
+  MLIRSupport
+  MLIRTargetLLVMIRExport
+  MLIRTransforms
   MLIRTransformUtils
+  MLIRTranslateLib
+  MLIRVectorDialect
+  MLIRVectorToLLVM
+  )
+
+add_mlir_library(MLIRGPUTestPasses
+  TestConvertGPUKernelToCubin.cpp
+  TestConvertGPUKernelToHsaco.cpp
+  TestGpuMemoryPromotion.cpp
+  TestGpuRewrite.cpp
+  TestLowerToNVVM.cpp
+
+  EXCLUDE_FROM_LIBMLIR
+
+  LINK_LIBS PUBLIC
+  ${LIBS}
   )

diff  --git a/mlir/test/lib/Dialect/NVVM/TestLowerToNVVM.cpp b/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp
similarity index 99%
rename from mlir/test/lib/Dialect/NVVM/TestLowerToNVVM.cpp
rename to mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp
index 2393e6cda28afd..57f328d6bd530b 100644
--- a/mlir/test/lib/Dialect/NVVM/TestLowerToNVVM.cpp
+++ b/mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp
@@ -50,6 +50,7 @@
 
 using namespace mlir;
 
+#if MLIR_CUDA_CONVERSIONS_ENABLED
 namespace {
 struct TestLowerToNVVMOptions
     : public PassPipelineOptions<TestLowerToNVVMOptions> {
@@ -187,8 +188,11 @@ void buildGpuPassPipeline(OpPassManager &pm,
 
   // Finally we can reconcile unrealized casts.
   pm.addNestedPass<gpu::GPUModuleOp>(createReconcileUnrealizedCastsPass());
+
+#if MLIR_GPU_TO_CUBIN_PASS_ENABLE
   pm.addNestedPass<gpu::GPUModuleOp>(createGpuSerializeToCubinPass(
       options.cubinTriple, options.cubinChip, options.cubinFeatures));
+#endif // MLIR_GPU_TO_CUBIN_PASS_ENABLE
 }
 
 void buildLowerToNVVMPassPipeline(OpPassManager &pm,
@@ -328,3 +332,4 @@ void registerTestLowerToNVVM() {
 }
 } // namespace test
 } // namespace mlir
+#endif // MLIR_CUDA_CONVERSIONS_ENABLED

diff  --git a/mlir/test/lib/Dialect/NVVM/CMakeLists.txt b/mlir/test/lib/Dialect/NVVM/CMakeLists.txt
deleted file mode 100644
index eafa81e8d9b316..00000000000000
--- a/mlir/test/lib/Dialect/NVVM/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-if (MLIR_ENABLE_CUDA_RUNNER)
-  # Configure CUDA support. Using check_language first allows us to give a
-  # custom error message.
-  include(CheckLanguage)
-  check_language(CUDA)
-  if (CMAKE_CUDA_COMPILER)
-    enable_language(CUDA)
-  else()
-    message(SEND_ERROR
-      "Building the mlir cuda runner requires a working CUDA install")
-  endif()
-
-  # We need the libcuda.so library.
-  find_library(CUDA_RUNTIME_LIBRARY cuda HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} REQUIRED)
-
-  get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
-  set(LIBS
-    ${conversion_libs}
-
-    MLIRAnalysis
-    MLIRArithDialect
-    MLIRBuiltinToLLVMIRTranslation
-    MLIRExecutionEngine
-    MLIRFuncDialect
-    MLIRGPUDialect
-    MLIRIR
-    MLIRJitRunner
-    MLIRLLVMDialect
-    MLIRLLVMCommonConversion
-    MLIRLLVMToLLVMIRTranslation
-    MLIRToLLVMIRTranslationRegistration
-    MLIRMemRefDialect
-    MLIRMemRefToLLVM
-    MLIRParser
-    MLIRSPIRVDialect
-    MLIRSPIRVTransforms
-    MLIRSupport
-    MLIRTargetLLVMIRExport
-    MLIRTransforms
-    MLIRTranslateLib
-    MLIRVectorDialect
-    MLIRVectorToLLVM
-  )
-
-  # Exclude tests from libMLIR.so
-  add_mlir_library(MLIRNVVMTestPasses
-    TestLowerToNVVM.cpp
-
-    EXCLUDE_FROM_LIBMLIR
-
-    LINK_LIBS PUBLIC
-    ${LIBS}
-    )
-endif()


        


More information about the Mlir-commits mailing list