[mlir][test] Fix linking error post test-lower-to-nvvm
authorNicolas Vasilache <nicolasvasilache@users.noreply.github.com>
Mon, 17 Jul 2023 16:08:00 +0000 (18:08 +0200)
committerNicolas Vasilache <nicolasvasilache@users.noreply.github.com>
Mon, 17 Jul 2023 16:43:32 +0000 (18:43 +0200)
mlir/test/lib/Dialect/CMakeLists.txt
mlir/test/lib/Dialect/GPU/CMakeLists.txt
mlir/test/lib/Dialect/GPU/TestLowerToNVVM.cpp [moved from mlir/test/lib/Dialect/NVVM/TestLowerToNVVM.cpp with 99% similarity]
mlir/test/lib/Dialect/NVVM/CMakeLists.txt [deleted file]

index 9344a73..48bde69 100644 (file)
@@ -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)
index 5581904..02db079 100644 (file)
@@ -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}
   )
@@ -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 (file)
index eafa81e..0000000
+++ /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()