From c11d4c03e867ae148ada3991ad8fc9c475669918 Mon Sep 17 00:00:00 2001 From: Artem Yerofieiev <169092593+ayerofieiev-tt@users.noreply.github.com> Date: Mon, 17 Jun 2024 09:02:22 -0700 Subject: [PATCH] #9457: Re-enable PCH (#9461) #9457: re-enable pch --- CMakeLists.txt | 12 ++++++------ tt_eager/tt_dnn/op_library/CMakeLists.txt | 18 +++++++++--------- tt_eager/tt_lib/CMakeLists.txt | 2 +- ttnn/CMakeLists.txt | 9 ++++----- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bbce94ae3c..c315db90207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,12 +148,12 @@ else() endif() # Can't use the `REUSE_FROM` option bc tt_lib and ttnn have different build flags :( -# add_library(pch_pybinds INTERFACE) -# target_precompile_headers(pch_pybinds INTERFACE -# ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include/pybind11/operators.h -# ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include/pybind11/pybind11.h -# ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include/pybind11/stl.h -# ) +add_library(pch_pybinds INTERFACE) +target_precompile_headers(pch_pybinds INTERFACE + ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include/pybind11/operators.h + ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include/pybind11/pybind11.h + ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include/pybind11/stl.h +) ############################################################################################################################ # Build subdirectories diff --git a/tt_eager/tt_dnn/op_library/CMakeLists.txt b/tt_eager/tt_dnn/op_library/CMakeLists.txt index 168d7958e7e..3a6183f275e 100644 --- a/tt_eager/tt_dnn/op_library/CMakeLists.txt +++ b/tt_eager/tt_dnn/op_library/CMakeLists.txt @@ -224,12 +224,12 @@ target_include_directories(tt_dnn PUBLIC ${PROJECT_SOURCE_DIR}/tt_metal/third_party/fmt ) -# target_precompile_headers(tt_dnn PUBLIC -# ${PROJECT_SOURCE_DIR}/tt_metal/third_party/magic_enum/magic_enum.hpp -# ${PROJECT_SOURCE_DIR}/tt_metal/third_party/tracy/public/tracy/Tracy.hpp -# ${CMAKE_CURRENT_SOURCE_DIR}/auto_format.hpp -# ${CMAKE_CURRENT_SOURCE_DIR}/compute_kernel_config.hpp -# ${CMAKE_CURRENT_SOURCE_DIR}/operation.hpp -# ${CMAKE_CURRENT_SOURCE_DIR}/run_operation.hpp -# ${CMAKE_CURRENT_SOURCE_DIR}/work_split.hpp -# ) +target_precompile_headers(tt_dnn PUBLIC + ${PROJECT_SOURCE_DIR}/tt_metal/third_party/magic_enum/magic_enum.hpp + ${PROJECT_SOURCE_DIR}/tt_metal/third_party/tracy/public/tracy/Tracy.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/auto_format.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/compute_kernel_config.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/operation.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/run_operation.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/work_split.hpp +) diff --git a/tt_eager/tt_lib/CMakeLists.txt b/tt_eager/tt_lib/CMakeLists.txt index ed825ad448f..88c9592984c 100644 --- a/tt_eager/tt_lib/CMakeLists.txt +++ b/tt_eager/tt_lib/CMakeLists.txt @@ -13,7 +13,7 @@ set(TT_LIB_SRCS # TODO: should be using pybind11_add_module, but right now it introduces many build problems # pybinds will always be built as a shared library add_library(tt_lib SHARED ${TT_LIB_SRCS}) -target_link_libraries(tt_lib PUBLIC compiler_flags linker_flags tt_eager tt_metal) # linker_flags = -rdynamic if tracy enabled +target_link_libraries(tt_lib PUBLIC compiler_flags linker_flags tt_eager tt_metal pch_pybinds) # linker_flags = -rdynamic if tracy enabled target_include_directories(tt_lib PUBLIC ${UMD_HOME} ${PROJECT_SOURCE_DIR} diff --git a/ttnn/CMakeLists.txt b/ttnn/CMakeLists.txt index 610be36ac60..a41af512f75 100644 --- a/ttnn/CMakeLists.txt +++ b/ttnn/CMakeLists.txt @@ -20,16 +20,15 @@ target_include_directories(ttnn_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cpp ${PROJECT_SOURCE_DIR}/tt_metal/third_party/fmt ) -# target_precompile_headers(ttnn_lib PRIVATE -# ${PROJECT_SOURCE_DIR}/tt_metal/third_party/magic_enum/magic_enum.hpp -# ) - +target_precompile_headers(ttnn_lib PRIVATE + ${PROJECT_SOURCE_DIR}/tt_metal/third_party/magic_enum/magic_enum.hpp +) # TODO: should be using pybind11_add_module, but right now it introduces many build problems # pybinds will always be built as a shared library add_library(ttnn SHARED ${PROJECT_SOURCE_DIR}/ttnn/cpp/pybind11/__init__.cpp $) target_compile_options(ttnn PUBLIC -Wno-int-to-pointer-cast -fno-var-tracking) -target_link_libraries(ttnn PUBLIC compiler_flags linker_flags tt_eager) # linker_flags = -rdynamic if tracy enabled +target_link_libraries(ttnn PUBLIC compiler_flags linker_flags tt_eager pch_pybinds) # linker_flags = -rdynamic if tracy enabled target_include_directories(ttnn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cpp ${PROJECT_SOURCE_DIR}/tt_metal/third_party/pybind11/include