2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Shape/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file(GLOB globbed *.c *.cpp)
add_llvm_library(MLIRShape
add_mlir_dialect_library(MLIRShape
${globbed}

ADDITIONAL_HEADER_DIRS
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/StandardOps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_llvm_library(MLIRStandardOps
add_mlir_dialect_library(MLIRStandardOps
IR/Ops.cpp
EDSC/Builders.cpp
EDSC/Intrinsics.cpp
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/VectorOps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_llvm_library(MLIRVectorOps
add_mlir_dialect_library(MLIRVectorOps
VectorOps.cpp
VectorTransforms.cpp
VectorUtils.cpp
Expand Down
15 changes: 0 additions & 15 deletions mlir/lib/Support/JitRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Module.h"
#include "mlir/IR/StandardTypes.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Parser.h"
#include "mlir/Support/FileUtilities.h"

Expand All @@ -34,10 +33,8 @@
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
#include <numeric>

Expand Down Expand Up @@ -108,12 +105,6 @@ static OwningModuleRef parseMLIRInput(StringRef inputFilename,
return OwningModuleRef(parseSourceFile(sourceMgr, context));
}

// Initialize the relevant subsystems of LLVM.
static void initializeLLVM() {
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
}

static inline Error make_string_error(const Twine &message) {
return llvm::make_error<llvm::StringError>(message.str(),
llvm::inconvertibleErrorCode());
Expand Down Expand Up @@ -210,12 +201,6 @@ static Error compileAndExecuteSingleFloatReturnFunction(
int mlir::JitRunnerMain(
int argc, char **argv,
function_ref<LogicalResult(mlir::ModuleOp)> mlirTransformer) {
registerAllDialects();
llvm::InitLLVM y(argc, argv);

initializeLLVM();
mlir::initializeLLVMPasses();

llvm::cl::ParseCommandLineOptions(argc, argv, "MLIR CPU execution driver\n");

Optional<unsigned> optLevel = getCommandLineOptLevel();
Expand Down
3 changes: 2 additions & 1 deletion mlir/tools/mlir-cpu-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ add_llvm_tool(mlir-cpu-runner
mlir-cpu-runner.cpp
)
llvm_update_compile_flags(mlir-cpu-runner)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
target_link_libraries(mlir-cpu-runner PRIVATE
MLIRAllDialects
${dialect_libs}
MLIRAnalysis
MLIREDSC
MLIRExecutionEngine
Expand Down
10 changes: 10 additions & 0 deletions mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@
//
//===----------------------------------------------------------------------===//

#include "mlir/InitAllDialects.h"
#include "mlir/Support/JitRunner.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"
#include "mlir/ExecutionEngine/OptUtils.h"

int main(int argc, char **argv) {
mlir::registerAllDialects();
llvm::InitLLVM y(argc, argv);
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
mlir::initializeLLVMPasses();

return mlir::JitRunnerMain(argc, argv, nullptr);
}
19 changes: 4 additions & 15 deletions mlir/tools/mlir-cuda-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,19 @@ if(MLIR_CUDA_RUNNER_ENABLED)
${CUDA_RUNTIME_LIBRARY}
)

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
MLIRAffineOps
MLIRAnalysis
MLIREDSC
MLIRExecutionEngine
MLIRFxpMathOps
MLIRGPU
MLIRGPUtoCUDATransforms
MLIRGPUtoNVVMTransforms
MLIRIR
MLIRLLVMIR
MLIRLinalgOps
MLIRLoopToStandard
MLIROpenMP
MLIRParser
MLIRQuantOps
MLIRROCDLIR
MLIRSPIRV
MLIRSPIRV
MLIRStandardOps
MLIRStandardToLLVM
MLIRSupport
MLIRTargetLLVMIR
MLIRTransforms
Expand Down
9 changes: 9 additions & 0 deletions mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/IR/Function.h"
#include "mlir/IR/Module.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/JitRunner.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"

#include "cuda.h"

Expand Down Expand Up @@ -118,5 +122,10 @@ static LogicalResult runMLIRPasses(ModuleOp m) {

int main(int argc, char **argv) {
registerPassManagerCLOptions();
mlir::registerAllDialects();
llvm::InitLLVM y(argc, argv);
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
mlir::initializeLLVMPasses();
return mlir::JitRunnerMain(argc, argv, &runMLIRPasses);
}
35 changes: 4 additions & 31 deletions mlir/tools/mlir-opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,32 @@ target_link_libraries(MLIRMlirOptMain
${LIB_LIBS}
)

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
MLIRAffineOps
MLIRAffineToStandard
MLIRDialect
MLIRLoopsToGPU
MLIRLinalgToLLVM

MLIRLoopToStandard
MLIREDSC
MLIRFxpMathOps
MLIRGPU
MLIRGPUtoCUDATransforms
MLIRGPUtoNVVMTransforms
MLIRGPUtoROCDLTransforms
MLIRGPUtoSPIRVTransforms
MLIRGPUtoVulkanTransforms
MLIRLinalgOps
MLIRLinalgAnalysis
MLIRLinalgEDSC
MLIRLinalgTransforms
MLIRLinalgUtils
MLIRLLVMIR
MLIRLoopOps
MLIRNVVMIR
MLIROpenMP
MLIROptLib
MLIRParser
MLIRPass
MLIRQuantizerFxpMathConfig
MLIRQuantizerSupport
MLIRQuantizerTransforms
MLIRQuantOps
MLIRROCDLIR
MLIRSPIRV
MLIRLinalgToSPIRVTransforms
MLIRStandardToSPIRVTransforms
MLIRSPIRVTestPasses
MLIRSPIRVTransforms
MLIRStandardOps
MLIRStandardToLLVM
MLIRTransforms
MLIRTransformUtils
MLIRTestDialect
MLIRTestIR
MLIRTestPass
MLIRTestTransforms
MLIRSupport
MLIRVectorOps
MLIRVectorToLLVM
MLIRVectorToLoops
MLIRIR
MLIROptLib
LLVMSupport
Expand Down
3 changes: 2 additions & 1 deletion mlir/tools/mlir-translate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
set(LIBS
MLIRAllDialects
${dialect_libs}
MLIRParser
MLIRPass
MLIRSPIRV
Expand Down
19 changes: 4 additions & 15 deletions mlir/tools/mlir-vulkan-runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,21 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
${Vulkan_LIBRARY}
)

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
MLIRAffineOps
MLIRAnalysis
MLIREDSC
MLIRExecutionEngine
MLIRFxpMathOps
MLIRGPU
MLIRGPUtoCUDATransforms
MLIRGPUtoNVVMTransforms
MLIRGPUtoSPIRVTransforms
MLIRGPUtoVulkanTransforms
MLIRIR
MLIRLLVMIR
MLIRLinalgOps
MLIRLoopToStandard
MLIROpenMP
MLIRParser
MLIRQuantOps
MLIRROCDLIR
MLIRSPIRV
MLIRSPIRVTransforms
MLIRStandardOps
MLIRStandardToLLVM
MLIRSupport
MLIRTargetLLVMIR
MLIRTransforms
Expand Down
11 changes: 11 additions & 0 deletions mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
#include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/SPIRV/Passes.h"
#include "mlir/Dialect/SPIRV/SPIRVOps.h"
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/InitAllDialects.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/JitRunner.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"

using namespace mlir;

Expand All @@ -42,5 +46,12 @@ static LogicalResult runMLIRPasses(ModuleOp module) {
int main(int argc, char **argv) {
llvm::llvm_shutdown_obj x;
registerPassManagerCLOptions();

mlir::registerAllDialects();
llvm::InitLLVM y(argc, argv);
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
mlir::initializeLLVMPasses();

return mlir::JitRunnerMain(argc, argv, &runMLIRPasses);
}