Files
triton/tests/bench/copy2d.cc

37 lines
1.2 KiB
C++
Raw Normal View History

2019-09-23 12:07:24 -04:00
#include <iostream>
#include <tuple>
#include "copy.h"
2019-09-03 12:44:35 -04:00
#include "triton/driver/backend.h"
int main() {
// initialize default compute device
auto context = triton::driver::backend::contexts::get_default();
triton::driver::stream* stream = triton::driver::stream::create(context);
// shapes to benchmark
2019-09-23 12:07:24 -04:00
typedef std::tuple<std::vector<int>, std::vector<int>, std::vector<int>> config_t;
std::vector<config_t> configs = {
{{4096*4096}, {0}, {0}},
2019-09-23 12:07:24 -04:00
{{4096, 4096}, {0, 1}, {1, 0}},
{{4096, 4096}, {0, 1}, {1, 0}},
{{4096, 4096}, {1, 0}, {0, 1}},
{{4096, 4096}, {0, 1}, {0, 1}},
{{256, 256, 256}, {0, 1, 2}, {0, 1, 2}},
{{256, 256, 256}, {0, 1, 2}, {0, 2, 1}},
{{256, 256, 256}, {1, 0, 2}, {1, 2, 0}},
{{256, 256, 256}, {1, 2, 0}, {1, 0, 2}},
{{256, 256, 256}, {2, 0, 1}, {0, 1, 2}},
{{256, 256, 256}, {2, 1, 0}, {0, 2, 1}}
};
2019-09-03 12:44:35 -04:00
// does the work
2019-09-23 12:07:24 -04:00
std::vector<int32_t> shape;
std::vector<int32_t> ord_x, ord_y;
2019-09-03 12:44:35 -04:00
for(const auto& c: configs){
2019-09-23 12:07:24 -04:00
std::tie(shape, ord_x, ord_y) = c;
std::cout << "// " << c << std::flush;
for(auto perf: bench_copy_nd(stream, shape, ord_x, ord_y))
2019-09-03 12:44:35 -04:00
std::cout << ", " << perf << std::flush;
std::cout << std::endl;
}
}