Skip to content

Commit

Permalink
Splitting python bindings and cpp in ttnn library, we will have ttnnc…
Browse files Browse the repository at this point in the history
…pp and ttnn, where ttnncpp will work as c++ backend while the ttnn library is the wrapper for python
  • Loading branch information
dgomezTT committed Feb 18, 2025
1 parent d6e7112 commit 6b955ed
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 244 deletions.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ install(
)
install(
TARGETS
ttnn
ttnncpp
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
Expand All @@ -301,6 +301,16 @@ install(
)
if(WITH_PYTHON_BINDINGS)
# Install .so into src files for pybinds implementation
install(
TARGETS
ttnn
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT dev
)

install(
TARGETS
ttnn
Expand Down
18 changes: 18 additions & 0 deletions build_metal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ show_help() {
echo " --toolchain-path Set path to CMake toolchain file."
echo " --configure-only Only configure the project, do not build."
echo " --enable-coverage Instrument the binaries for code coverage."
echo " --without-python-bindings Disable Python bindings, Enabled by default"
}

clean() {
Expand Down Expand Up @@ -73,6 +74,7 @@ ttnn_shared_sub_libs="OFF"
toolchain_path="cmake/x86_64-linux-clang-17-libcpp-toolchain.cmake"
configure_only="OFF"
enable_coverage="OFF"
with_python_bindings="ON"

declare -a cmake_args

Expand Down Expand Up @@ -111,6 +113,7 @@ ttnn-shared-sub-libs
toolchain-path:
configure-only
enable-coverage
without-python-bindings
"

# Flatten LONGOPTIONS into a comma-separated string for getopt
Expand Down Expand Up @@ -172,6 +175,8 @@ while true; do
ttnn_shared_sub_libs="ON";;
--configure-only)
configure_only="ON";;
--without-python-bindings)
with_python_bindings="OFF";;
--disable-unity-builds)
unity_builds="OFF";;
--disable-light-metal-trace)
Expand Down Expand Up @@ -245,6 +250,7 @@ echo "INFO: Build tests: $build_tests"
echo "INFO: Enable Unity builds: $unity_builds"
echo "INFO: TTNN Shared sub libs : $ttnn_shared_sub_libs"
echo "INFO: Enable Light Metal Trace: $light_metal_trace"
echo "INFO: With python bindings: $with_python_bindings"

# Prepare cmake arguments
cmake_args+=("-B" "$build_dir")
Expand Down Expand Up @@ -362,6 +368,18 @@ if [ "$build_all" = "ON" ]; then
cmake_args+=("-DBUILD_TT_TRAIN=ON")
fi

if [ "$light_metal_trace" = "ON" ]; then
cmake_args+=("-DTT_ENABLE_LIGHT_METAL_TRACE=ON")
else
cmake_args+=("-DTT_ENABLE_LIGHT_METAL_TRACE=OFF")
fi

if [ "$with_python_bindings" = "ON" ]; then
cmake_args+=("-DWITH_PYTHON_BINDINGS=ON")
else
cmake_args+=("-DWITH_PYTHON_BINDINGS=OFF")
fi

# toolchain and cxx_compiler settings would conflict with eachother
# only use toolchain if not setting cxx compiler directly
if [ "$cxx_compiler_path" == "" ]; then
Expand Down
Loading

0 comments on commit 6b955ed

Please sign in to comment.