Skip to content

Commit

Permalink
transformer: debug cluster2cluster DMA transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
Viviane Potocnik committed Oct 23, 2023
1 parent e9eb039 commit 3d6ad32
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions sw/apps/transformer/src/transformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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();

}

Expand Down

0 comments on commit 3d6ad32

Please sign in to comment.