From 0a9dad4681850f7e95cb72697e7617ee22bd87a5 Mon Sep 17 00:00:00 2001 From: Jun Liu Date: Fri, 26 Jan 2024 22:30:54 -0800 Subject: [PATCH 1/2] Fix DB install after --- src/CMakeLists.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b857d1d371..23ab985f85 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -893,9 +893,9 @@ if(NOT MIOPEN_EMBED_DB STREQUAL "") # embed find db foreach(EMBED_ARCH ${MIOPEN_EMBED_DB}) message(STATUS "Adding find db for arch: ${EMBED_ARCH}") - list(APPEND CODE_OBJECTS "kernels/${EMBED_ARCH}.${MIOPEN_BACKEND}.fdb.txt") + list(APPEND CODE_OBJECTS "${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/${EMBED_ARCH}.${MIOPEN_BACKEND}.fdb.txt") message(STATUS "Adding perf db for arch: ${EMBED_ARCH}") - list(APPEND CODE_OBJECTS "kernels/${EMBED_ARCH}.db") + list(APPEND CODE_OBJECTS "${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/${EMBED_ARCH}.db") endforeach() # Embed Bin Cache if(NOT MIOPEN_BINCACHE_PATH STREQUAL "") @@ -908,9 +908,9 @@ if(NOT MIOPEN_EMBED_DB STREQUAL "") add_embed_library(miopen_data ${CODE_OBJECTS}) target_link_libraries(MIOpen PRIVATE $ ) else() - file(GLOB FIND_DB_FILES kernels/*.fdb.txt) - file(GLOB PERF_DB_FILES kernels/*.db) - file(GLOB KERN_DB_FILES kernels/*.kdb) + file(GLOB FIND_DB_FILES ${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/*.fdb.txt) + file(GLOB PERF_DB_FILES ${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/*.db) + file(GLOB KERN_DB_FILES ${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/*.kdb) list(APPEND FIND_DB_FILES ${PERF_DB_FILES}) # Install the kdb files for the kdb sync test only, a better approach would be to # install the kdb package instead @@ -922,12 +922,11 @@ endif() install(FILES ${FIND_DB_FILES} DESTINATION ${DATABASE_INSTALL_DIR}) - endif() - foreach(DB_FILE ${FIND_DB_FILES}) + endif() + foreach(DB_FILE ${FIND_DB_FILES}) get_filename_component(DB_FILE_FILENAME "${DB_FILE}" NAME) - configure_file("${DB_FILE}" "${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/${DB_FILE_FILENAME}" COPYONLY) - endforeach() - + configure_file("${DB_FILE}" "${PROJECT_BINARY_DIR}/${DATABASE_INSTALL_DIR}/${DB_FILE_FILENAME}" COPYONLY) + endforeach() endif() endif() From 331a3328ee9f57410d458737a3dcedf6ec09e631 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Tue, 30 Jan 2024 15:41:40 +0100 Subject: [PATCH 2/2] generate kernels when building MIOpenDriver --- CMakeLists.txt | 3 +++ driver/CMakeLists.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e80ff8d20f..ae5bb73b79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -488,12 +488,15 @@ set(KERNELS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src/kernels) find_program(UNZIPPER lbzcat bzcat REQUIRED) file(MAKE_DIRECTORY ${KERNELS_BINARY_DIR}) +add_custom_target(generate_kernels ALL) + function(unpack_db db_bzip2_file) get_filename_component(__fname ${db_bzip2_file} NAME_WLE) add_custom_command(OUTPUT ${KERNELS_BINARY_DIR}/${__fname} COMMAND ${UNZIPPER} -k ${db_bzip2_file} > ${KERNELS_BINARY_DIR}/${__fname}) string(REPLACE "." "_" __tname ${__fname}) add_custom_target(generate_${__tname} ALL DEPENDS ${KERNELS_BINARY_DIR}/${__fname}) + add_dependencies(generate_kernels generate_${__tname}) endfunction() file(GLOB PERF_DB_BZIP_FILES CONFIGURE_DEPENDS "${KERNELS_SOURCE_DIR}/*.db.bz2") diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt index 50ec0e6804..7d4fdbb528 100644 --- a/driver/CMakeLists.txt +++ b/driver/CMakeLists.txt @@ -31,6 +31,7 @@ if(WIN32) # Refer to https://en.cppreference.com/w/cpp/language/types for details. target_compile_options(MIOpenDriver PRIVATE $:-U__LP64__>>) endif() +add_dependencies(MIOpenDriver generate_kernels) target_include_directories(MIOpenDriver PRIVATE ../src/kernels) target_link_libraries(MIOpenDriver MIOpen Threads::Threads) if(NOT MIOPEN_EMBED_DB STREQUAL "")