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,4 +1,4 @@
|
||||
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
|
||||
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
|
||||
VORTEX_RT_PATH ?= $(wildcard ../..)
|
||||
|
||||
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
|
||||
@@ -6,7 +6,7 @@ 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=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
|
||||
CFLAGS += -I$(VORTEX_RT_PATH)/include
|
||||
|
||||
|
||||
@@ -53,16 +53,13 @@ void mat_add_kernel(void * void_arguments)
|
||||
|
||||
void vx_print_mat(unsigned * matPtr, int numRows, int numCols)
|
||||
{
|
||||
vx_print_str("---------------------\n");
|
||||
for (int i = 0; i < numRows; i++)
|
||||
{
|
||||
for (int j = 0; j < numCols; j++)
|
||||
{
|
||||
vx_printf("---------------------\n");
|
||||
for (int i = 0; i < numRows; i++) {
|
||||
for (int j = 0; j < numCols; j++) {
|
||||
unsigned index = (i * numCols) + j;
|
||||
vx_print_hex(matPtr[index]);
|
||||
vx_print_str(" ");
|
||||
vx_printf("0x%x ", matPtr[index]);
|
||||
}
|
||||
vx_print_str("\n");
|
||||
vx_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +69,9 @@ int main()
|
||||
vx_tmc(1);
|
||||
|
||||
// void * hellp = malloc(4);
|
||||
vx_print_str("Confirm Dev Main\n");
|
||||
vx_printf("Confirm Dev Main\n");
|
||||
|
||||
vx_print_str("vx_spawn_warps\n");
|
||||
vx_printf("vx_spawn_warps\n");
|
||||
|
||||
mat_add_args_t arguments;
|
||||
arguments.x = x;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
|
||||
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
|
||||
VORTEX_RT_PATH ?= $(wildcard ../..)
|
||||
|
||||
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
|
||||
@@ -6,7 +6,7 @@ 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=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
|
||||
CFLAGS += -I$(VORTEX_RT_PATH)/include
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
|
||||
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
|
||||
VORTEX_RT_PATH ?= $(wildcard ../..)
|
||||
|
||||
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
|
||||
@@ -6,7 +6,7 @@ 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=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
|
||||
CFLAGS += -I$(VORTEX_RT_PATH)/include
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
|
||||
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
|
||||
VORTEX_RT_PATH ?= $(wildcard ../..)
|
||||
|
||||
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
|
||||
@@ -6,8 +6,8 @@ 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=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
|
||||
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
|
||||
CFLAGS += -I$(VORTEX_RT_PATH)/include -I../../../hw
|
||||
|
||||
LDFLAGS += $(VORTEX_RT_PATH)/libvortexrt.a
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,128 +1,83 @@
|
||||
#include "tests.h"
|
||||
#include <stdbool.h>
|
||||
#include <vx_intrinsics.h>
|
||||
#include <vx_print.h>
|
||||
|
||||
int tmc_array[4] = {5,5,5,5};
|
||||
int tmc_array[4] = {5, 5, 5, 5};
|
||||
|
||||
void test_tmc_impl()
|
||||
{
|
||||
void test_tmc_impl() {
|
||||
unsigned tid = vx_thread_id(); // Get TID
|
||||
tmc_array[tid] = tid;
|
||||
}
|
||||
|
||||
void test_tmc()
|
||||
{
|
||||
vx_print_str("testing_tmc\n");
|
||||
void test_tmc() {
|
||||
vx_printf("testing_tmc\n");
|
||||
|
||||
vx_tmc(4);
|
||||
|
||||
test_tmc_impl();
|
||||
|
||||
vx_tmc(1);
|
||||
|
||||
vx_print_hex(tmc_array[0]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(tmc_array[1]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(tmc_array[2]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(tmc_array[3]);
|
||||
vx_print_str("\n");
|
||||
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()
|
||||
{
|
||||
void test_divergence() {
|
||||
vx_tmc(4);
|
||||
|
||||
unsigned tid = vx_thread_id(); // Get TID
|
||||
|
||||
bool b = tid < 2;
|
||||
__if (b)
|
||||
{
|
||||
__if (b) {
|
||||
bool c = tid < 1;
|
||||
__if (c)
|
||||
{
|
||||
__if (c) {
|
||||
div_arr[tid] = 10;
|
||||
}
|
||||
__else
|
||||
{
|
||||
__else {
|
||||
div_arr[tid] = 11;
|
||||
}
|
||||
__endif
|
||||
}
|
||||
__else
|
||||
{
|
||||
__else {
|
||||
bool c = tid < 3;
|
||||
__if (c)
|
||||
{
|
||||
__if (c) {
|
||||
div_arr[tid] = 12;
|
||||
}
|
||||
__else
|
||||
{
|
||||
__else {
|
||||
div_arr[tid] = 13;
|
||||
}
|
||||
__endif
|
||||
}
|
||||
__endif
|
||||
|
||||
vx_print_hex(div_arr[0]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(div_arr[1]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(div_arr[2]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(div_arr[3]);
|
||||
vx_print_str("\n");
|
||||
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()
|
||||
{
|
||||
void simple_kernel() {
|
||||
unsigned wid = vx_warp_id();
|
||||
|
||||
wsapwn_arr[wid] = wid;
|
||||
|
||||
if (wid != 0)
|
||||
{
|
||||
vx_tmc(0);
|
||||
}
|
||||
|
||||
vx_tmc(0 == wid);
|
||||
}
|
||||
|
||||
void test_wsapwn()
|
||||
{
|
||||
unsigned func_ptr = (unsigned) simple_kernel;
|
||||
vx_wspawn(4, func_ptr);
|
||||
void test_wsapwn() {
|
||||
vx_wspawn(4, (unsigned)simple_kernel);
|
||||
simple_kernel();
|
||||
|
||||
for (int i = 0; i < 100; i++) {}
|
||||
|
||||
vx_print_hex(wsapwn_arr[0]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(wsapwn_arr[1]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(wsapwn_arr[2]);
|
||||
vx_print_str("\n");
|
||||
vx_print_hex(wsapwn_arr[3]);
|
||||
vx_print_str("\n");
|
||||
}
|
||||
|
||||
void intrinsics_tests()
|
||||
{
|
||||
// TMC test
|
||||
test_tmc();
|
||||
|
||||
// Control Divergence Test
|
||||
vx_print_str("test_divergence\n");
|
||||
vx_tmc(4);
|
||||
test_divergence();
|
||||
vx_tmc(1);
|
||||
|
||||
|
||||
// Test wspawn
|
||||
vx_print_str("test_spawn\n");
|
||||
test_wsapwn();
|
||||
vx_printx(wsapwn_arr[0]);
|
||||
vx_printx(wsapwn_arr[1]);
|
||||
vx_printx(wsapwn_arr[2]);
|
||||
vx_printx(wsapwn_arr[3]);
|
||||
}
|
||||
@@ -7,6 +7,4 @@ void test_divergence();
|
||||
|
||||
void test_wsapwn();
|
||||
|
||||
void intrinsics_tests();
|
||||
|
||||
#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
@@ -1,4 +1,4 @@
|
||||
RISCV_TOOLCHAIN_PATH ?= ~/dev/riscv-gnu-toolchain/drops
|
||||
RISCV_TOOLCHAIN_PATH ?= /opt/riscv-gnu-toolchain
|
||||
VORTEX_RT_PATH ?= $(wildcard ../..)
|
||||
|
||||
CC = $(RISCV_TOOLCHAIN_PATH)/bin/riscv32-unknown-elf-gcc
|
||||
@@ -6,7 +6,7 @@ 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=rv32im -mabi=ilp32 -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -march=rv32imf -mabi=ilp32f -O3 -Wl,-Bstatic,-T,$(VORTEX_RT_PATH)/linker/vx_link.ld
|
||||
CFLAGS += -nostartfiles -ffreestanding -fno-exceptions -Wl,--gc-sections
|
||||
CFLAGS += -I$(VORTEX_RT_PATH)/include -I./include
|
||||
|
||||
|
||||
Reference in New Issue
Block a user