old tb
This commit is contained in:
37
runtime/vx_api/vx_api.c
Normal file
37
runtime/vx_api/vx_api.c
Normal 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
18
runtime/vx_api/vx_api.h
Normal 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
|
||||
Reference in New Issue
Block a user