This commit is contained in:
Blaise Tine
2020-09-08 13:05:47 -04:00
25 changed files with 2411 additions and 2605 deletions

View File

@@ -507,6 +507,12 @@ extern int vx_start(vx_device_h hdevice) {
// start execution
CHECK_RES(fpgaWriteMMIO64(device->fpga, 0, MMIO_CMD_TYPE, CMD_RUN));
#ifdef SCOPE
sleep(15);
vx_scope_stop(device->fpga, 0);
exit(0);
#endif
return 0;
}

BIN
driver/tests/dogfood/kernel.bin Executable file → Normal file

Binary file not shown.

View File

@@ -131,9 +131,8 @@ void kernel_fmadd(void* arg) {
for (uint32_t i = 0; i < count; ++i) {
float a = src0_ptr[offset+i];
float b = src1_ptr[offset+i];
float c = a - b;
float d = a * b + c;
dst_ptr[offset+i] = d;
float c = a * b + b;
dst_ptr[offset+i] = c;
}
}
@@ -148,9 +147,8 @@ void kernel_fmsub(void* arg) {
for (uint32_t i = 0; i < count; ++i) {
float a = src0_ptr[offset+i];
float b = src1_ptr[offset+i];
float c = a - b;
float d = a * b - c;
dst_ptr[offset+i] = d;
float c = a * b - b;
dst_ptr[offset+i] = c;
}
}
@@ -165,9 +163,8 @@ void kernel_fnmadd(void* arg) {
for (uint32_t i = 0; i < count; ++i) {
float a = src0_ptr[offset+i];
float b = src1_ptr[offset+i];
float c = a - b;
float d =-a * b - c;
dst_ptr[offset+i] = d;
float c =-a * b - b;
dst_ptr[offset+i] = c;
}
}
@@ -182,9 +179,8 @@ void kernel_fnmsub(void* arg) {
for (uint32_t i = 0; i < count; ++i) {
float a = src0_ptr[offset+i];
float b = src1_ptr[offset+i];
float c = a - b;
float d =-a * b + c;
dst_ptr[offset+i] = d;
float c =-a * b + b;
dst_ptr[offset+i] = c;
}
}
@@ -199,11 +195,10 @@ void kernel_fnmadd_madd(void* arg) {
for (uint32_t i = 0; i < count; ++i) {
float a = src0_ptr[offset+i];
float b = src1_ptr[offset+i];
float c = a - b;
float d =-a * b - c;
float e = a * b + c;
float f = d + e;
dst_ptr[offset+i] = f;
float c =-a * b - b;
float d = a * b + b;
float e = c + d;
dst_ptr[offset+i] = e;
}
}

File diff suppressed because it is too large Load Diff

BIN
driver/tests/dogfood/kernel.elf Executable file → Normal file

Binary file not shown.

View File

@@ -253,8 +253,7 @@ public:
auto b = (float*)src2;
auto c = (float*)dst;
for (int i = 0; i < n; ++i) {
auto x = a[i] - b[i];
auto ref = a[i] * b[i] + x;
auto ref = a[i] * b[i] + b[i];
if (!almost_equal(c[i], ref)) {
std::cout << "error at result #" << i << ": expected " << ref << ", actual " << c[i] << ", a=" << a[i] << ", b=" << b[i] << std::endl;
++errors;
@@ -282,8 +281,7 @@ public:
auto b = (float*)src2;
auto c = (float*)dst;
for (int i = 0; i < n; ++i) {
auto x = a[i] - b[i];
auto ref = a[i] * b[i] - x;
auto ref = a[i] * b[i] - b[i];
if (!almost_equal(c[i], ref)) {
std::cout << "error at result #" << i << ": expected " << ref << ", actual " << c[i] << ", a=" << a[i] << ", b=" << b[i] << std::endl;
++errors;
@@ -311,8 +309,7 @@ public:
auto b = (float*)src2;
auto c = (float*)dst;
for (int i = 0; i < n; ++i) {
auto x = a[i] - b[i];
auto ref = -a[i] * b[i] - x;
auto ref = -a[i] * b[i] - b[i];
if (!almost_equal(c[i], ref)) {
std::cout << "error at result #" << i << ": expected " << ref << ", actual " << c[i] << ", a=" << a[i] << ", b=" << b[i] << std::endl;
++errors;
@@ -340,8 +337,7 @@ public:
auto b = (float*)src2;
auto c = (float*)dst;
for (int i = 0; i < n; ++i) {
auto x = a[i] - b[i];
auto ref = -a[i] * b[i] + x;
auto ref = -a[i] * b[i] + b[i];
if (!almost_equal(c[i], ref)) {
std::cout << "error at result #" << i << ": expected " << ref << ", actual " << c[i] << ", a=" << a[i] << ", b=" << b[i] << std::endl;
++errors;
@@ -369,10 +365,9 @@ public:
auto b = (float*)src2;
auto c = (float*)dst;
for (int i = 0; i < n; ++i) {
auto x = a[i] - b[i];
auto y = -a[i] * b[i] - x;
auto z = a[i] * b[i] + x;
auto ref = y + z;
auto x = -a[i] * b[i] - b[i];
auto y = a[i] * b[i] + b[i];
auto ref = x + y;
if (!almost_equal(c[i], ref)) {
std::cout << "error at result #" << i << ": expected " << ref << ", actual " << c[i] << ", a=" << a[i] << ", b=" << b[i] << std::endl;
++errors;