This commit is contained in:
felsabbagh3
2019-11-05 22:57:05 -05:00
parent b44505f1f4
commit fcd3bbc4a1
8 changed files with 915 additions and 809 deletions

37
runtime/vx_api/vx_api.c Normal file
View File

@@ -0,0 +1,37 @@
#include "../intrinsics/vx_intrinsics.h"
#include "vx_api.h"
func_t global_function_pointer;
// void (func_t)(void *)
void * global_argument_struct;
unsigned global_num_threads;
void setup_call()
{
vx_tmc(global_num_threads);
global_function_pointer(global_argument_struct);
unsigned wid = vx_warpID();
if (wid != 0)
{
vx_tmc(0); // Halt Warp Execution
}
else
{
vx_tmc(1); // Only activate one thread
}
}
void vx_spawnWarps(unsigned numWarps, unsigned numThreads, func_t func_ptr, void * args)
{
global_function_pointer = func_ptr;
global_argument_struct = args;
global_num_threads = numThreads;
vx_wspawn(numWarps, (unsigned) func_ptr);
setup_call();
}

18
runtime/vx_api/vx_api.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef VX_API_
#define VX_API_
typedef void (*func_t)(void *);
void vx_spawnWarps(unsigned numWarps, unsigned numThreads, func_t func_ptr , void * args);
#endif