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

This commit is contained in:
Nicolas Vasilache
2023-07-17 18:08:00 +02:00
parent 40508e3ed9
commit d661b4b575
4 changed files with 38 additions and 62 deletions

View 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)

View 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}
)

View File

@@ -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

View File

@@ -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()