Skip to content
Snippets Groups Projects
Commit 48b330f5 authored by Daniel Maier's avatar Daniel Maier
Browse files

info2: bpp

parent dfce23af
No related branches found
No related tags found
No related merge requests found
......@@ -8,10 +8,12 @@
#include <tuple>
#include <set>
#include <list>
#include <algorithm>
/* scop id, set of instructions, dimension */
using perf_t = std::tuple<int, std::set<int>, int>;
enum Strategy { pprows, ppcols, ppcenter, permutation };
enum Strategy { pprows, ppcols, ppcenter, permutation, bpp };
std::ostream & operator << (std::ostream &out, const perf_t &p) {
auto [j, xx, k] = p;
......@@ -33,10 +35,13 @@ int main(int argc, char *argv[]) {
<< " --pprows paraprox rows\n"
<< " --ppcols paraprox cols\n"
<< " --ppcenter paraprox center\n"
<< " --bpp bpp\n"
<< "\n";
return -1;
}
bool reconstruct = true;
Strategy strategy;
if(!strcmp(argv[1], "--permutation"))
strategy = permutation;
......@@ -46,6 +51,8 @@ int main(int argc, char *argv[]) {
strategy = ppcols;
else if(!strcmp(argv[1], "--ppcenter"))
strategy = ppcenter;
else if(!strcmp(argv[1], "--bpp"))
strategy = bpp;
else {
std::cerr << "invalid strategy\n";
return -1;
......@@ -105,13 +112,21 @@ int main(int argc, char *argv[]) {
std::vector<perf_t> list{ std::make_move_iterator(std::begin(l)),
std::make_move_iterator(std::end(l)) };
/* get id of last scop */
auto output_scop_id = std::get<0>(*(std::max_element(list.begin(), list.end(), [](perf_t x, perf_t y) {return std::get<0>(x) < std::get<0>(y);})));
if(strategy == permutation) {
for(unsigned i = 1; i < pow(2, list.size()); i++) {
std::cout << "config;" << i << "\n";
for(unsigned j = 0; j < list.size(); j++) {
if ((i>>j)&1) {
std::cout << list[j] << "\n";
std::cout << list[j];
if(reconstruct && output_scop_id == std::get<0>(list[j]))
std::cout << ";1";
else
std::cout << ";";
std::cout << "\n";
}
}
std::cout << "\n";
......@@ -123,7 +138,12 @@ int main(int argc, char *argv[]) {
int last_scop = -1;
for(auto el : list) {
if(last_scop != std::get<0>(el)) { /* using this we != we always pick the first element for each scop */
std::cout << el << "\n";
std::cout << el;
if(reconstruct && output_scop_id == std::get<0>(el))
std::cout << ";1";
else
std::cout << ";";
std::cout << "\n";
last_scop = std::get<0>(el);
}
}
......@@ -135,7 +155,12 @@ int main(int argc, char *argv[]) {
int last_scop = -1;
for(auto el : list) {
if(last_scop == std::get<0>(el)) { /* here we pick the *second* occurence for each scop */
std::cout << el << "\n";
std::cout << el;
if(reconstruct && output_scop_id == std::get<0>(el))
std::cout << ";1";
else
std::cout << ";";
std::cout << "\n";
last_scop = -1; /* making sure 3d scops also work */
continue;
}
......@@ -149,7 +174,19 @@ int main(int argc, char *argv[]) {
perf_t last_el;
for(auto el : list) {
if(std::get<0>(last_el) == std::get<0>(el)) { /* here we pick the first *and* second occurence for each scop */
std::cout << last_el << "\n" << el << "\n";
std::cout << last_el;
if(reconstruct && output_scop_id == std::get<0>(last_el))
std::cout << ";1";
else
std::cout << ";";
std::cout << "\n";
std::cout << el;
if(reconstruct && output_scop_id == std::get<0>(el))
std::cout << ";1";
else
std::cout << ";";
std::cout << "\n";
last_el = {}; /* making sure 3d scops also work */
continue;
}
......@@ -157,6 +194,22 @@ int main(int argc, char *argv[]) {
}
std::cout << "\n";
}
else if(strategy == bpp) {
/* FIXME: bpp should be more like an option...
* --cols-bpp
* --rows-bpp
* --center-bpp
* */
int i = 0;
for(auto el : list) {
if(output_scop_id == std::get<0>(el)) {
std::cout << "config;" << i++ << "\n";
std::cout << std::get<0>(el) << ";"
<< *(std::get<1>(el).rbegin()) << ";"
<< std::get<2>(el) << "\n\n";
}
}
}
#if 0
std::cerr << "list size is now " << list.size() << "\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment