From 3d6ad323b3b9d08a240e6d12d12bf6f3cc0bcc53 Mon Sep 17 00:00:00 2001 From: Viviane Potocnik Date: Mon, 23 Oct 2023 21:03:52 +0200 Subject: [PATCH] transformer: debug cluster2cluster DMA transfers --- sw/apps/transformer/src/transformer.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sw/apps/transformer/src/transformer.h b/sw/apps/transformer/src/transformer.h index 3c77c004e..20be4eaf8 100644 --- a/sw/apps/transformer/src/transformer.h +++ b/sw/apps/transformer/src/transformer.h @@ -964,6 +964,9 @@ static inline void transformer_layer_fp64(transformer_layer_fp64_t *const l) { // determine the destination address double *data_dst = cluster_ofmap_lin2 - (1 << level) * cl_offset; if (!snrt_is_compute_core()) { + for (int i = 0; i < B_r_lin2 * B_c_lin2; i++) { + dump_debug(ofmap_lin2[i]); + } // printf("cluster_id = %d, level = %d, data_src = %d, data_dst = %d\n", cluster_id, level, data_src, data_dst); snrt_dma_txid_t txid = snrt_dma_start_1d( @@ -972,23 +975,27 @@ static inline void transformer_layer_fp64(transformer_layer_fp64_t *const l) { ofmap_tcdm_lin2 * sizeof(double)); /* size */ snrt_dma_wait_all(); + + // for (int i = 0; i < B_r_lin2 * B_c_lin2; i++) { + // dump_debug(data_dst[i]); + // } } } snrt_cluster_hw_barrier(); // active clusters that are not a sender perform the addition of the partial tiles - if (is_active == 1 && is_sender == 0) { - // perform the addition - uint32_t row_offset = core_id * (B_r_lin2 / num_cores) * B_c_lin2; - for (int row = 0; row < B_r_lin2 / num_cores; row++) { - for (int col = 0; col < B_c_lin2; col++) { - ofmap_lin2[row_offset + row * B_c_lin2 + col] += cluster_ofmap_lin2[row_offset + row * B_c_lin2 + col]; - } - } - } + // if (is_active == 1 && is_sender == 0) { + // // perform the addition + // uint32_t row_offset = core_id * (B_r_lin2 / num_cores) * B_c_lin2; + // for (int row = 0; row < B_r_lin2 / num_cores; row++) { + // for (int col = 0; col < B_c_lin2; col++) { + // ofmap_lin2[row_offset + row * B_c_lin2 + col] += cluster_ofmap_lin2[row_offset + row * B_c_lin2 + col]; + // } + // } + // } - snrt_cluster_hw_barrier(); + // snrt_cluster_hw_barrier(); }