CSRs I/O refactoring
This commit is contained in:
27
runtime/src/vx_perf.c
Normal file
27
runtime/src/vx_perf.c
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
#include <VX_config.h>
|
||||
#include <vx_intrinsics.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define DUMP_CSR_4(d, s) \
|
||||
csr_mem[d + 0] = vx_csr_read(s + 0); \
|
||||
csr_mem[d + 1] = vx_csr_read(s + 1); \
|
||||
csr_mem[d + 2] = vx_csr_read(s + 2); \
|
||||
csr_mem[d + 3] = vx_csr_read(s + 3);
|
||||
|
||||
#define DUMP_CSR_32(d, s) \
|
||||
DUMP_CSR_4(d + 0, s + 0) \
|
||||
DUMP_CSR_4(d + 4, s + 4) \
|
||||
DUMP_CSR_4(d + 8, s + 8) \
|
||||
DUMP_CSR_4(d + 12, s + 12) \
|
||||
DUMP_CSR_4(d + 16, s + 16) \
|
||||
DUMP_CSR_4(d + 20, s + 20) \
|
||||
DUMP_CSR_4(d + 24, s + 24) \
|
||||
DUMP_CSR_4(d + 28, s + 28)
|
||||
|
||||
void vx_perf_dump() {
|
||||
int core_id = vx_core_id();
|
||||
uint32_t* const csr_mem = (uint32_t*)(IO_ADDR_CSR + 64 * sizeof(uint32_t) * core_id);
|
||||
DUMP_CSR_32(0, CSR_MPM_BASE)
|
||||
DUMP_CSR_32(32, CSR_MPM_BASE_H)
|
||||
}
|
||||
@@ -42,6 +42,9 @@ _start:
|
||||
.type _exit, @function
|
||||
.global _exit
|
||||
_exit:
|
||||
# dump performance CSRs
|
||||
call vx_perf_dump
|
||||
|
||||
# disable all threads in current warp
|
||||
li a0, 0
|
||||
.insn s 0x6b, 0, x0, 0(a0) # tmc a0
|
||||
|
||||
Reference in New Issue
Block a user