vx_spawn_warps redesign using opencl's style scheduler

This commit is contained in:
Blaise Tine
2021-01-01 14:13:48 -05:00
parent 138db29310
commit 30d950ada2
35 changed files with 81204 additions and 81014 deletions

View File

@@ -33,21 +33,10 @@ unsigned z[] = {0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
void mat_add_kernel(void * void_arguments)
void mat_add_kernel(int task_id, void * void_arguments)
{
mat_add_args_t * arguments = (mat_add_args_t *) void_arguments;
unsigned wid = vx_warp_id();
unsigned tid = vx_thread_id();
bool valid = (wid < arguments->numRows) && (tid < arguments->numColums);
__if (valid)
{
unsigned index = (wid * arguments->numColums) + tid;
arguments->z[index] = arguments->x[index] + arguments->y[index];
}
__endif
arguments->z[task_id] = arguments->x[task_id] + arguments->y[task_id];
}
void vx_print_mat(unsigned * matPtr, int numRows, int numCols)
@@ -62,15 +51,11 @@ void vx_print_mat(unsigned * matPtr, int numRows, int numCols)
}
}
int main()
{
// Main is called with all threads active of warp 0
vx_tmc(1);
int main() {
// void * hellp = malloc(4);
vx_printf("Confirm Dev Main\n");
vx_printf("vx_spawn_warps\n");
vx_printf("vx_spawn_tasks\n");
mat_add_args_t arguments;
arguments.x = x;
@@ -79,12 +64,8 @@ int main()
arguments.numColums = 4;
arguments.numRows = 4;
int numWarps = 4;
int numThreads = 4;
// First kernel call
vx_spawn_warps(numWarps, numThreads, mat_add_kernel, &arguments);
vx_spawn_tasks(arguments.numRows * arguments.numColums, mat_add_kernel, &arguments);
vx_print_mat(z, arguments.numRows, arguments.numColums);
@@ -95,8 +76,9 @@ int main()
arguments.numRows = 4;
// Second Kernel Call
vx_spawn_warps(numWarps, numThreads, mat_add_kernel, &arguments);
vx_spawn_tasks(arguments.numRows * arguments.numColums, mat_add_kernel, &arguments);
vx_print_mat(z, arguments.numRows, arguments.numColums);
vx_prints("Passed!\n");
return 0;