redesigned driver demo, fixed startup code, removed --cpu from simx,

This commit is contained in:
Blaise Tine
2020-03-29 00:38:17 -04:00
parent 2d5cf89e00
commit c8a6470595
63 changed files with 40963 additions and 364160 deletions

View File

@@ -1,25 +1,26 @@
#include <stdlib.h>
#include <stdio.h>
#include "intrinsics/vx_intrinsics.h"
#include "vx_api/vx_api.h"
#include "common.h"
void main() {
unsigned *x = (unsigned*)0x10000000;
unsigned *y = (unsigned*)0x20000000;
unsigned *z = (unsigned*)0x30000000;
unsigned wid = vx_warpID();
void kernel_body(void* arg) {
struct kernel_arg_t* _arg = (struct kernel_arg_t*)(arg);
int* x = (int*)_arg->src0_ptr;
int* y = (int*)_arg->src1_ptr;
int* z = (int*)_arg->dst_ptr;
unsigned wNo = vx_warpNum();
unsigned tid = vx_threadID();
unsigned i = (wid * MAX_THREADS) + tid;
unsigned i = ((wNo * MAX_THREADS) + tid) * _arg->stride;
//if (i == 0) {
// printf("begin\n");
//}
for (unsigned j = 0; j < _arg->stride; ++j) {
z[i+j] = x[i+j] * y[i+j];
}
}
z[i] = x[i] + y[i];
//if (i == 0) {
// printf("end\n");
//}
void main() {
struct kernel_arg_t* arg = (struct kernel_arg_t*)KERNEL_ARG_DEV_MEM_ADDR;
vx_spawnWarps(MAX_WARPS, MAX_THREADS, kernel_body, arg);
}