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 16, 2024
1 parent b0d4004 commit 664b7a1
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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}
)
20 changes: 14 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
unified-memory-framework::umf
unified-memory-framework::headers
unified-memory-framework::disjoint_pool
${CMAKE_DL_LIBS}
${PROJECT_NAME}::headers
)
Expand All @@ -64,3 +58,17 @@ if (UNIX)
find_package(Threads REQUIRED)
target_link_libraries(ur_common PUBLIC Threads::Threads)
endif()

add_library(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
unified-memory-framework::umf
unified-memory-framework::headers
unified-memory-framework::disjoint_pool
)
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 664b7a1

Please sign in to comment.