mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
dogfood update
This commit is contained in:
parent
3cd7f41012
commit
04de44d280
4 changed files with 61 additions and 8 deletions
|
@ -4,6 +4,6 @@ SRCS = main.cpp
|
|||
|
||||
VX_SRCS = kernel.cpp
|
||||
|
||||
OPTS ?= -n64 -x19 -x20
|
||||
OPTS ?= -n64 -xbar -xgbar
|
||||
|
||||
include ../common.mk
|
|
@ -306,6 +306,23 @@ void kernel_utof(int task_id, kernel_arg_t* __UNIFORM__ arg) {
|
|||
}
|
||||
}
|
||||
|
||||
void kernel_minmax(int task_id, kernel_arg_t* __UNIFORM__ arg) {
|
||||
auto count = arg->task_size;
|
||||
auto src0_ptr = (float*)arg->src0_addr;
|
||||
auto src1_ptr = (float*)arg->src1_addr;
|
||||
auto dst_ptr = (float*)arg->dst_addr;
|
||||
auto offset = task_id * count;
|
||||
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
auto a = src0_ptr[offset+i];
|
||||
auto b = src1_ptr[offset+i];
|
||||
auto c = fmin(a, b);
|
||||
auto d = fmax(a, b);
|
||||
auto e = c + d;
|
||||
dst_ptr[offset+i] = e;
|
||||
}
|
||||
}
|
||||
|
||||
void kernel_bar(int task_id, kernel_arg_t* __UNIFORM__ arg) {
|
||||
auto num_warps = vx_num_warps();
|
||||
auto num_threads = vx_num_threads();
|
||||
|
@ -385,6 +402,7 @@ static const PFN_Kernel sc_tests[] = {
|
|||
kernel_ftou,
|
||||
kernel_itof,
|
||||
kernel_utof,
|
||||
kernel_minmax,
|
||||
kernel_bar,
|
||||
kernel_gbar
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ TestSuite* testSuite = nullptr;
|
|||
const char* kernel_file = "kernel.bin";
|
||||
int count = 0;
|
||||
std::unordered_set<int> included;
|
||||
std::unordered_set<int> excluded;
|
||||
std::unordered_set<std::string> excluded;
|
||||
int testid_s = 0;
|
||||
int testid_e = 0;
|
||||
bool stop_on_error = true;
|
||||
|
@ -28,7 +28,7 @@ kernel_arg_t kernel_arg = {};
|
|||
|
||||
static void show_usage() {
|
||||
std::cout << "Vortex Test." << std::endl;
|
||||
std::cout << "Usage: [-t<testid>: selected test] [-s<testid>: start test] [-e<testid>: end test] [-x<testid>: excluded tests]" << std::endl;
|
||||
std::cout << "Usage: [-t<testid>: selected test] [-s<testid>: start test] [-e<testid>: end test] [-x<name>: excluded tests]" << std::endl;
|
||||
std::cout << " [-k<kernel>] [-n<words>] [-c] [-h: help]" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ static void parse_args(int argc, char **argv) {
|
|||
included.insert(atoi(optarg));
|
||||
break;
|
||||
case 'x':
|
||||
excluded.insert(atoi(optarg));
|
||||
excluded.insert(optarg);
|
||||
break;
|
||||
case 's':
|
||||
testid_s = atoi(optarg);
|
||||
|
@ -148,13 +148,15 @@ int main(int argc, char *argv[]) {
|
|||
if (included.count(t) == 0)
|
||||
continue;
|
||||
}
|
||||
if (!excluded.empty()) {
|
||||
if (excluded.count(t) != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
auto test = testSuite->get_test(t);
|
||||
auto name = test->name();
|
||||
|
||||
if (!excluded.empty()) {
|
||||
if (excluded.count(name) != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << "Test" << t << ": " << name << std::endl;
|
||||
|
||||
// upload kernel argument
|
||||
|
|
|
@ -689,6 +689,38 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class Test_MINMAX : public ITestCase {
|
||||
public:
|
||||
Test_MINMAX(TestSuite* suite) : ITestCase(suite, "minmax") {}
|
||||
|
||||
int setup(uint32_t n, void* src1, void* src2) override {
|
||||
auto a = (float*)src1;
|
||||
auto b = (float*)src2;
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
a[i] = fround((n - i) * (1.0f/n));
|
||||
b[i] = fround((n + i) * (1.0f/n));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int verify(uint32_t n, void* dst, const void* src1, const void* src2) override {
|
||||
int errors = 0;
|
||||
auto a = (float*)src1;
|
||||
auto b = (float*)src2;
|
||||
auto c = (float*)dst;
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
auto x = fmin(a[i], b[i]);
|
||||
auto y = fmax(a[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;
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
};
|
||||
|
||||
class Test_BAR : public ITestCase {
|
||||
public:
|
||||
Test_BAR(TestSuite* suite) : ITestCase(suite, "bar") {}
|
||||
|
@ -794,6 +826,7 @@ TestSuite::TestSuite(vx_device_h device)
|
|||
this->add_test(new Test_FTOU(this));
|
||||
this->add_test(new Test_ITOF(this));
|
||||
this->add_test(new Test_UTOF(this));
|
||||
this->add_test(new Test_MINMAX(this));
|
||||
this->add_test(new Test_BAR(this));
|
||||
this->add_test(new Test_GBAR(this));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue