Sim Work miss

This commit is contained in:
felsabbagh3
2019-05-18 23:42:55 +04:00
parent 8995267cd3
commit d7afef04a9
40 changed files with 2642 additions and 10382 deletions

View File

@@ -6,7 +6,7 @@
void vx_before_main()
{
// unsigned num_available_warps = vx_available_warps();
for (int i = 0; i < 8; i++)
for (int i = 0; i < 32; i++)
{
queue_initialize(q + i);
}
@@ -15,9 +15,20 @@ void vx_before_main()
void vx_reschedule_warps()
{
register unsigned curr_warp asm("s10");
// vx_printf("Reschedule: ", curr_warp);
vx_printf("Reschedule: ", curr_warp);
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
asm __volatile__("nop");
if (queue_isEmpty(q+curr_warp))
{
@@ -38,7 +49,7 @@ void vx_reschedule_warps()
asm __volatile__("mv sp,%0"::"r" (j.base_sp):);
vx_createThreads(j.n_threads, j.wid, j.func_ptr, j.args, j.assigned_warp);
ECALL;
ECALL; // should never reach this
}
@@ -133,6 +144,7 @@ void vx_wait_for_warps(unsigned num_wait)
num += 1;
}
}
// vx_printf("Found: ", num);
}
// vx_printf("num found: ", num);

View File

@@ -29,11 +29,11 @@
#define __end_if AFTER:\
JOIN;
static int done[] = {0, 0, 0, 0, 0, 0, 0};
static int done[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static int main_sp[1];
unsigned context[32];
unsigned context[64];
void vx_save_context(void);
void vx_load_context(void);

View File

@@ -6,9 +6,9 @@
.type _start, @function
.global _start
_start:
li a0, 2 # Num Warps
li a0, 8 # Num Warps
csrw 0x20, a0 # Setting the number of available warps
li a0, 2 # Num Threads
li a0, 4 # Num Threads
csrw 0x21, a0 # Setting the number of available threads
csrw mhartid,zero
csrw misa,zero
@@ -46,7 +46,21 @@ loop_done:
li a0,0 # setting tid = 0 for main thread
mv t6,a2 # setting func_addr
mv s11,t2 # setting num_threads to spawn
nop
nop
nop
nop
nop
nop
nop
nop
.word 0x1bfe0eb
nop
nop
nop
nop
nop
nop
la a0, vx_reschedule_warps
.word 0x5406b

View File

@@ -5,8 +5,8 @@
#define SIZE 50
#define WARPS 7
#define SIZE 100
#define WARPS 8
typedef struct Job_t
@@ -31,7 +31,7 @@ typedef struct Queue_t
} Queue;
Queue q[8];
Queue q[64];
void queue_initialize(Queue *);

View File

@@ -58,6 +58,12 @@ ec:
queue_dequeue:
mv t0, a0 # loading base address of q
lw t1, 8 (t0) # t1 = num_j
nop
nop
nop
nop
nop
nop
addi t1, t1, -1 # --t1
sw t1, 8 (t0) # num_j = t1
addi t1, t0, 20 # t1 = jobs_addr