Skip to content

[mlir][execution engine] turn on ENABLE_AGGREGATION for runtimes #71860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions mlir/cmake/modules/AddMLIR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,15 @@ endfunction()
# are compatible with building an object library.
function(add_mlir_library name)
cmake_parse_arguments(ARG
"SHARED;INSTALL_WITH_TOOLCHAIN;EXCLUDE_FROM_LIBMLIR;DISABLE_INSTALL;ENABLE_AGGREGATION"
"SHARED;INSTALL_WITH_TOOLCHAIN;INSTALL_OBJECT_LIB;EXCLUDE_FROM_LIBMLIR;DISABLE_INSTALL;ENABLE_AGGREGATION"
""
"ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS"
${ARGN})
_set_mlir_additional_headers_as_srcs(${ARG_ADDITIONAL_HEADERS})

# Is an object library needed.
set(NEEDS_OBJECT_LIB OFF)
if(ARG_ENABLE_AGGREGATION)
if(ARG_ENABLE_AGGREGATION OR ARG_INSTALL_OBJECT_LIB)
set(NEEDS_OBJECT_LIB ON)
endif()

Expand Down Expand Up @@ -375,7 +375,7 @@ function(add_mlir_library name)
# For each declared dependency, transform it into a generator expression
# which excludes it if the ultimate link target is excluding the library.
set(NEW_LINK_LIBRARIES)
get_target_property(CURRENT_LINK_LIBRARIES ${name} LINK_LIBRARIES)
get_target_property(CURRENT_LINK_LIBRARIES ${name} LINK_LIBRARIES)
get_mlir_filtered_link_libraries(NEW_LINK_LIBRARIES ${CURRENT_LINK_LIBRARIES})
set_target_properties(${name} PROPERTIES LINK_LIBRARIES "${NEW_LINK_LIBRARIES}")
list(APPEND AGGREGATE_DEPS ${NEW_LINK_LIBRARIES})
Expand All @@ -393,6 +393,12 @@ function(add_mlir_library name)
add_mlir_library_install(obj.${name})
endif()
endif()
if(ARG_INSTALL_OBJECT_LIB)
if(TARGET install-obj.${name})
else ()
add_mlir_library_install(obj.${name})
endif()
endif()
endfunction(add_mlir_library)

macro(add_mlir_tool name)
Expand Down
15 changes: 12 additions & 3 deletions mlir/lib/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ add_mlir_library(MLIRExecutionEngine
ExecutionEngine.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
Expand Down Expand Up @@ -93,13 +94,14 @@ add_mlir_library(MLIRExecutionEngine
MLIRLLVMToLLVMIRTranslation
MLIROpenMPToLLVMIRTranslation
MLIRTargetLLVMIRExport
)
)

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
add_mlir_library(MLIRJitRunner
JitRunner.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB

DEPENDS
intrinsics_gen
Expand Down Expand Up @@ -130,7 +132,8 @@ if(LLVM_ENABLE_PIC)
Float16bits.cpp

EXCLUDE_FROM_LIBMLIR
)
INSTALL_OBJECT_LIB
)
set_property(TARGET mlir_float16_utils PROPERTY CXX_STANDARD 17)
target_compile_definitions(mlir_float16_utils PRIVATE mlir_float16_utils_EXPORTS)

Expand All @@ -142,12 +145,13 @@ if(LLVM_ENABLE_PIC)
SparseTensorRuntime.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB

LINK_LIBS PUBLIC
mlir_float16_utils
MLIRSparseTensorEnums
MLIRSparseTensorRuntime
)
)
set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 17)
target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)

Expand All @@ -156,6 +160,7 @@ if(LLVM_ENABLE_PIC)
RunnerUtils.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB
)
target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)

Expand All @@ -164,6 +169,7 @@ if(LLVM_ENABLE_PIC)
AsyncRuntime.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB

LINK_LIBS PUBLIC
${LLVM_PTHREAD_LIB}
Expand Down Expand Up @@ -197,6 +203,7 @@ if(LLVM_ENABLE_PIC)
CudaRuntimeWrappers.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB
)
set_property(TARGET mlir_cuda_runtime PROPERTY CXX_STANDARD 14)

Expand Down Expand Up @@ -293,6 +300,7 @@ if(LLVM_ENABLE_PIC)
RocmRuntimeWrappers.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB
)

# Supress compiler warnings from HIP headers
Expand Down Expand Up @@ -348,6 +356,7 @@ if(LLVM_ENABLE_PIC)
SyclRuntimeWrappers.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB
)

check_cxx_compiler_flag("-frtti" CXX_HAS_FRTTI_FLAG)
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_mlir_library(MLIRSparseTensorRuntime
Storage.cpp

EXCLUDE_FROM_LIBMLIR
INSTALL_OBJECT_LIB

LINK_LIBS PUBLIC
MLIRSparseTensorEnums
Expand Down