test sources refactoring

This commit is contained in:
Blaise Tine
2021-10-09 10:51:43 -04:00
parent 54bddeee9c
commit ca1d97a3c2
28 changed files with 261 additions and 212 deletions

View File

@@ -193,9 +193,8 @@ typedef struct {
int st_buffer_src[ST_BUF_SZ];
int st_buffer_dst[ST_BUF_SZ];
void st_kernel(int task_id, void * arg) {
st_args_t * arguments = (st_args_t *) arg;
arguments->dst[task_id] = arguments->src[task_id];
void st_kernel(int task_id, const st_args_t * arg) {
arg->dst[task_id] = arg->src[task_id];
}
int test_spawn_tasks() {
@@ -216,6 +215,37 @@ int test_spawn_tasks() {
///////////////////////////////////////////////////////////////////////////////
#define SR_BUF_SZ 8
typedef struct {
int * buf;
} sr_args_t;
int sr_buffer[SR_BUF_SZ];
void sr_kernel(const sr_args_t * arg) {
int tid = vx_thread_id();
arg->buf[tid] = 65 + tid;
}
void __attribute__ ((noinline)) do_serial() {
sr_args_t arg;
arg.buf = sr_buffer;
vx_serial(sr_kernel, &arg);
}
int test_serial() {
vx_printf("Serial Test\n");
int num_threads = std::min(vx_num_threads(), 8);
int tmask = make_full_tmask(num_threads);
vx_tmc(tmask);
do_serial();
vx_tmc(1);
return check_error(sr_buffer, 0, num_threads);
}
///////////////////////////////////////////////////////////////////////////////
int tmask_buffer[8];
int __attribute__ ((noinline)) do_tmask() {