Modify kernel entry since CSR_KNL is ready in spike

This commit is contained in:
zhoujingya 2023-03-28 17:05:28 +08:00
parent 625746818d
commit 530939a01b
2 changed files with 18 additions and 6 deletions

View File

@ -1,5 +1,4 @@
typedef uint cl_mem_fence_flags;
typedef uint memory_scope;
#define CLK_LOCAL_MEM_FENCE 1
#define CLK_GLOBAL_MEM_FENCE 2
#define CLK_IMAGE_MEM_FENCE 4

View File

@ -28,7 +28,6 @@ _start:
# allocate warp and per-thread level stack pointers, both
# stacks grows upwards
vsetvli x0,x0,e32,m1,ta,ma
csrr sp, CSR_LDS # sp points to baseaddr of local memory of each SM
csrr tp, CSR_PDS # tp points to baseaddr for lower bound of private memory(1K) of each thread
@ -43,10 +42,8 @@ _start:
2:
csrr t0, CSR_KNL # get addr of kernel metadata
la t1, test # all the tested function is named to be test
# lw t1, KNL_ENTRY(t0) # get kernel program address
# lw a0, KNL_ARG_BASE(t0) # get kernel arg buffer base address
# WORKAROUND: when buffer is ready, restore lines above
lw t1, KNL_ENTRY(t0) # get kernel program address
lw a0, KNL_ARG_BASE(t0) # get kernel arg buffer base address
jalr t1 # call kernel program
# call exit routine
@ -55,3 +52,19 @@ _start:
# End of warp execution
endprg x0, x0, x0
.size _start, .-_start
.section ".tohost","aw",@progbits
.align 6
.globl tohost
tohost: .dword 0
.align 6
.globl fromhost
fromhost: .dword 0
.global spike_end
.type spike_end,function
spike_end:
li t1,1
la t0,tohost
sw t1,0(t0)