Skip to content

Commit

Permalink
#10016: jit_build: link substitutes, tdma_xmov, noc
Browse files Browse the repository at this point in the history
  • Loading branch information
aliuTT committed Sep 19, 2024
1 parent a6eee0a commit c43b899
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tt_metal/hw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ add_custom_command(
add_custom_command(
OUTPUT tdma_xmov
COMMAND ${CMAKE_COMMAND} -E make_directory ${HW_LIB_DIR}
COMMAND ${GPP_CMD} ${GPP_FLAGS} ${GPP_DEFINES} ${GPP_INCLUDES} -c -o ${HW_LIB_DIR}/tdma_xmov.o ${PROJECT_SOURCE_DIR}/tt_metal/hw/firmware/src/tdma_xmov.c
COMMAND ${GPP_CMD} ${GPP_FLAGS} ${GPP_DEFINES} ${GPP_INCLUDES} -Os -fno-tree-loop-distribute-patterns -c -o ${HW_LIB_DIR}/tdma_xmov.o ${PROJECT_SOURCE_DIR}/tt_metal/hw/firmware/src/tdma_xmov.c
COMMENT "Building hw lib tdma_xmov.o"
VERBATIM
)

add_custom_command(
OUTPUT noc
COMMAND ${CMAKE_COMMAND} -E make_directory ${HW_LIB_DIR}
COMMAND ${GPP_CMD} ${GPP_FLAGS} ${GPP_DEFINES} ${GPP_INCLUDES} -c -o ${HW_LIB_DIR}/noc.o ${PROJECT_SOURCE_DIR}/tt_metal/hw/firmware/src/${ALIAS_ARCH_NAME}/noc.c
COMMAND ${GPP_CMD} ${GPP_FLAGS} ${GPP_DEFINES} ${GPP_INCLUDES} -Os -fno-tree-loop-distribute-patterns -c -o ${HW_LIB_DIR}/noc.o ${PROJECT_SOURCE_DIR}/tt_metal/hw/firmware/src/${ALIAS_ARCH_NAME}/noc.c
COMMENT "Building hw lib noc.o"
VERBATIM
)
Expand Down
1 change: 0 additions & 1 deletion tt_metal/hw/firmware/src/brisck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "ckernel_structs.h"
#include "stream_io_map.h"
#include "c_tensix_core.h"
#include "tdma_xmov.h"
#include "noc_nonblocking_api.h"
#include "firmware_common.h"
#include "tools/profiler/kernel_profiler.hpp"
Expand Down
18 changes: 7 additions & 11 deletions tt_metal/jit_build/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ void JitBuildState::finish_init() {
// Append hw build objects compiled offline
std::string build_dir = llrt::OptionsG.get_root_dir() + "runtime/hw/lib/";
if (this->is_fw_) {
if (this->target_name_ == "brisc") {
this->link_objs_ += build_dir + "tdma_xmov.o ";
}
if (this->target_name_ != "erisc") {
this->link_objs_ += build_dir + "tmu-crt0.o ";
}
Expand All @@ -177,6 +180,10 @@ void JitBuildState::finish_init() {
} else {
this->link_objs_ += build_dir + "tmu-crt0k.o ";
}
if (this->target_name_ == "brisc" or this->target_name_ == "idle_erisc") {
this->link_objs_ += build_dir + "noc.o ";
}
this->link_objs_ += build_dir + "substitutes.o ";

// Note the preceding slash which defies convention as this gets appended to
// the kernel name used as a path which doesn't have a slash
Expand All @@ -198,9 +205,6 @@ JitBuildDataMovement::JitBuildDataMovement(const JitBuildEnv& env, int which, bo

uint32_t l1_cache_disable_mask = tt::llrt::OptionsG.get_feature_riscv_mask(tt::llrt::RunTimeDebugFeatureDisableL1DataCache);

// TODO(pgk): build these once at init into built/libs!
this->srcs_.push_back("tt_metal/hw/toolchain/substitutes.cpp");

this->lflags_ = env_.lflags_ + "-Os ";

switch (this->core_id_) {
Expand All @@ -211,9 +215,6 @@ JitBuildDataMovement::JitBuildDataMovement(const JitBuildEnv& env, int which, bo
if ((l1_cache_disable_mask & tt::llrt::DebugHartFlags::RISCV_BR) == tt::llrt::DebugHartFlags::RISCV_BR) {
this->defines_ += "-DDISABLE_L1_DATA_CACHE ";
}

this->srcs_.push_back("tt_metal/hw/firmware/src/tdma_xmov.c");
this->srcs_.push_back("tt_metal/hw/firmware/src/" + env_.aliased_arch_name_ + "/noc.c");
if (this->is_fw_) {
this->srcs_.push_back("tt_metal/hw/firmware/src/brisc.cc");
} else {
Expand Down Expand Up @@ -270,7 +271,6 @@ JitBuildCompute::JitBuildCompute(const JitBuildEnv& env, int which, bool is_fw)
"tt_metal/third_party/sfpi/include " + "-I" + env_.root_ + "tt_metal/hw/firmware/src " + "-I" +
env_.root_ + "tt_metal/third_party/tt_llk_" + env.arch_name_ + "/llk_lib ";

this->srcs_.push_back("tt_metal/hw/toolchain/substitutes.cpp");
if (this->is_fw_) {
this->srcs_.push_back("tt_metal/hw/firmware/src/trisc.cc");
} else {
Expand Down Expand Up @@ -348,7 +348,6 @@ JitBuildEthernet::JitBuildEthernet(const JitBuildEnv& env, int which, bool is_fw

this->includes_ += "-I " + env_.root_ + "tt_metal/hw/inc/ethernet ";

this->srcs_.push_back("tt_metal/hw/toolchain/substitutes.cpp");
if (this->is_fw_) {
this->srcs_.push_back("tt_metal/hw/firmware/src/erisc.cc");
this->srcs_.push_back("tt_metal/hw/toolchain/erisc-early-exit.S");
Expand Down Expand Up @@ -383,9 +382,6 @@ JitBuildEthernet::JitBuildEthernet(const JitBuildEnv& env, int which, bool is_fw

this->includes_ += "-I " + env_.root_ + "tt_metal/hw/firmware/src ";

// TODO(pgk): build these once at init into built/libs!
this->srcs_.push_back("tt_metal/hw/toolchain/substitutes.cpp");
this->srcs_.push_back("tt_metal/hw/firmware/src/" + env_.aliased_arch_name_ + "/noc.c");
if (this->is_fw_) {
this->srcs_.push_back("tt_metal/hw/firmware/src/idle_erisc.cc");
} else {
Expand Down

0 comments on commit c43b899

Please sign in to comment.