This commit is contained in:
Blaise Tine
2021-06-13 21:44:46 -04:00
640 changed files with 394599 additions and 653711 deletions

View File

@@ -1,18 +0,0 @@
all:
$(MAKE) -C simple
$(MAKE) -C dev
$(MAKE) -C hello
$(MAKE) -C nlTest
run:
$(MAKE) -C simple run
$(MAKE) -C dev run
$(MAKE) -C hello run
$(MAKE) -C nlTest run
clean:
$(MAKE) -C simple clean
$(MAKE) -C dev clean
$(MAKE) -C hello clean
$(MAKE) -C nlTest clean

View File

@@ -1,36 +0,0 @@
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
VORTEX_RT_PATH ?= $(wildcard ../..)
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
AR = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc-ar
DP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections
CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw
LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a
PROJECT = vx_dev_main
SRCS = vx_dev_main.c
all: $(PROJECT).elf $(PROJECT).hex $(PROJECT).dump
$(PROJECT).dump: $(PROJECT).elf
$(DP) -D $(PROJECT).elf > $(PROJECT).dump
$(PROJECT).hex: $(PROJECT).elf
$(CP) -O ihex $(PROJECT).elf $(PROJECT).hex
$(PROJECT).elf: $(SRCS)
$(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf
run: $(PROJECT).hex
(cd ../../../hw/simulate/obj_dir && ./VVortex ../../../runtime/tests/dev/$(PROJECT).hex)
.depend: $(SRCS)
$(CC) $(CFLAGS) -MM $^ > .depend;
clean:
rm -rf *.elf *.hex *.dump .depend

View File

@@ -1,90 +0,0 @@
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <vx_intrinsics.h>
#include <vx_print.h>
#include <vx_spawn.h>
typedef struct
{
unsigned * x;
unsigned * y;
unsigned * z;
unsigned numColums;
unsigned numRows;
} mat_add_args_t;
unsigned x[] = {5, 5, 5, 5,
6, 6, 6, 6,
7, 7, 7, 7,
8, 8, 8, 8};
unsigned y[] = {1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1};
unsigned z[] = {0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
void mat_add_kernel(int task_id, void * void_arguments)
{
mat_add_args_t * arguments = (mat_add_args_t *) void_arguments;
arguments->z[task_id] = arguments->x[task_id] + arguments->y[task_id];
}
void vx_print_mat(unsigned * matPtr, int numRows, int numCols)
{
vx_printf("---------------------\n");
for (int i = 0; i < numRows; i++) {
for (int j = 0; j < numCols; j++) {
unsigned index = (i * numCols) + j;
vx_printf("0x%x ", matPtr[index]);
}
vx_printf("\n");
}
}
int main() {
// void * hellp = malloc(4);
vx_printf("Confirm Dev Main\n");
vx_printf("vx_spawn_tasks\n");
mat_add_args_t arguments;
arguments.x = x;
arguments.y = y;
arguments.z = z;
arguments.numColums = 4;
arguments.numRows = 4;
// First kernel call
vx_spawn_tasks(arguments.numRows * arguments.numColums, mat_add_kernel, &arguments);
vx_print_mat(z, arguments.numRows, arguments.numColums);
arguments.x = z;
arguments.y = y;
arguments.z = z;
arguments.numColums = 4;
arguments.numRows = 4;
// Second Kernel Call
vx_spawn_tasks(arguments.numRows * arguments.numColums, mat_add_kernel, &arguments);
vx_print_mat(z, arguments.numRows, arguments.numColums);
vx_prints("Passed!\n");
return 0;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +0,0 @@
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
VORTEX_RT_PATH ?= $(wildcard ../..)
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
AR = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc-ar
DP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections
CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw
LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a
PROJECT = hello
SRCS = hello.cpp
all: $(PROJECT).elf $(PROJECT).hex $(PROJECT).dump
$(PROJECT).dump: $(PROJECT).elf
$(DP) -D $(PROJECT).elf > $(PROJECT).dump
$(PROJECT).hex: $(PROJECT).elf
$(CP) -O ihex $(PROJECT).elf $(PROJECT).hex
$(PROJECT).elf: $(SRCS)
$(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf
run: $(PROJECT).hex
(cd ../../../hw/simulate/obj_dir && ./VVortex ../../../runtime/tests/hello/$(PROJECT).hex)
.depend: $(SRCS)
$(CC) $(CFLAGS) -MM $^ > .depend;
clean:
rm -rf *.elf *.hex *.dump .depend

View File

@@ -1,20 +0,0 @@
#include <stdio.h>
struct hello {
int a;
hello()
{
a = 55;
}
};
hello nameing;
int main()
{
nameing.a = 20;
int b;
printf("Passed!\n");
return 0;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +0,0 @@
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
VORTEX_RT_PATH ?= $(wildcard ../..)
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
AR = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc-ar
DP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections
CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw
LDFLAGS += -lm -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a
PROJECT = vx_nl_main
SRCS = vx_nl_main.c
all: $(PROJECT).elf $(PROJECT).hex $(PROJECT).dump
$(PROJECT).dump: $(PROJECT).elf
$(DP) -D $(PROJECT).elf > $(PROJECT).dump
$(PROJECT).hex: $(PROJECT).elf
$(CP) -O ihex $(PROJECT).elf $(PROJECT).hex
$(PROJECT).elf: $(SRCS)
$(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf
run: $(PROJECT).hex
(cd ../../../hw/simulate/obj_dir && ./VVortex ../../../runtime/tests/nlTest/$(PROJECT).hex)
.depend: $(SRCS)
$(CC) $(CFLAGS) -MM $^ > .depend;
clean:
rm -rf *.elf *.hex *.dump .depend

View File

@@ -1,26 +0,0 @@
#include <stdio.h>
#include <math.h>
#include <vx_print.h>
const int Num = 9;
const float fNum = 9.0f;
int fibonacci(int n) {
if (n <= 1)
return n;
return fibonacci(n-1) + fibonacci(n-2);
}
int main() {
int fib = fibonacci(Num);
float isq = 1.0f / sqrt(fNum);
vx_printf("fibonacci(%d) = %d\n", Num, fib);
vx_printf("invAqrt(%f) = %f\n", fNum, isq);
vx_prints("Passed!\n");
return 0;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +0,0 @@
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
VORTEX_RT_PATH ?= $(wildcard ../..)
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
AR = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc-ar
DP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objdump
CP = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-objcopy
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wstack-usage=1024 -ffreestanding -nostartfiles -fdata-sections -ffunction-sections
CFLAGS += -I$(VORTEX_RT_PATH)/include -I$(VORTEX_RT_PATH)/../hw
LDFLAGS += -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld -Wl,--gc-sections $(VORTEX_RT_PATH)/libvortexrt.a
PROJECT = vx_simple
SRCS = main.c tests.c
all: $(PROJECT).elf $(PROJECT).hex $(PROJECT).dump
$(PROJECT).dump: $(PROJECT).elf
$(DP) -D $(PROJECT).elf > $(PROJECT).dump
$(PROJECT).hex: $(PROJECT).elf
$(CP) -O ihex $(PROJECT).elf $(PROJECT).hex
$(PROJECT).elf: $(SRCS)
$(CC) $(CFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT).elf
run: $(PROJECT).hex
(cd ../../../hw/simulate/obj_dir && ./VVortex ../../../runtime/tests/simple/$(PROJECT).hex)
.depend: $(SRCS)
$(CC) $(CFLAGS) -MM $^ > .depend;
clean:
rm -rf *.elf *.hex *.dump .depend

View File

@@ -1,112 +0,0 @@
#include "tests.h"
#include <stdbool.h>
#include <vx_intrinsics.h>
#include <vx_print.h>
#include <vx_spawn.h>
#include <VX_config.h>
typedef struct {
unsigned * x;
unsigned * y;
unsigned * z;
unsigned numColums;
unsigned numRows;
} mat_add_args_t;
unsigned x[] = {5, 5, 5, 5,
6, 6, 6, 6,
7, 7, 7, 7,
8, 8, 8, 8};
unsigned y[] = {1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1};
unsigned z[] = {0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0};
void mat_add_kernel(int task_id, void * void_arguments) {
mat_add_args_t * arguments = (mat_add_args_t *) void_arguments;
arguments->z[task_id] = arguments->x[task_id] + arguments->y[task_id];
}
int main() {
vx_printf("Let's start... (This might take a while)\n");
unsigned what[36];
bool passed = true;
for (int i = 0; i < 36; i++) {
what[i] = i;
if (what[i] != i) {
passed = false;
vx_printf("T1 Fail On %d", i);
}
}
for (int i = 0; i < 36; i++) {
if (what[i] != i) {
passed = false;
vx_printf("T2 Fail on %d", i);
}
}
if (passed) {
vx_printf("Wr->read and repeat(Wr) tests passed!\n");
}
vx_printf("Simple Main\n");
// TMC test
test_tmc();
// Control Divergence Test
vx_printf("test_divergence\n");
test_divergence();
// Test wspawn
vx_printf("test_wspawn\n");
test_wsapwn();
vx_printf("Shared Memory test\n");
unsigned * ptr = (unsigned *)SMEM_BASE_ADDR;
unsigned value = 0;
for (int i = 0; i < 5; i++) {
*ptr = value;
unsigned read_valud = *ptr;
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_printf("vx_spawn_tasks mat_add_kernel\n");
mat_add_args_t arguments;
arguments.x = x;
arguments.y = y;
arguments.z = z;
arguments.numColums = 4;
arguments.numRows = 4;
vx_spawn_tasks(arguments.numRows * arguments.numColums, mat_add_kernel, &arguments);
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 < arguments.numRows; i++) {
for (int j = 0; j < arguments.numColums; j++) {
unsigned index = (i * arguments.numColums) + j;
vx_printf("0x%x ", z[index]);
}
vx_prints("\n");
}
vx_prints("Passed!\n");
return 0;
}

View File

@@ -1,83 +0,0 @@
#include "tests.h"
#include <stdbool.h>
#include <vx_intrinsics.h>
#include <vx_print.h>
int tmc_array[4] = {5, 5, 5, 5};
void test_tmc_impl() {
unsigned tid = vx_thread_id(); // Get TID
tmc_array[tid] = tid;
}
void test_tmc() {
vx_printf("testing_tmc\n");
vx_tmc(4);
test_tmc_impl();
vx_tmc(1);
vx_printx(tmc_array[0]);
vx_printx(tmc_array[1]);
vx_printx(tmc_array[2]);
vx_printx(tmc_array[3]);
return;
}
int div_arr[4];
void test_divergence() {
vx_tmc(4);
unsigned tid = vx_thread_id(); // Get TID
bool b = tid < 2;
__if (b) {
bool c = tid < 1;
__if (c) {
div_arr[tid] = 10;
}
__else {
div_arr[tid] = 11;
}
__endif
}
__else {
bool c = tid < 3;
__if (c) {
div_arr[tid] = 12;
}
__else {
div_arr[tid] = 13;
}
__endif
}
__endif
vx_tmc(1);
vx_printx(div_arr[0]);
vx_printx(div_arr[1]);
vx_printx(div_arr[2]);
vx_printx(div_arr[3]);
}
unsigned wsapwn_arr[4];
void simple_kernel() {
unsigned wid = vx_warp_id();
wsapwn_arr[wid] = wid;
vx_tmc(0 == wid);
}
void test_wsapwn() {
vx_wspawn(4, (unsigned)simple_kernel);
simple_kernel();
vx_printx(wsapwn_arr[0]);
vx_printx(wsapwn_arr[1]);
vx_printx(wsapwn_arr[2]);
vx_printx(wsapwn_arr[3]);
}

View File

@@ -1,10 +0,0 @@
#ifndef TESTS
#define TESTS
void test_tmc();
void test_divergence();
void test_wsapwn();
#endif

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff