mutiple fixes: parallel printf, fixed cycle in cache, opencl refactored vecadd and sgemm, regen opencl kernels with hard-float, fixed vortex io bus interface, fixed dpi floats APi to support multicore mode, make vlsim multicore default, make rtlsim multi-core default, removed POCL binaries from repository, updated Makefiles to use external POCL
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
|
||||
#include "tests.h"
|
||||
#include <stdbool.h>
|
||||
#include <vx_intrinsics.h>
|
||||
#include <vx_print.h>
|
||||
#include <vx_spawn.h>
|
||||
#include <VX_config.h>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
unsigned * x;
|
||||
unsigned * y;
|
||||
unsigned * z;
|
||||
@@ -15,7 +13,6 @@ typedef struct
|
||||
unsigned numRows;
|
||||
} mat_add_args_t;
|
||||
|
||||
|
||||
unsigned x[] = {5, 5, 5, 5,
|
||||
6, 6, 6, 6,
|
||||
7, 7, 7, 7,
|
||||
@@ -31,8 +28,7 @@ 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(void * void_arguments) {
|
||||
mat_add_args_t * arguments = (mat_add_args_t *) void_arguments;
|
||||
|
||||
unsigned wid = vx_warp_id();
|
||||
@@ -49,73 +45,60 @@ void mat_add_kernel(void * void_arguments)
|
||||
// __endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// ensure single thread
|
||||
vx_tmc(1);
|
||||
int main() {
|
||||
vx_printf("Let's start... (This might take a while)\n");
|
||||
|
||||
vx_print_str("Let's start... (This might take a while)\n");
|
||||
unsigned what[36];
|
||||
bool passed = true;
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 36; i++) {
|
||||
what[i] = i;
|
||||
// vx_print_hex(i);
|
||||
// vx_printf(": ", what[i]);
|
||||
if (what[i] != i)
|
||||
{
|
||||
if (what[i] != i) {
|
||||
passed = false;
|
||||
vx_printf("T1 Fail On ", i);
|
||||
vx_printf("T1 Fail On %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
// vx_print_hex(i);
|
||||
// vx_printf(": ", what[i]);
|
||||
if (what[i] != i)
|
||||
{
|
||||
for (int i = 0; i < 36; i++) {
|
||||
if (what[i] != i) {
|
||||
passed = false;
|
||||
vx_printf("T2 Fail on ", i);
|
||||
vx_printf("T2 Fail on %d", i);
|
||||
}
|
||||
}
|
||||
|
||||
if (passed)
|
||||
{
|
||||
vx_print_str("Wr->read and repeat(Wr) tests passed!\n");
|
||||
if (passed) {
|
||||
vx_printf("Wr->read and repeat(Wr) tests passed!\n");
|
||||
}
|
||||
|
||||
vx_print_str("Simple Main\n");
|
||||
vx_printf("Simple Main\n");
|
||||
|
||||
// TMC test
|
||||
test_tmc();
|
||||
|
||||
// Control Divergence Test
|
||||
vx_print_str("test_divergence\n");
|
||||
vx_tmc(4);
|
||||
vx_printf("test_divergence\n");
|
||||
test_divergence();
|
||||
vx_tmc(1);
|
||||
|
||||
// Test wspawn
|
||||
vx_print_str("test_wspawn\n");
|
||||
vx_printf("test_wspawn\n");
|
||||
test_wsapwn();
|
||||
|
||||
vx_print_str("Shared Memory test\n");
|
||||
vx_printf("Shared Memory test\n");
|
||||
unsigned * ptr = (unsigned *) SHARED_MEM_BASE_ADDR;
|
||||
unsigned value = 0;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
*ptr = value;
|
||||
unsigned read_valud = *ptr;
|
||||
vx_printf("ptr: ", (unsigned) ptr);
|
||||
vx_printf("Original Value: ", value);
|
||||
vx_printf("Read Value: ", read_valud);
|
||||
vx_print_str("-------------------\n");
|
||||
vx_printf("ptr: %p\n", ptr);
|
||||
vx_printf("Original Value: %x\n", value);
|
||||
vx_printf("Read Value: %x\n", read_valud);
|
||||
vx_printf("-------------------\n");
|
||||
value++;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
vx_print_str("vx_spawn_warps mat_add_kernel\n");
|
||||
vx_printf("vx_spawn_warps mat_add_kernel\n");
|
||||
|
||||
mat_add_args_t arguments;
|
||||
arguments.x = x;
|
||||
@@ -124,24 +107,20 @@ int main()
|
||||
arguments.numColums = 4;
|
||||
arguments.numRows = 4;
|
||||
|
||||
|
||||
int numWarps = 4;
|
||||
int numThreads = 4;
|
||||
|
||||
vx_spawn_warps(numWarps, numThreads, mat_add_kernel, &arguments);
|
||||
|
||||
vx_print_str("Waiting to ensure other warps are done... (Takes a while)\n");
|
||||
vx_printf("Waiting to ensure other warps are done... (Takes a while)\n");
|
||||
for (int i = 0; i < 5000; i++) {}
|
||||
|
||||
for (int i = 0; i < numWarps; i++)
|
||||
{
|
||||
for (int j = 0; j < numThreads; j++)
|
||||
{
|
||||
for (int i = 0; i < numWarps; i++) {
|
||||
for (int j = 0; j < numThreads; j++) {
|
||||
unsigned index = (i * arguments.numColums) + j;
|
||||
vx_print_hex(z[index]);
|
||||
vx_print_str(" ");
|
||||
vx_printf("0x%x ", z[index]);
|
||||
}
|
||||
vx_print_str("\n");
|
||||
vx_printf("\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user