Skip to content

Commit

Permalink
#4984: Revert to 16bit alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-tenstorrent committed Sep 12, 2024
1 parent 76f7a71 commit bae3b81
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tt_metal/hw/inc/blackhole/dev_mem_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@

#define MEM_BOOT_CODE_BASE 0
#define MEM_L1_BARRIER 12
#define MEM_MAILBOX_BASE 48
#define MEM_MAILBOX_BASE 16
// Magic size must be big enough to hold dev_msgs_t. static_asserts will fire if this is too small
#define MEM_MAILBOX_SIZE 5 * 4 * 512 + 4 * 32 + 1364 + 8 * 4
#define MEM_MAILBOX_SIZE 5 * 4 * 512 + 4 * 32 + 1364
#define MEM_MAILBOX_END (MEM_MAILBOX_BASE + MEM_MAILBOX_SIZE)
#define MEM_IERISC_MAILBOX_BASE 1024
#define MEM_IERISC_MAILBOX_END (MEM_IERISC_MAILBOX_BASE + 128)
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/hw/inc/blackhole/eth_l1_address_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct address_map {
// erisc early exit functionality re-uses mailboxes_t::ncrisc_halt_msg_t::stack_save memory
static constexpr std::int32_t ERISC_MEM_MAILBOX_STACK_SAVE = ERISC_MEM_MAILBOX_BASE + 4;

static constexpr std::uint32_t ERISC_MEM_MAILBOX_END = ERISC_MEM_MAILBOX_BASE + 288 + 256 + 16 + (32 + 512) * 4 + 64;
static constexpr std::uint32_t ERISC_MEM_MAILBOX_END = ERISC_MEM_MAILBOX_BASE + 288 + 256 + 16 + (32 + 512) * 4;

static constexpr std::int32_t ERISC_L1_KERNEL_CONFIG_BASE = ERISC_MEM_MAILBOX_END;
static constexpr std::int32_t ERISC_L1_UNRESERVED_BASE = ERISC_L1_KERNEL_CONFIG_BASE + ERISC_L1_KERNEL_CONFIG_SIZE;
Expand Down
13 changes: 6 additions & 7 deletions tt_metal/hw/inc/dev_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,18 @@ struct dprint_buf_msg_t {


// NOC aligment max from BH
static constexpr uint32_t TT_ARCH_MAX_NOC_ALIGNMENT = 64;
static constexpr uint32_t TT_ARCH_MAX_NOC_WRITE_ALIGNMENT = 16;

// TODO: when device specific headers specify number of processors
// (and hal abstracts them on host), get these from there (same as above for dprint)
#if defined(COMPILE_FOR_ERISC) || defined (COMPILE_FOR_IDLE_ERISC)
static constexpr uint32_t PROFILER_RISC_COUNT = 1;
static constexpr uint32_t PROFILER_NOC_ALIGMENT_PAD_COUNT = 14;
#else
static constexpr uint32_t PROFILER_RISC_COUNT = 5;
static constexpr uint32_t PROFILER_NOC_ALIGMENT_PAD_COUNT = 2;
#endif

static constexpr uint32_t LAUNCH_NOC_ALIGMENT_PAD_COUNT = 1;
static constexpr uint32_t PROFILER_NOC_ALIGMENT_PAD_COUNT = 2;

struct profiler_msg_t {
uint32_t control_vector[kernel_profiler::PROFILER_L1_CONTROL_VECTOR_SIZE];
Expand Down Expand Up @@ -281,14 +280,14 @@ static_assert(
#endif
#if defined(COMPILE_FOR_ERISC) || defined (COMPILE_FOR_IDLE_ERISC)
static_assert( eth_l1_mem::address_map::ERISC_MEM_MAILBOX_BASE + sizeof(mailboxes_t) < eth_l1_mem::address_map::ERISC_MEM_MAILBOX_END);
static constexpr uint32_t ETH_LAUNCH_CHECK = (eth_l1_mem::address_map::ERISC_MEM_MAILBOX_BASE + offsetof(mailboxes_t, launch)) % TT_ARCH_MAX_NOC_ALIGNMENT;
static constexpr uint32_t ETH_PROFILER_CHECK = (eth_l1_mem::address_map::ERISC_MEM_MAILBOX_BASE + offsetof(mailboxes_t, profiler)) % TT_ARCH_MAX_NOC_ALIGNMENT;
static constexpr uint32_t ETH_LAUNCH_CHECK = (eth_l1_mem::address_map::ERISC_MEM_MAILBOX_BASE + offsetof(mailboxes_t, launch)) % TT_ARCH_MAX_NOC_WRITE_ALIGNMENT;
static constexpr uint32_t ETH_PROFILER_CHECK = (eth_l1_mem::address_map::ERISC_MEM_MAILBOX_BASE + offsetof(mailboxes_t, profiler)) % TT_ARCH_MAX_NOC_WRITE_ALIGNMENT;
static_assert( ETH_LAUNCH_CHECK == 0);
static_assert( ETH_PROFILER_CHECK == 0);
#else
static_assert(MEM_MAILBOX_BASE + sizeof(mailboxes_t) < MEM_MAILBOX_END);
static constexpr uint32_t TENSIX_LAUNCH_CHECK = (MEM_MAILBOX_BASE + offsetof(mailboxes_t, launch)) % TT_ARCH_MAX_NOC_ALIGNMENT;
static constexpr uint32_t TENSIX_PROFILER_CHECK = (MEM_MAILBOX_BASE + offsetof(mailboxes_t, profiler)) % TT_ARCH_MAX_NOC_ALIGNMENT;
static constexpr uint32_t TENSIX_LAUNCH_CHECK = (MEM_MAILBOX_BASE + offsetof(mailboxes_t, launch)) % TT_ARCH_MAX_NOC_WRITE_ALIGNMENT;
static constexpr uint32_t TENSIX_PROFILER_CHECK = (MEM_MAILBOX_BASE + offsetof(mailboxes_t, profiler)) % TT_ARCH_MAX_NOC_WRITE_ALIGNMENT;
static_assert( TENSIX_LAUNCH_CHECK == 0);
static_assert( TENSIX_PROFILER_CHECK == 0);
#endif
Expand Down
4 changes: 2 additions & 2 deletions tt_metal/hw/inc/grayskull/dev_mem_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

#define MEM_BOOT_CODE_BASE 0
#define MEM_L1_BARRIER 12
#define MEM_MAILBOX_BASE 48
#define MEM_MAILBOX_BASE 16
// Magic size must be big enough to hold dev_msgs_t. static_asserts will fire if this is too small
#define MEM_MAILBOX_SIZE 5 * 2 * 1024 + 128 + 1364 + 8 * 4
#define MEM_MAILBOX_SIZE 5 * 2 * 1024 + 128 + 1364
#define MEM_MAILBOX_END (MEM_MAILBOX_BASE + MEM_MAILBOX_SIZE)
#define MEM_IERISC_MAILBOX_BASE 0
#define MEM_IERISC_MAILBOX_END 0
Expand Down
4 changes: 2 additions & 2 deletions tt_metal/hw/inc/wormhole/dev_mem_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@

#define MEM_BOOT_CODE_BASE 0
#define MEM_L1_BARRIER 12
#define MEM_MAILBOX_BASE 48
#define MEM_MAILBOX_BASE 16
// Magic size must be big enough to hold dev_msgs_t. static_asserts will fire if this is too small
#define MEM_MAILBOX_SIZE 5 * 4 * 512 + 4 * 32 + 1364 + 8 * 4
#define MEM_MAILBOX_SIZE 5 * 4 * 512 + 4 * 32 + 1364
#define MEM_MAILBOX_END (MEM_MAILBOX_BASE + MEM_MAILBOX_SIZE)
#define MEM_IERISC_MAILBOX_BASE 1024
#define MEM_IERISC_MAILBOX_END (MEM_IERISC_MAILBOX_BASE + 128)
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/hw/inc/wormhole/eth_l1_address_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct address_map {
// erisc early exit functionality re-uses mailboxes_t::ncrisc_halt_msg_t::stack_save memory
static constexpr std::int32_t ERISC_MEM_MAILBOX_STACK_SAVE = ERISC_MEM_MAILBOX_BASE + 4;

static constexpr std::uint32_t ERISC_MEM_MAILBOX_END = ERISC_MEM_MAILBOX_BASE + 288 + 256 + 16 + (512 + 32) * 4 + 64;
static constexpr std::uint32_t ERISC_MEM_MAILBOX_END = ERISC_MEM_MAILBOX_BASE + 288 + 256 + 16 + (512 + 32) * 4;

static constexpr std::int32_t ERISC_L1_KERNEL_CONFIG_BASE = ERISC_MEM_MAILBOX_END;
static constexpr std::int32_t ERISC_L1_UNRESERVED_BASE = ERISC_L1_KERNEL_CONFIG_BASE + ERISC_L1_KERNEL_CONFIG_SIZE;
Expand Down

0 comments on commit bae3b81

Please sign in to comment.