Skip to content

Commit

Permalink
extract snrt_global_dm_core_barrier
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbarton committed Jan 17, 2024
1 parent 459f106 commit 4a152c2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sw/snRuntime/src/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ inline void snrt_cluster_hw_barrier() {
asm volatile("csrr x0, 0x7C2" ::: "memory");
}

/// Synchronize clusters globally with a global software barrier
inline void snrt_global_barrier() {
snrt_cluster_hw_barrier();

/// Synchronize all DM cores with a software barrier
inline void snrt_global_dm_core_barrier() {
// Synchronize all DM cores in software
if (snrt_is_dm_core()) {
// Get barrier in cluster 0 tcdm
Expand All @@ -82,8 +80,13 @@ inline void snrt_global_barrier() {
while (prev_barrier_iteration == tcdm_barrier->iteration);
}
}
// Synchronize cores in a cluster with the HW barrier
snrt_cluster_hw_barrier();
}

/// Synchronize clusters globally with a global software barrier
inline void snrt_global_barrier() {
snrt_cluster_hw_barrier(); // DM core waits for cluster compute cores to enter
snrt_global_dm_core_barrier(); // DM core signals it's cluster is ready and waits for other clusters
snrt_cluster_hw_barrier(); // Compute cores wait for DM to exit the barrier
}

inline uint32_t snrt_global_all_to_all_reduction(uint32_t value) {
Expand Down

0 comments on commit 4a152c2

Please sign in to comment.