Skip to content

Commit

Permalink
Revert "[Windows] use find_package() for Eigen and frugally-deep (#2574
Browse files Browse the repository at this point in the history
…)"

This reverts commit 4150134.
  • Loading branch information
junliume committed Dec 15, 2023
1 parent 709e289 commit 1f7ffde
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
52 changes: 34 additions & 18 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -733,26 +733,42 @@ if(BUILD_TESTING)
endif()

if(MIOPEN_ENABLE_AI_KERNEL_TUNING OR MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
find_package(frugally-deep CONFIG REQUIRED GLOBAL)
find_package(Eigen3 REQUIRED GLOBAL)
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()
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()
endif()

set(PACKAGE_DEPENDS)
set(PACKAGE_STATIC_DEPENDS)
############################################################
# MIOpen depends on OpenCL
if( MIOPEN_BACKEND STREQUAL "OpenCL")
Expand Down
3 changes: 2 additions & 1 deletion test/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function(add_gtest TEST_NAME)
target_compile_options(test_${TEST_NAME} PRIVATE -Wno-global-constructors -Wno-undef)
target_include_directories(test_${TEST_NAME} PRIVATE ../ ../../src/kernels)
if(MIOPEN_ENABLE_AI_KERNEL_TUNING)
target_link_libraries(test_${TEST_NAME} frugally-deep::fdeep Eigen3::Eigen)
target_include_directories(test_${TEST_NAME} SYSTEM PRIVATE $<BUILD_INTERFACE:${FDEEP_INCLUDE_DIR}>)
target_include_directories(test_${TEST_NAME} SYSTEM PRIVATE $<BUILD_INTERFACE:${EIGEN_INCLUDE_DIR}/eigen3>)
endif()
target_link_libraries(test_${TEST_NAME} GTest::gtest GTest::gtest_main MIOpen ${Boost_LIBRARIES} hip::host $<BUILD_INTERFACE:roc::rocblas>)
if(NOT MIOPEN_EMBED_DB STREQUAL "")
Expand Down

0 comments on commit 1f7ffde

Please sign in to comment.