Skip to content

Commit

Permalink
[HotFix] Fix DB install after #2347 (#2702)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Artur Wojcik <artur.wojcik@outlook.com>
Co-authored-by: Artur Wojcik <artur.wojcik@amd.com>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent 3485afe commit b9f6ef2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if(WIN32)
# Refer to https://en.cppreference.com/w/cpp/language/types for details.
target_compile_options(MIOpenDriver PRIVATE $<BUILD_INTERFACE:$<$<CXX_COMPILER_ID:Clang>:-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 "")
Expand Down
19 changes: 9 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,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 "")
Expand All @@ -907,9 +907,9 @@ if(NOT MIOPEN_EMBED_DB STREQUAL "")
add_embed_library(miopen_data ${CODE_OBJECTS})
target_link_libraries(MIOpen PRIVATE $<BUILD_INTERFACE:miopen_data> )
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
Expand All @@ -921,12 +921,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()

Expand Down

0 comments on commit b9f6ef2

Please sign in to comment.