From 0e411b0f94383e0d25f87aa71e80a14ead2dcf01 Mon Sep 17 00:00:00 2001 From: Juan Camilo Vega Date: Wed, 4 Dec 2024 22:36:46 +0000 Subject: [PATCH] #0: addressing austin PR review changes on 15572 PR --- .../data_movement/common/kernels/common.hpp | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ttnn/cpp/ttnn/operations/data_movement/common/kernels/common.hpp b/ttnn/cpp/ttnn/operations/data_movement/common/kernels/common.hpp index dd302e8628f..6ab3a58f5cb 100644 --- a/ttnn/cpp/ttnn/operations/data_movement/common/kernels/common.hpp +++ b/ttnn/cpp/ttnn/operations/data_movement/common/kernels/common.hpp @@ -15,14 +15,12 @@ namespace tt::data_movement::common { -#define max_packet_size 8192 - template FORCE_INLINE void enhanced_noc_async_read( const uint64_t src_noc_addr, const uint32_t dst_l1_addr, const uint32_t bytes) { // If you do not know the max_transfer_size at compile time write 0 to it. // only reads is true if we ONLY use noc_async_read and all calls to tt_memmove have use_read_datamover as True - if constexpr (((max_transfer_size < max_packet_size) && (max_transfer_size != 0)) || only_reads) { + if constexpr (((max_transfer_size < NOC_MAX_BURST_SIZE) && (max_transfer_size != 0)) || only_reads) { noc_async_read_one_packet(src_noc_addr, dst_l1_addr, bytes); } else { noc_async_read(src_noc_addr, dst_l1_addr, bytes); @@ -34,21 +32,22 @@ FORCE_INLINE void enhanced_noc_async_write( const uint32_t src_l1_addr, const uint64_t dst_noc_addr, const uint32_t bytes) { // If you do not know the max_transfer_size at compile time write 0 to it. // only writes is true if we ONLY use noc_async_read and all calls to tt_memmove have use_read_datamover as False - if constexpr (((max_transfer_size < max_packet_size) && (max_transfer_size != 0)) || only_writes) { + if constexpr (((max_transfer_size < NOC_MAX_BURST_SIZE) && (max_transfer_size != 0)) || only_writes) { noc_async_write_one_packet(src_l1_addr, dst_noc_addr, bytes); } else { noc_async_write(src_l1_addr, dst_noc_addr, bytes); } } -template +template FORCE_INLINE void tt_memmove(const uint32_t dst_l1_addr, const uint32_t src_l1_addr, const uint32_t bytes) { - //Function performs a memory copy between two l1 addresses in the local core - //Uses noc_async_read when possible to copy the data over - //Set guaranteed 16B alligned to true if the source and destination are externally guaranteed to be 16B alligned (dangerous) - //Set copy_async to true if you wish to perform the operation asynchronously, in this case you can add a noc_async_read_barrier to synchronize later + // Function performs a memory copy between two l1 addresses in the local core + // Uses noc_async_read when possible to copy the data over + // Set guaranteed 16B aligned to true if the source and destination are externally guaranteed to be 16B aligned + // (dangerous) Set copy_async to true if you wish to perform the operation asynchronously, in this case you can add + // a noc_async_read_barrier to synchronize later if constexpr (use_read_datamover) { - if constexpr (guaranteed_16B_alligned) { + if constexpr (guaranteed_16B_aligned) { enhanced_noc_async_read(get_noc_addr(src_l1_addr), dst_l1_addr, bytes); if constexpr (!copy_async) { noc_async_read_barrier(); @@ -64,7 +63,7 @@ FORCE_INLINE void tt_memmove(const uint32_t dst_l1_addr, const uint32_t src_l1_a } } } else { - if constexpr (guaranteed_16B_alligned) { + if constexpr (guaranteed_16B_aligned) { enhanced_noc_async_write(src_l1_addr, get_noc_addr(dst_l1_addr), bytes); if constexpr (!copy_async) { noc_async_write_barrier();