Skip to content

Commit

Permalink
Remove UMF from ur::common
Browse files Browse the repository at this point in the history
and make a separate ur_umf interface library.
This way, components that do not require UMF (e.g. loader)
do not need to link with it.
  • Loading branch information
igchor committed Mar 28, 2024
1 parent 0e14ea5 commit e4b1d3b
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions source/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ endif()
target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
${PROJECT_NAME}::umf
Threads::Threads
cudadrv
)
Expand Down
2 changes: 2 additions & 0 deletions source/adapters/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ if("${UR_HIP_PLATFORM}" STREQUAL "AMD")
target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
${PROJECT_NAME}::umf
rocmdrv
)

Expand Down Expand Up @@ -173,6 +174,7 @@ elseif("${UR_HIP_PLATFORM}" STREQUAL "NVIDIA")
target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
${PROJECT_NAME}::umf
Threads::Threads
cudadrv
cudart
Expand Down
1 change: 1 addition & 0 deletions source/adapters/level_zero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ endif()
target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
${PROJECT_NAME}::umf
LevelZeroLoader
LevelZeroLoader-Headers
)
Expand Down
1 change: 1 addition & 0 deletions source/adapters/native_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ find_package(Threads REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
${PROJECT_NAME}::umf
Threads::Threads
)

Expand Down
1 change: 1 addition & 0 deletions source/adapters/opencl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ target_include_directories(${TARGET_NAME} PRIVATE
target_link_libraries(${TARGET_NAME} PRIVATE
${PROJECT_NAME}::headers
${PROJECT_NAME}::common
${PROJECT_NAME}::umf
Threads::Threads
${OpenCLICDLoaderLibrary}
)
21 changes: 15 additions & 6 deletions source/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

add_ur_library(ur_common STATIC
umf_helpers.hpp
umf_pools/disjoint_pool_config_parser.cpp
ur_pool_manager.hpp
ur_util.cpp
ur_util.hpp
$<$<PLATFORM_ID:Windows>:windows/ur_lib_loader.cpp>
Expand Down Expand Up @@ -51,9 +48,6 @@ FetchContent_MakeAvailable(unified-memory-framework)
FetchContent_GetProperties(unified-memory-framework)

target_link_libraries(ur_common PUBLIC
umf::umf
umf::headers
umf::disjoint_pool
${CMAKE_DL_LIBS}
${PROJECT_NAME}::headers
)
Expand All @@ -64,3 +58,18 @@ if (UNIX)
find_package(Threads REQUIRED)
target_link_libraries(ur_common PUBLIC Threads::Threads)
endif()

add_library(ur_umf INTERFACE)
target_sources(ur_umf INTERFACE
umf_helpers.hpp
umf_pools/disjoint_pool_config_parser.cpp
ur_pool_manager.hpp
)

add_library(${PROJECT_NAME}::umf ALIAS ur_umf)

target_link_libraries(ur_umf INTERFACE
umf::umf
umf::headers
umf::disjoint_pool
)
2 changes: 1 addition & 1 deletion test/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ target_include_directories(test-adapter-cuda PRIVATE
${PROJECT_SOURCE_DIR}/source/adapters/cuda
)

target_link_libraries(test-adapter-cuda PRIVATE cudadrv)
target_link_libraries(test-adapter-cuda PRIVATE cudadrv ${PROJECT_NAME}::umf)
2 changes: 1 addition & 1 deletion test/adapters/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ target_compile_definitions(test-adapter-hip PRIVATE
${HIP_COMPILE_DEFINITIONS}
)

target_link_libraries(test-adapter-hip PRIVATE rocmdrv)
target_link_libraries(test-adapter-hip PRIVATE rocmdrv ${PROJECT_NAME}::umf)
1 change: 1 addition & 0 deletions test/usm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function(add_usm_test name)
PRIVATE
${PROJECT_NAME}::common
${PROJECT_NAME}::loader
${PROJECT_NAME}::umf
ur_testing
GTest::gtest_main)
add_test(NAME usm-${name}
Expand Down

0 comments on commit e4b1d3b

Please sign in to comment.