Skip to content

Commit

Permalink
sw: Adding dma count for hero
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilKoe committed May 2, 2024
1 parent f420b44 commit 4120e61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions target/sim/sw/device/apps/libomptarget_device/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "sw_mailbox.h"
#include "snrt.h"

volatile uint32_t dma_wait_cycles = 0;

//================================================================================
// MACROS AND SETTINGS
//================================================================================
Expand Down Expand Up @@ -252,6 +254,8 @@ static int gomp_offload_manager() {
// snrt_reset_perf_counter(SNRT_PERF_CNT1);
// snrt_start_perf_counter(SNRT_PERF_CNT0, SNRT_PERF_CNT_ISSUE_FPU, core_id);
// snrt_start_perf_counter(SNRT_PERF_CNT1, SNRT_PERF_CNT_DMA_BUSY, core_id);
cycles = read_csr(mcycle);
dma_wait_cycles = 0;

offloadFn(offloadArgs);
// snrt_stop_perf_counter(SNRT_PERF_CNT0);
Expand All @@ -268,6 +272,7 @@ static int gomp_offload_manager() {
mailbox_write(MBOX_DEVICE_DONE);
cycles = read_csr(mcycle) - cycles;
mailbox_write(cycles);
mailbox_write(dma_wait_cycles);

//if (DEBUG_LEVEL_OFFLOAD_MANAGER > 0)
// snrt_trace("Kernel execution time [Snitch cycles] = %d\n", cycles);
Expand Down Expand Up @@ -302,8 +307,6 @@ int main(int argc, char *argv[]) {

__snrt_omp_bootstrap(core_idx);

//snrt_trace("omp_bootstrap complete, core_idx: %d core_num: %d\n", core_idx, core_num);

gomp_offload_manager();

//snrt_trace("bye\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int syscall(uint64_t which, uint64_t arg0, uint64_t arg1, uint64_t arg2,
ret = rb_device_put(rb, (void *)magic_mem);
if (ret) {
++retries;
csleep(1000000);
csleep(10);
}
} while (ret != 0);
return retries;
Expand Down

0 comments on commit 4120e61

Please sign in to comment.