[MLIR] Refactor library handling for conversions.

Collect a list of conversion libraries in cmake, so we don't have to
list these explicitly in most binaries.

Differential Revision: https://reviews.llvm.org/D75222
This commit is contained in:
Stephen Neuendorffer 2020-02-26 16:31:14 -08:00
parent 5869552821
commit c07fb9e016
20 changed files with 30 additions and 45 deletions

View File

@ -54,3 +54,9 @@ function(add_mlir_dialect_library name)
set_property(GLOBAL APPEND PROPERTY MLIR_DIALECT_LIBS ${name})
add_llvm_library(${ARGV})
endfunction(add_mlir_dialect_library)
# Declare the library associated with a conversion.
function(add_mlir_conversion_library name)
set_property(GLOBAL APPEND PROPERTY MLIR_CONVERSION_LIBS ${name})
add_llvm_library(${ARGV})
endfunction(add_mlir_conversion_library)

View File

@ -28,18 +28,17 @@ include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
target_link_libraries(toyc-ch6
PRIVATE
${dialect_libs}
MLIRAffineToStandard
${conversion_libs}
MLIRAnalysis
MLIRExecutionEngine
MLIRIR
MLIRLLVMIR
MLIRLoopToStandard
MLIRParser
MLIRPass
MLIRStandardToLLVM
MLIRTargetLLVMIR
MLIRTransforms
)

View File

@ -28,17 +28,16 @@ include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
target_link_libraries(toyc-ch7
PRIVATE
${dialect_libs}
MLIRAffineToStandard
${conversion_libs}
MLIRAnalysis
MLIRExecutionEngine
MLIRIR
MLIRLoopToStandard
MLIRParser
MLIRPass
MLIRStandardToLLVM
MLIRTargetLLVMIR
MLIRTransforms
)

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRAffineToStandard
add_mlir_conversion_library(MLIRAffineToStandard
AffineToStandard.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -10,7 +10,7 @@ if (MLIR_CUDA_CONVERSIONS_ENABLED)
list(APPEND SOURCES "ConvertKernelFuncToCubin.cpp")
endif()
add_llvm_library(MLIRGPUtoCUDATransforms ${SOURCES})
add_mlir_conversion_library(MLIRGPUtoCUDATransforms ${SOURCES})
target_link_libraries(MLIRGPUtoCUDATransforms
MLIRGPU
MLIRLLVMIR

View File

@ -2,7 +2,7 @@ set(LLVM_TARGET_DEFINITIONS GPUToNVVM.td)
mlir_tablegen(GPUToNVVM.cpp.inc -gen-rewriters)
add_public_tablegen_target(MLIRGPUToNVVMIncGen)
add_llvm_library(MLIRGPUtoNVVMTransforms
add_mlir_conversion_library(MLIRGPUtoNVVMTransforms
LowerGpuOpsToNVVMOps.cpp
)

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRGPUtoROCDLTransforms
add_mlir_conversion_library(MLIRGPUtoROCDLTransforms
LowerGpuOpsToROCDLOps.cpp
)
target_link_libraries(MLIRGPUtoROCDLTransforms

View File

@ -2,7 +2,7 @@ set(LLVM_TARGET_DEFINITIONS GPUToSPIRV.td)
mlir_tablegen(GPUToSPIRV.cpp.inc -gen-rewriters)
add_public_tablegen_target(MLIRGPUToSPIRVIncGen)
add_llvm_library(MLIRGPUtoSPIRVTransforms
add_mlir_conversion_library(MLIRGPUtoSPIRVTransforms
ConvertGPUToSPIRV.cpp
ConvertGPUToSPIRVPass.cpp
)

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRGPUtoVulkanTransforms
add_mlir_conversion_library(MLIRGPUtoVulkanTransforms
ConvertLaunchFuncToVulkanCalls.cpp
)

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRLinalgToLLVM
add_mlir_conversion_library(MLIRLinalgToLLVM
LinalgToLLVM.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRLinalgToSPIRVTransforms
add_mlir_conversion_library(MLIRLinalgToSPIRVTransforms
LinalgToSPIRV.cpp
LinalgToSPIRVPass.cpp

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRLoopToStandard
add_mlir_conversion_library(MLIRLoopToStandard
ConvertLoopToStandard.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -11,7 +11,7 @@ set(LIBS
LLVMSupport
)
add_llvm_library(MLIRLoopsToGPU
add_mlir_conversion_library(MLIRLoopsToGPU
LoopsToGPU.cpp
LoopsToGPUPass.cpp

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRStandardToLLVM
add_mlir_conversion_library(MLIRStandardToLLVM
ConvertStandardToLLVM.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -2,7 +2,7 @@ set(LLVM_TARGET_DEFINITIONS StandardToSPIRV.td)
mlir_tablegen(StandardToSPIRV.cpp.inc -gen-rewriters)
add_public_tablegen_target(MLIRStandardToSPIRVIncGen)
add_llvm_library(MLIRStandardToSPIRVTransforms
add_mlir_conversion_library(MLIRStandardToSPIRVTransforms
ConvertStandardToSPIRV.cpp
ConvertStandardToSPIRVPass.cpp
LegalizeStandardForSPIRV.cpp

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRVectorToLLVM
add_mlir_conversion_library(MLIRVectorToLLVM
ConvertVectorToLLVM.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -1,4 +1,4 @@
add_llvm_library(MLIRVectorToLoops
add_mlir_conversion_library(MLIRVectorToLoops
ConvertVectorToLoops.cpp
ADDITIONAL_HEADER_DIRS

View File

@ -36,20 +36,18 @@ if(MLIR_CUDA_RUNNER_ENABLED)
)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
set(LIBS
${dialect_libs}
${conversion_libs}
LLVMCore
LLVMSupport
MLIRJitRunner
MLIRAnalysis
MLIREDSC
MLIRExecutionEngine
MLIRGPUtoCUDATransforms
MLIRGPUtoNVVMTransforms
MLIRIR
MLIRLoopToStandard
MLIRParser
MLIRStandardToLLVM
MLIRSupport
MLIRTargetLLVMIR
MLIRTransforms

View File

@ -19,23 +19,15 @@ target_link_libraries(MLIRMlirOptMain
)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
set(LIBS
${dialect_libs}
${conversion_libs}
MLIRLoopOpsTransforms
MLIRLoopAnalysis
MLIRAnalysis
MLIRAffineToStandard
MLIRDialect
MLIRLoopsToGPU
MLIRLinalgToLLVM
MLIRLoopToStandard
MLIREDSC
MLIRGPUtoCUDATransforms
MLIRGPUtoNVVMTransforms
MLIRGPUtoROCDLTransforms
MLIRGPUtoSPIRVTransforms
MLIRGPUtoVulkanTransforms
MLIROptLib
MLIRParser
MLIRPass
@ -43,11 +35,8 @@ set(LIBS
MLIRQuantizerSupport
MLIRQuantizerTransforms
MLIRSPIRV
MLIRLinalgToSPIRVTransforms
MLIRStandardToSPIRVTransforms
MLIRSPIRVTestPasses
MLIRSPIRVTransforms
MLIRStandardToLLVM
MLIRTransforms
MLIRTransformUtils
MLIRTestDialect
@ -55,8 +44,6 @@ set(LIBS
MLIRTestPass
MLIRTestTransforms
MLIRSupport
MLIRVectorToLLVM
MLIRVectorToLoops
MLIRIR
MLIROptLib
LLVMSupport

View File

@ -52,24 +52,20 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
set(LIBS
${dialect_libs}
${conversion_libs}
LLVMCore
LLVMSupport
MLIRJitRunner
MLIRAnalysis
MLIREDSC
MLIRExecutionEngine
MLIRGPUtoCUDATransforms
MLIRGPUtoNVVMTransforms
MLIRGPUtoSPIRVTransforms
MLIRGPUtoVulkanTransforms
MLIRIR
MLIRLLVMIR
MLIRLoopToStandard
MLIRParser
MLIRSPIRVTransforms
MLIRStandardToLLVM
MLIRSupport
MLIRTargetLLVMIR
MLIRTransforms