Skip to content

Commit

Permalink
Merge branch 'main' into jvega/reshape_rm_on_device
Browse files Browse the repository at this point in the history
  • Loading branch information
jvegaTT authored Dec 4, 2024
2 parents 0e411b0 + d043973 commit b8ce2b0
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 62 deletions.
54 changes: 27 additions & 27 deletions tests/tt_metal/tt_metal/debug_tools/dprint/test_print_buffering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ using namespace tt::tt_metal;
namespace {
namespace CMAKE_UNIQUE_NAMESPACE {
const std::vector<string>& golden_output = {
"(0,0): This is a large DPRINT message that should not be interleaved with other DPRINT messages. (0,0): Adding "
"the alphabet to extend the size of this message: ABCDEFGHIJKLMNOPQRSTUVWXYZ. (0,0): Now, in reverse, to make it "
"even longer: ZYXWVUTSRQPONMLKJIHGFEDCBA.",
"(0,1): This is a large DPRINT message that should not be interleaved with other DPRINT messages. (0,1): Adding "
"the alphabet to extend the size of this message: ABCDEFGHIJKLMNOPQRSTUVWXYZ. (0,1): Now, in reverse, to make it "
"even longer: ZYXWVUTSRQPONMLKJIHGFEDCBA.",
"(0,2): This is a large DPRINT message that should not be interleaved with other DPRINT messages. (0,2): Adding "
"the alphabet to extend the size of this message: ABCDEFGHIJKLMNOPQRSTUVWXYZ. (0,2): Now, in reverse, to make it "
"even longer: ZYXWVUTSRQPONMLKJIHGFEDCBA.",
"(0,0): Once upon a time, in a small village, there was a little mouse named Tim. Tim wasn't like other mice. He "
"was brave and curious, always venturing into places others wouldn't dare. One day, while exploring the forest, he "
"found a big cheese trapped in a cage. Tim knew he had to help. Using his sharp teeth, he gnawed through the bars "
"and set the cheese free. To his surprise, a kind old owl had been watching and offered him a gift - the ability "
"to talk to all creatures. From that day on, Tim helped others, becoming a hero in the animal kingdom. And so, the "
"little mouse learned that bravery and kindness can change the world.",
"(0,1): Once upon a time, in a small village, there was a little mouse named Tim. Tim wasn't like other mice. He "
"was brave and curious, always venturing into places others wouldn't dare. One day, while exploring the forest, he "
"found a big cheese trapped in a cage. Tim knew he had to help. Using his sharp teeth, he gnawed through the bars "
"and set the cheese free. To his surprise, a kind old owl had been watching and offered him a gift - the ability "
"to talk to all creatures. From that day on, Tim helped others, becoming a hero in the animal kingdom. And so, the "
"little mouse learned that bravery and kindness can change the world.",
"(0,2): Once upon a time, in a small village, there was a little mouse named Tim. Tim wasn't like other mice. He "
"was brave and curious, always venturing into places others wouldn't dare. One day, while exploring the forest, he "
"found a big cheese trapped in a cage. Tim knew he had to help. Using his sharp teeth, he gnawed through the bars "
"and set the cheese free. To his surprise, a kind old owl had been watching and offered him a gift - the ability "
"to talk to all creatures. From that day on, Tim helped others, becoming a hero in the animal kingdom. And so, the "
"little mouse learned that bravery and kindness can change the world.",
"(0,0): This is a large DPRINT message that should not be interleaved with other DPRINT messages. (0,0): Adding \
the alphabet to extend the size of this message: ABCDEFGHIJKLMNOPQRSTUVWXYZ. (0,0): Now, in reverse, to make it \
even longer: ZYXWVUTSRQPONMLKJIHGFEDCBA.",
"(0,1): This is a large DPRINT message that should not be interleaved with other DPRINT messages. (0,1): Adding \
the alphabet to extend the size of this message: ABCDEFGHIJKLMNOPQRSTUVWXYZ. (0,1): Now, in reverse, to make it \
even longer: ZYXWVUTSRQPONMLKJIHGFEDCBA.",
"(0,2): This is a large DPRINT message that should not be interleaved with other DPRINT messages. (0,2): Adding \
the alphabet to extend the size of this message: ABCDEFGHIJKLMNOPQRSTUVWXYZ. (0,2): Now, in reverse, to make it \
even longer: ZYXWVUTSRQPONMLKJIHGFEDCBA.",
"(0,0): Once upon a time, in a small village, there was a little mouse named Tim. Tim wasn't like other mice. He \
was brave and curious, always venturing into places others wouldn't dare. One day, while exploring the forest, he \
found a big cheese trapped in a cage. Tim knew he had to help. Using his sharp teeth, he gnawed through the bars \
and set the cheese free. To his surprise, a kind old owl had been watching and offered him a gift - the ability \
to talk to all creatures. From that day on, Tim helped others, becoming a hero in the animal kingdom. And so, the \
little mouse learned that bravery and kindness can change the world.",
"(0,1): Once upon a time, in a small village, there was a little mouse named Tim. Tim wasn't like other mice. He \
was brave and curious, always venturing into places others wouldn't dare. One day, while exploring the forest, he \
found a big cheese trapped in a cage. Tim knew he had to help. Using his sharp teeth, he gnawed through the bars \
and set the cheese free. To his surprise, a kind old owl had been watching and offered him a gift - the ability \
to talk to all creatures. From that day on, Tim helped others, becoming a hero in the animal kingdom. And so, the \
little mouse learned that bravery and kindness can change the world.",
"(0,2): Once upon a time, in a small village, there was a little mouse named Tim. Tim wasn't like other mice. He \
was brave and curious, always venturing into places others wouldn't dare. One day, while exploring the forest, he \
found a big cheese trapped in a cage. Tim knew he had to help. Using his sharp teeth, he gnawed through the bars \
and set the cheese free. To his surprise, a kind old owl had been watching and offered him a gift - the ability \
to talk to all creatures. From that day on, Tim helped others, becoming a hero in the animal kingdom. And so, the \
little mouse learned that bravery and kindness can change the world.",
"(0,0): This DPRINT message",
"contains several newline characters",
"and should be displayed over multiple lines.",
Expand Down
4 changes: 2 additions & 2 deletions tt_metal/hw/firmware/src/brisc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ inline __attribute__((always_inline)) void reset_ncrisc_with_iram() {
inline void set_ncrisc_kernel_resume_deassert_address() {
#ifdef NCRISC_HAS_IRAM
volatile tt_reg_ptr uint32_t* cfg_regs = core.cfg_regs_base(0);
WAYPOINT("INW");
WAYPOINT("INRW");
while (mailboxes->ncrisc_halt.resume_addr == 0);
WAYPOINT("IND");
WAYPOINT("INRD");
cfg_regs[NCRISC_RESET_PC_PC_ADDR32] = mailboxes->ncrisc_halt.resume_addr;
#endif
}
Expand Down
59 changes: 30 additions & 29 deletions tt_metal/hw/inc/dataflow_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,11 @@ void noc_async_read_one_packet(
Read responses - assigned VCs dynamically
*/

WAYPOINT("RPW");
WAYPOINT("RP2W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP2D");

WAYPOINT("NARW");
WAYPOINT("NAOW");
DEBUG_SANITIZE_NOC_READ_TRANSACTION(noc, src_noc_addr, dst_local_l1_addr, size);

NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_RET_ADDR_LO, dst_local_l1_addr);
Expand All @@ -767,7 +767,7 @@ void noc_async_read_one_packet(
NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_CMD_CTRL, NOC_CTRL_SEND_REQ);
noc_reads_num_issued[noc] += 1;

WAYPOINT("NARD");
WAYPOINT("NAOD");
}

// TODO: write docs
Expand All @@ -779,11 +779,11 @@ void noc_async_read_one_packet_set_state(std::uint64_t src_noc_addr, std::uint32
Read responses - assigned VCs dynamically
*/

WAYPOINT("RPW");
WAYPOINT("RP3W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP3D");

WAYPOINT("NARW");
WAYPOINT("NASW");

#ifdef ARCH_BLACKHOLE
// Handles reading from PCIe
Expand All @@ -796,7 +796,7 @@ void noc_async_read_one_packet_set_state(std::uint64_t src_noc_addr, std::uint32
(uint32_t)(src_noc_addr >> NOC_ADDR_COORD_SHIFT) & NOC_COORDINATE_MASK);
NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_AT_LEN_BE, size);

WAYPOINT("NARD");
WAYPOINT("NASD");
}

// TODO: write docs
Expand All @@ -809,11 +809,11 @@ FORCE_INLINE void noc_async_read_one_packet_with_state(
Read responses - assigned VCs dynamically
*/

WAYPOINT("RPW");
WAYPOINT("RP4W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP4D");

WAYPOINT("NARW");
WAYPOINT("NATW");

// In order to sanitize, need to grab full noc addr + xfer size from state.
DEBUG_SANITIZE_NOC_READ_TRANSACTION_WITH_ADDR_AND_SIZE_STATE(noc, src_noc_addr, dst_local_l1_addr);
Expand All @@ -826,7 +826,7 @@ FORCE_INLINE void noc_async_read_one_packet_with_state(
noc_reads_num_issued[noc] += 1;
}

WAYPOINT("NARD");
WAYPOINT("NATD");
}

// TODO: write docs
Expand All @@ -837,10 +837,11 @@ void noc_async_read_set_state(std::uint64_t src_noc_addr, uint8_t noc = noc_inde
Read responses - assigned VCs dynamically
*/

WAYPOINT("NARW");
WAYPOINT("RPW");
WAYPOINT("RP5W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP5D");

WAYPOINT("NAUW");

#ifdef ARCH_BLACKHOLE
// Handles reading from PCIe
Expand All @@ -852,7 +853,7 @@ void noc_async_read_set_state(std::uint64_t src_noc_addr, uint8_t noc = noc_inde
NOC_TARG_ADDR_COORDINATE,
(uint32_t)(src_noc_addr >> NOC_ADDR_COORD_SHIFT) & NOC_COORDINATE_MASK);

WAYPOINT("NARD");
WAYPOINT("NAUD");
}

// TODO: write docs
Expand All @@ -863,15 +864,15 @@ FORCE_INLINE void noc_async_read_with_state(
Read requests - use static VC
Read responses - assigned VCs dynamically
*/
WAYPOINT("NARW");
WAYPOINT("NAVW");

// In order to sanitize, need to grab full noc addr + xfer size from state.
DEBUG_SANITIZE_NOC_READ_TRANSACTION_WITH_ADDR_STATE(noc, src_noc_addr, dst_local_l1_addr, size);

while (size > NOC_MAX_BURST_SIZE) {
WAYPOINT("RPW");
WAYPOINT("RP6W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP6D");

NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_RET_ADDR_LO, dst_local_l1_addr);
NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_TARG_ADDR_LO, src_noc_addr);
Expand All @@ -886,9 +887,9 @@ FORCE_INLINE void noc_async_read_with_state(
}

// left-over packet
WAYPOINT("RPW");
WAYPOINT("RP7W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP7D");

NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_RET_ADDR_LO, dst_local_l1_addr);
NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_TARG_ADDR_LO, src_noc_addr);
Expand All @@ -898,7 +899,7 @@ FORCE_INLINE void noc_async_read_with_state(
noc_reads_num_issued[noc] += 1;
}

WAYPOINT("NARD");
WAYPOINT("NAVD");
}

FORCE_INLINE
Expand Down Expand Up @@ -954,7 +955,7 @@ void noc_async_write_multicast_one_packet(
bool linked = false,
bool multicast_path_reserve = true,
uint8_t noc = noc_index) {
WAYPOINT("NMPW");
WAYPOINT("NWPW");
DEBUG_SANITIZE_NOC_MULTI_WRITE_TRANSACTION(noc, dst_noc_addr_multicast, src_local_l1_addr, size);
while (!noc_cmd_buf_ready(noc, write_cmd_buf));
WAYPOINT("NWPD");
Expand Down Expand Up @@ -1253,9 +1254,9 @@ struct InterleavedPow2AddrGenFast {
uint32_t src_addr = this->get_addr(id, bank_offset_index, bank_index, offset);
uint32_t src_noc_xy = interleaved_addr_gen::get_noc_xy<DRAM>(bank_index, noc);

WAYPOINT("RPW");
WAYPOINT("RP1W");
while (!noc_cmd_buf_ready(noc, read_cmd_buf));
WAYPOINT("RPD");
WAYPOINT("RP1D");
DEBUG_SANITIZE_NOC_READ_TRANSACTION(noc, get_noc_addr_helper(src_noc_xy, src_addr), dest_addr, size);

NOC_CMD_BUF_WRITE_REG(noc, read_cmd_buf, NOC_RET_ADDR_LO, dest_addr);
Expand Down Expand Up @@ -1549,7 +1550,7 @@ inline void noc_semaphore_set_multicast(
bool linked = false,
bool multicast_path_reserve = true,
uint8_t noc = noc_index) {
WAYPOINT("NSMW");
WAYPOINT("NSNW");
DEBUG_SANITIZE_NOC_MULTI_WRITE_TRANSACTION(noc, dst_noc_addr_multicast, src_local_l1_addr, 4);
ncrisc_noc_fast_write_any_len<proc_type, noc_mode>(
noc,
Expand All @@ -1562,7 +1563,7 @@ inline void noc_semaphore_set_multicast(
linked,
num_dests,
multicast_path_reserve);
WAYPOINT("NSMD");
WAYPOINT("NSND");
}
/**
* Initiates an asynchronous write from a source address in L1 memory on the
Expand Down Expand Up @@ -1598,7 +1599,7 @@ inline void noc_semaphore_set_multicast_loopback_src(
bool linked = false,
bool multicast_path_reserve = true,
uint8_t noc = noc_index) {
WAYPOINT("NSMW");
WAYPOINT("NSLW");
DEBUG_SANITIZE_NOC_MULTI_WRITE_TRANSACTION(noc, dst_noc_addr_multicast, src_local_l1_addr, 4);
ncrisc_noc_fast_write_any_len_loopback_src<proc_type, noc_mode>(
noc,
Expand All @@ -1611,7 +1612,7 @@ inline void noc_semaphore_set_multicast_loopback_src(
linked,
num_dests,
multicast_path_reserve);
WAYPOINT("NSMD");
WAYPOINT("NSLD");
}

inline void noc_async_write_multicast_loopback_src(
Expand Down
8 changes: 4 additions & 4 deletions tt_metal/impl/dispatch/kernels/cq_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ template <enum CQNocFlags flags, enum CQNocWait wait = CQ_NOC_WAIT, enum CQNocSe
FORCE_INLINE void cq_noc_async_write_with_state(
uint32_t src_addr, uint64_t dst_addr, uint32_t size = 0, uint32_t ndests = 1) {
if constexpr (wait) {
WAYPOINT("NSSW");
WAYPOINT("CNSW");
while (!noc_cmd_buf_ready(noc_index, NCRISC_WR_CMD_BUF));
WAYPOINT("NSSD");
WAYPOINT("CNSD");
}

if constexpr (flags & CQ_NOC_FLAG_SRC) {
Expand Down Expand Up @@ -184,12 +184,12 @@ uint32_t cq_noc_async_write_with_state_any_len(

template <enum CQNocFlags flags, bool mcast = false, bool linked = false>
FORCE_INLINE void cq_noc_async_write_init_state(uint32_t src_addr, uint64_t dst_addr, uint32_t size = 0) {
WAYPOINT("NSIW");
WAYPOINT("CNIW");
uint32_t heartbeat = 0;
while (!noc_cmd_buf_ready(noc_index, NCRISC_WR_CMD_BUF)) {
IDLE_ERISC_HEARTBEAT_AND_RETURN(heartbeat);
}
WAYPOINT("NSID");
WAYPOINT("CNID");

constexpr bool multicast_path_reserve = true;
constexpr bool posted = false;
Expand Down

0 comments on commit b8ce2b0

Please sign in to comment.