Skip to content

Commit

Permalink
#9767: add reflect library to common intf library `metal_header_direc…
Browse files Browse the repository at this point in the history
…tories`

- remove unecessary linking
- move CPM for boost-ext/reflect into dependencies.cmake
  • Loading branch information
vtangTT committed Jun 28, 2024
1 parent 0d67d1b commit 22fcc0a
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 25 deletions.
11 changes: 1 addition & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@ if (NOT NUMA_LIBRARY)
message(FATAL_ERROR "NUMA library not found")
endif()


CPMAddPackage(
NAME reflect
GITHUB_REPOSITORY boost-ext/reflect
GIT_TAG v1.1.1
)
add_library(reflect INTERFACE)
target_include_directories(reflect SYSTEM INTERFACE ${reflect_SOURCE_DIR})
add_library(reflect::reflect ALIAS reflect)

############################################################################################################################
# Constructing interface libs for common compiler flags, header directories, and libraries
# These interface libs are linked with PUBLIC scope at lowest common target (tt_metal/common) and at tt_metal_libs level
Expand Down Expand Up @@ -142,6 +132,7 @@ endif()

add_library(metal_header_directories INTERFACE)
target_include_directories(metal_header_directories INTERFACE ${PROJECT_SOURCE_DIR}/tt_metal/hw/inc)
target_include_directories(metal_header_directories SYSTEM INTERFACE ${reflect_SOURCE_DIR})
foreach(lib ${BoostPackages})
target_include_directories(metal_header_directories INTERFACE ${Boost${lib}_SOURCE_DIR}/include)
endforeach()
Expand Down
10 changes: 10 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,13 @@ if (googletest_ADDED)
target_link_libraries(gtest PRIVATE c++ c++abi)
target_link_libraries(gtest_main PRIVATE c++ c++abi)
endif()

############################################################################################################################
# boost-ext reflect : https://github.com/boost-ext/reflect
############################################################################################################################

CPMAddPackage(
NAME reflect
GITHUB_REPOSITORY boost-ext/reflect
GIT_TAG v1.1.1
)
4 changes: 2 additions & 2 deletions tests/tt_metal/tt_metal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

add_library(test_metal_common_libs INTERFACE)
target_link_libraries(test_metal_common_libs INTERFACE tt_metal test_common_libs reflect::reflect)
target_link_libraries(test_metal_common_libs INTERFACE tt_metal test_common_libs)

set (TT_METAL_TESTS
test_bmm
Expand Down Expand Up @@ -41,7 +41,7 @@ set (TT_METAL_TESTS

foreach (TEST ${TT_METAL_TESTS})
add_executable(${TEST} ${CMAKE_CURRENT_SOURCE_DIR}/${TEST})
target_link_libraries(${TEST} PUBLIC test_metal_common_libs reflect::reflect)
target_link_libraries(${TEST} PUBLIC test_metal_common_libs)
target_include_directories(${TEST} PRIVATE
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(UNIT_TESTS_COMMON_SRC
${CMAKE_CURRENT_SOURCE_DIR}/watcher/test_waypoint.cpp
)
add_library(unit_tests_common_o OBJECT ${UNIT_TESTS_COMMON_SRC})
target_link_libraries(unit_tests_common_o PUBLIC compiler_flags metal_header_directories gtest gtest_main reflect::reflect)
target_link_libraries(unit_tests_common_o PUBLIC compiler_flags metal_header_directories gtest gtest_main)
target_include_directories(unit_tests_common_o PUBLIC
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tests/ttnn/unit_tests/gtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(TTNN_UNIT_TESTS_SRC

add_executable(unit_tests_ttnn ${TTNN_UNIT_TESTS_SRC})

target_link_libraries(unit_tests_ttnn PUBLIC test_common_libs ttnn_lib tt_metal tt_eager reflect::reflect)
target_link_libraries(unit_tests_ttnn PUBLIC test_common_libs ttnn_lib tt_metal tt_eager)
target_include_directories(unit_tests_ttnn PRIVATE
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tt_eager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(TT_EAGER_OBJECTS

# Defaults to a shared lib, static lib for production python wheel
add_library(tt_eager ${TT_EAGER_OBJECTS})
target_link_libraries(tt_eager PUBLIC compiler_flags linker_flags tt_metal ttnn_lib reflect::reflect) # linker_flags = -rdynamic if tracy enabled
target_link_libraries(tt_eager PUBLIC compiler_flags linker_flags tt_metal ttnn_lib) # linker_flags = -rdynamic if tracy enabled
target_include_directories(tt_eager PUBLIC
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tt_eager/queue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(QUEUE_SRCS
)

add_library(queue OBJECT ${QUEUE_SRCS})
target_link_libraries(queue PUBLIC metal_header_directories compiler_flags reflect::reflect)
target_link_libraries(queue PUBLIC metal_header_directories compiler_flags)
target_include_directories(queue PUBLIC
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tt_eager/tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(TENSOR_SRCS

add_library(tensor OBJECT ${TENSOR_SRCS})

target_link_libraries(tensor PUBLIC metal_header_directories compiler_flags reflect::reflect)
target_link_libraries(tensor PUBLIC metal_header_directories compiler_flags)
target_include_directories(tensor PUBLIC
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tt_eager/tt_dnn/op_library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ set(TT_DNN_SRCS

add_library(tt_dnn OBJECT ${TT_DNN_SRCS})

target_link_libraries(tt_dnn PUBLIC metal_header_directories compiler_flags umd_device reflect::reflect)
target_link_libraries(tt_dnn PUBLIC metal_header_directories compiler_flags umd_device)
target_include_directories(tt_dnn PUBLIC
${UMD_HOME}
${PROJECT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(TT_METAL_OBJECTS

add_library(tt_metal ${TT_METAL_OBJECTS})

target_link_libraries(tt_metal PUBLIC umd_device metal_common_libs reflect::reflect)
target_link_libraries(tt_metal PUBLIC umd_device metal_common_libs)

target_precompile_headers(tt_metal PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/third_party/magic_enum/magic_enum.hpp
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/detail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set(DETAIL_SRC
${CMAKE_CURRENT_SOURCE_DIR}/reports/memory_reporter.cpp)

add_library(detail OBJECT ${DETAIL_SRC})
target_link_libraries(detail PUBLIC common reflect::reflect)
target_link_libraries(detail PUBLIC common)
2 changes: 1 addition & 1 deletion tt_metal/impl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(IMPL_SRC
)

add_library(impl OBJECT ${IMPL_SRC})
target_link_libraries(impl PRIVATE Boost::smart_ptr reflect::reflect)
target_link_libraries(impl PRIVATE Boost::smart_ptr)
target_link_libraries(impl PUBLIC common)

target_include_directories(impl PUBLIC ${PROJECT_SOURCE_DIR}/tt_metal ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/jit_build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set(JIT_BUILD_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/settings.cpp)

add_library(jit_build OBJECT ${JIT_BUILD_SRCS})
target_link_libraries(jit_build PUBLIC common reflect::reflect)
target_link_libraries(jit_build PUBLIC common)
2 changes: 1 addition & 1 deletion tt_metal/llrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ set(LLRT_SRC
${CMAKE_CURRENT_SOURCE_DIR}/tt_memory.cpp)

add_library(llrt OBJECT ${LLRT_SRC})
target_link_libraries(llrt PUBLIC common reflect::reflect)
target_link_libraries(llrt PUBLIC common)
target_compile_options(llrt PRIVATE -Wno-int-to-pointer-cast)
2 changes: 1 addition & 1 deletion tt_metal/tools/profiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set(PROFILER_SRC
${CMAKE_CURRENT_SOURCE_DIR}/tt_metal_profiler.cpp)

add_library(profiler OBJECT ${PROFILER_SRC})
target_link_libraries(profiler PUBLIC common reflect::reflect)
target_link_libraries(profiler PUBLIC common)
2 changes: 1 addition & 1 deletion ttnn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(TTNN_SRCS
add_library(ttnn_lib OBJECT ${TTNN_SRCS})
target_compile_options(ttnn_lib PUBLIC -MP -Wno-int-to-pointer-cast -fno-var-tracking)
target_link_libraries(ttnn_lib
PUBLIC compiler_flags metal_header_directories metal_common_libs reflect::reflect
PUBLIC compiler_flags metal_header_directories metal_common_libs
)
target_include_directories(ttnn_lib PUBLIC
${UMD_HOME}
Expand Down

0 comments on commit 22fcc0a

Please sign in to comment.