Skip to content
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

use find_package() for Eigen and frugally-deep #2574

Merged
merged 5 commits into from
Dec 14, 2023
Merged
Changes from 3 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
52 changes: 18 additions & 34 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -716,42 +716,26 @@ target_link_libraries(MIOpen PRIVATE ${CMAKE_DL_LIBS} Threads::Threads ${BZIP2_L
miopen_generate_export_header(MIOpen)

if(MIOPEN_ENABLE_AI_KERNEL_TUNING OR MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
find_path(FDEEP_INCLUDE_DIR "fdeep/fdeep.hpp")
if(${FDEEP_INCLUDE_DIR} STREQUAL "FDEEP_INCLUDE_DIR-NOTFOUND")
if(MIOPEN_ENABLE_AI_KERNEL_TUNING)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_KERNEL_TUNING requirement frugally-deep not found")
endif()
if(MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK requirement frugally-deep not found")
endif()
endif()

find_path(EIGEN_INCLUDE_DIR "eigen3/Eigen/Core")
if(${EIGEN_INCLUDE_DIR} STREQUAL "EIGEN_INCLUDE_DIR-NOTFOUND")
if(MIOPEN_ENABLE_AI_KERNEL_TUNING)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_KERNEL_TUNING requirement Eigen not found")
endif()
if(MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
message(FATAL_ERROR "MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK requirement frugally-deep not found")
endif()
endif()

target_include_directories(MIOpen SYSTEM PRIVATE $<BUILD_INTERFACE:${FDEEP_INCLUDE_DIR}>)
target_include_directories(MIOpen SYSTEM PRIVATE $<BUILD_INTERFACE:${EIGEN_INCLUDE_DIR}/eigen3>)
if(NOT BUILD_DEV)
file(GLOB MODEL_FILES kernels/*.model)
if( NOT ENABLE_ASAN_PACKAGING )
install(FILES ${MODEL_FILES} DESTINATION ${DATA_INSTALL_DIR}/db)
endif ()
foreach(MODEL_FILE ${MODEL_FILES})
get_filename_component(MODEL_FILE_FILENAME "${MODEL_FILE}" NAME)
configure_file("${MODEL_FILE}" "${PROJECT_BINARY_DIR}/share/miopen/db/${MODEL_FILE_FILENAME}" COPYONLY)
endforeach()
endif()
find_package(frugally-deep CONFIG REQUIRED)
find_package(Eigen3 REQUIRED)
target_link_libraries(MIOpen PRIVATE frugally-deep::fdeep Eigen3::Eigen)
if(NOT TARGET nlohmann_json)
# frugally-deep has broken linking to nlohmann_json
add_library(nlohmann_json INTERFACE IMPORTED GLOBAL)
target_link_libraries(nlohmann_json INTERFACE nlohmann_json::nlohmann_json)
endif()
if(NOT BUILD_DEV)
file(GLOB MODEL_FILES kernels/*.model)
if( NOT ENABLE_ASAN_PACKAGING )
install(FILES ${MODEL_FILES} DESTINATION ${DATA_INSTALL_DIR}/db)
endif ()
foreach(MODEL_FILE ${MODEL_FILES})
get_filename_component(MODEL_FILE_FILENAME "${MODEL_FILE}" NAME)
configure_file("${MODEL_FILE}" "${PROJECT_BINARY_DIR}/share/miopen/db/${MODEL_FILE_FILENAME}" COPYONLY)
endforeach()
endif()
endif()

set(PACKAGE_DEPENDS)
set(PACKAGE_STATIC_DEPENDS)
############################################################
# MIOpen depends on OpenCL
if( MIOPEN_BACKEND STREQUAL "OpenCL")
Expand Down