Skip to content

Commit

Permalink
[build] link TTBinary lib in tt-mlir shared lib (#325)
Browse files Browse the repository at this point in the history
Also fixes incremental build break. When doing a build
after `cmake --build build -- clean` - the build fails
(cannot find libdevice.so). I don't think we need to
link against this lib, so it is removed.
  • Loading branch information
pilkicTT authored Aug 8, 2024
1 parent 52ecaf0 commit 3b627dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/SharedLib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Runtime libs from tt-mlir
set(TTNN_RUNTIME_LIBS TTRuntime TTRuntimeTTNN)
set(TTNN_RUNTIME_LIBS TTRuntime TTRuntimeTTNN TTBinary)

# Dependency libs from tt-metal/ttnn project for ttnn runtime
set(TTNN_LIBS TTMETAL_LIBRARY DEVICE_LIBRARY TTEAGER_LIBRARY TTNN_LIBRARY)
set(TTNN_LIBS TTMETAL_LIBRARY TTEAGER_LIBRARY TTNN_LIBRARY)

# Libs from tt-mlir project
set(TTMLIR_LIBS
Expand Down
8 changes: 3 additions & 5 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ set(TTMETAL_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/third_party/tt-metal/src/tt-metal-
set(TTNN_LIBRARY_PATH ${TTMETAL_LIBRARY_DIR}/_ttnn.so)
set(TTMETAL_LIBRARY_PATH ${TTMETAL_LIBRARY_DIR}/libtt_metal.so)
set(TTEAGER_LIBRARY_PATH ${TTMETAL_LIBRARY_DIR}/libtt_eager.so)
set(DEVICE_LIBRARY_PATH ${TTMETAL_LIBRARY_DIR}/libdevice.so)

set(TTMETAL_LIBRARY_DIR ${TTMETAL_LIBRARY_DIR} PARENT_SCOPE)
set(TTNN_LIBRARY_PATH ${TTNN_LIBRARY_PATH} PARENT_SCOPE)
set(TTMETAL_LIBRARY_PATH ${TTMETAL_LIBRARY_PATH} PARENT_SCOPE)
set(TTEAGER_LIBRARY_PATH ${TTEAGER_LIBRARY_PATH} PARENT_SCOPE)
set(DEVICE_LIBRARY_PATH ${DEVICE_LIBRARY_PATH} PARENT_SCOPE)

ExternalProject_Add(
tt-metal
Expand All @@ -59,13 +57,13 @@ ExternalProject_Add(
GIT_REPOSITORY https://github.com/tenstorrent/tt-metal.git
GIT_TAG v0.49.0
GIT_PROGRESS ON
BUILD_BYPRODUCTS ${TTNN_LIBRARY_PATH} ${TTMETAL_LIBRARY_PATH} ${TTEAGER_LIBRARY_PATH} ${DEVICE_LIBRARY_PATH}
BUILD_BYPRODUCTS ${TTNN_LIBRARY_PATH} ${TTMETAL_LIBRARY_PATH} ${TTEAGER_LIBRARY_PATH}
)

set_target_properties(tt-metal PROPERTIES EXCLUDE_FROM_ALL TRUE)

list(APPEND library_names TTNN_LIBRARY TTMETAL_LIBRARY TTEAGER_LIBRARY DEVICE_LIBRARY)
list(APPEND library_paths ${TTNN_LIBRARY_PATH} ${TTMETAL_LIBRARY_PATH} ${TTEAGER_LIBRARY_PATH} ${DEVICE_LIBRARY_PATH})
list(APPEND library_names TTNN_LIBRARY TTMETAL_LIBRARY TTEAGER_LIBRARY)
list(APPEND library_paths ${TTNN_LIBRARY_PATH} ${TTMETAL_LIBRARY_PATH} ${TTEAGER_LIBRARY_PATH})

foreach(lib_name lib_path IN ZIP_LISTS library_names library_paths)
add_library(${lib_name} SHARED IMPORTED GLOBAL)
Expand Down

0 comments on commit 3b627dd

Please sign in to comment.