Skip to content

Commit

Permalink
improve linking to MLIR (#35)
Browse files Browse the repository at this point in the history
This change moves the configuration of the MLIR dependencies into the MLIR source directory, and reduces the number of MLIR dependencies to include only the necessary libraries.
  • Loading branch information
ls-1801 authored Aug 30, 2024
1 parent 4654fd6 commit f26ad2f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 44 deletions.
41 changes: 0 additions & 41 deletions cmake/AddMLIR.cmake

This file was deleted.

10 changes: 9 additions & 1 deletion nautilus/src/nautilus/compiler/backends/CompilationBackend.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#include "nautilus/compiler/backends/CompilationBackend.hpp"
#include "nautilus/config.hpp"
#ifdef ENABLE_ASMJIT_BACKEND
#include "nautilus/compiler/backends/amsjit/AsmJitCompilationBackend.hpp"
#endif
#ifdef ENABLE_BC_BACKEND
#include "nautilus/compiler/backends/bc/BCInterpreterBackend.hpp"
#endif
#ifdef ENABLE_C_BACKEND
#include "nautilus/compiler/backends/cpp/CPPCompilationBackend.hpp"
#endif
#ifdef ENABLE_MLIR_BACKEND
#include "nautilus/compiler/backends/mlir/MLIRCompilationBackend.hpp"
#include "nautilus/config.hpp"
#endif
#include "nautilus/exceptions/RuntimeException.hpp"

namespace nautilus::compiler {
Expand Down
26 changes: 24 additions & 2 deletions nautilus/src/nautilus/compiler/backends/mlir/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@

if (ENABLE_MLIR_BACKEND)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../cmake/AddMLIR.cmake)
find_package(MLIR REQUIRED CONFIG)
message(STATUS MLIR_INCLUDE_DIRS=${MLIR_INCLUDE_DIRS})
target_include_directories(nautilus SYSTEM PRIVATE
$<BUILD_INTERFACE:${MLIR_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:include/nebulastream/>)
add_compile_definitions(MLIR_COMPILER)
get_property(mlir_libs GLOBAL PROPERTY MLIR_ALL_LIBS)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}")
message(STATUS "mlir_libs: ${mlir_libs}")
message(STATUS "dialect_libs: ${dialect_libs}")
message(STATUS "conversion_libs: ${conversion_libs}")
message(STATUS "extension_libs: ${extension_libs}")
target_link_libraries(nautilus
PRIVATE
MLIRExecutionEngine
MLIRFuncAllExtensions
# Dialects
MLIRSCFDialect
MLIRFuncToLLVM
MLIRSCFToControlFlow
)

add_source_files(nautilus
MLIRLoweringProvider.cpp
Expand Down

0 comments on commit f26ad2f

Please sign in to comment.