Skip to content
Snippets Groups Projects
Commit 85ab3e46 authored by Bouquillon Fabien's avatar Bouquillon Fabien
Browse files

correction ucb

parent 776b083b
Branches
No related tags found
No related merge requests found
all:bs.task cover.task crc.task fdct.task fibcall.task insertsort.task janne_complex.task jfdctint.task lcdnum.task matmult.task ndes.task nsichneu.task dijkstra.task g723_enc.task countnegative.task
all:malardalen
%.task: ../bin/%.exe
../application $< ./cache_32KB_2w_40.xml ../bin/$*.ffx ./tasks_dir/c_32KB_2w_40.tasks
../application $< ./cache_32KB_4w_40.xml ../bin/$*.ffx ./tasks_dir/c_32KB_4w_40.tasks
../application $< ./cache_32KB_8w_40.xml ../bin/$*.ffx ./tasks_dir/c_32KB_8w_40.tasks
../application $< ./cache_32KB_2w_70.xml ../bin/$*.ffx ./tasks_dir/c_32KB_2w_70.tasks
../application $< ./cache_32KB_4w_70.xml ../bin/$*.ffx ./tasks_dir/c_32KB_4w_70.tasks
../application $< ./cache_32KB_8w_70.xml ../bin/$*.ffx ./tasks_dir/c_32KB_8w_70.tasks
../application $< ./cache_32KB_2w_100.xml ../bin/$*.ffx ./tasks_dir/c_32KB_2w_100.tasks
../application $< ./cache_32KB_4w_100.xml ../bin/$*.ffx ./tasks_dir/c_32KB_4w_100.tasks
../application $< ./cache_32KB_8w_100.xml ../bin/$*.ffx ./tasks_dir/c_32KB_8w_100.tasks
../application $< ./cache_8KB_2w_40.xml ../bin/$*.ffx ./tasks_dir/c_8KB_2w_40.tasks
../application $< ./cache_8KB_4w_40.xml ../bin/$*.ffx ./tasks_dir/c_8KB_4w_40.tasks
../application $< ./cache_8KB_8w_40.xml ../bin/$*.ffx ./tasks_dir/c_8KB_8w_40.tasks
../application $< ./cache_8KB_2w_70.xml ../bin/$*.ffx ./tasks_dir/c_8KB_2w_70.tasks
../application $< ./cache_8KB_4w_70.xml ../bin/$*.ffx ./tasks_dir/c_8KB_4w_70.tasks
../application $< ./cache_8KB_8w_70.xml ../bin/$*.ffx ./tasks_dir/c_8KB_8w_70.tasks
../application $< ./cache_8KB_2w_100.xml ../bin/$*.ffx ./tasks_dir/c_8KB_2w_100.tasks
../application $< ./cache_8KB_4w_100.xml ../bin/$*.ffx ./tasks_dir/c_8KB_4w_100.tasks
../application $< ./cache_8KB_8w_100.xml ../bin/$*.ffx ./tasks_dir/c_8KB_8w_100.tasks
../application $< ./cache_16KB_2w_40.xml ../bin/$*.ffx ./tasks_dir/c_16KB_2w_40.tasks
../application $< ./cache_16KB_4w_40.xml ../bin/$*.ffx ./tasks_dir/c_16KB_4w_40.tasks
../application $< ./cache_16KB_8w_40.xml ../bin/$*.ffx ./tasks_dir/c_16KB_8w_40.tasks
../application $< ./cache_16KB_2w_70.xml ../bin/$*.ffx ./tasks_dir/c_16KB_2w_70.tasks
../application $< ./cache_16KB_4w_70.xml ../bin/$*.ffx ./tasks_dir/c_16KB_4w_70.tasks
../application $< ./cache_16KB_8w_70.xml ../bin/$*.ffx ./tasks_dir/c_16KB_8w_70.tasks
../application $< ./cache_16KB_2w_100.xml ../bin/$*.ffx ./tasks_dir/c_16KB_2w_100.tasks
../application $< ./cache_16KB_4w_100.xml ../bin/$*.ffx ./tasks_dir/c_16KB_4w_100.tasks
../application $< ./cache_16KB_8w_100.xml ../bin/$*.ffx ./tasks_dir/c_16KB_8w_100.tasks
malardalen: bs.task cover.task fdct.task fibcall.task insertsort.task janne_complex.task jfdctint.task lcdnum.task matmult.task ndes.task
taclebench: dijkstra.task g723_enc.task countnegative.task nsichneu.task crc.task
%.task: ../../bin/%.exe
../../application $< ../cache_8KB_2w_50.xml ../../bin/$*.ffx ./c_8KB_2w_50/tasks_set.tasks
../../application $< ../cache_8KB_4w_50.xml ../../bin/$*.ffx ./c_8KB_4w_50/tasks_set.tasks
../../application $< ../cache_8KB_2w_100.xml ../../bin/$*.ffx ./c_8KB_2w_100/tasks_set.tasks
../../application $< ../cache_8KB_4w_100.xml ../../bin/$*.ffx ./c_8KB_4w_100/tasks_set.tasks
../../application $< ../cache_8KB_2w_200.xml ../../bin/$*.ffx ./c_8KB_2w_200/tasks_set.tasks
../../application $< ../cache_8KB_4w_200.xml ../../bin/$*.ffx ./c_8KB_4w_200/tasks_set.tasks
../../application $< ../cache_16KB_2w_50.xml ../../bin/$*.ffx ./c_16KB_2w_50/tasks_set.tasks
../../application $< ../cache_16KB_4w_50.xml ../../bin/$*.ffx ./c_16KB_4w_50/tasks_set.tasks
../../application $< ../cache_16KB_2w_100.xml ../../bin/$*.ffx ./c_16KB_2w_100/tasks_set.tasks
../../application $< ../cache_16KB_4w_100.xml ../../bin/$*.ffx ./c_16KB_4w_100/tasks_set.tasks
../../application $< ../cache_16KB_2w_200.xml ../../bin/$*.ffx ./c_16KB_2w_200/tasks_set.tasks
../../application $< ../cache_16KB_4w_200.xml ../../bin/$*.ffx ./c_16KB_4w_200/tasks_set.tasks
clean:
rm -f *.tasks *.task
rm -f ./c_8KB_2w_50/tasks_set.tasks ./c_8KB_4w_50/tasks_set.tasks ./c_8KB_2w_100/tasks_set.tasks ./c_8KB_4w_100/tasks_set.tasks ./c_8KB_2w_200/tasks_set.tasks ./c_8KB_4w_200/tasks_set.tasks ./c_16KB_2w_50/tasks_set.tasks ./c_16KB_4w_50/tasks_set.tasks ./c_16KB_2w_100/tasks_set.tasks ./c_16KB_4w_100/tasks_set.tasks ./c_16KB_2w_200/tasks_set.tasks ./c_16KB_4w_200/tasks_set.tasks
......@@ -91,7 +91,7 @@ namespace otawa {
case FIRST_MISS:
#ifndef __NO_LOOP_BOUND__
tmp_e.counter = nb_iter/nb_max_iter;
tmp_e.counter = max(nb_iter/nb_max_iter, 1);
#else
if(loop_bound::IN_LOOP(bb)) {
tmp_e.counter = cache->wayCount();
......@@ -104,7 +104,7 @@ namespace otawa {
case FIRST_HIT:
#ifndef __NO_LOOP_BOUND__
tmp_e.counter = nb_iter - (nb_iter/nb_max_iter);
tmp_e.counter = max(nb_iter - (nb_iter/nb_max_iter), 1);
#else
if(loop_bound::IN_LOOP(bb)) {
tmp_e.counter = cache->wayCount();
......@@ -117,7 +117,7 @@ namespace otawa {
default:
#ifndef __NO_LOOP_BOUND__
tmp_e.counter = nb_iter;
tmp_e.counter = max(nb_iter, 1);
#else
if(loop_bound::IN_LOOP(bb)) {
tmp_e.counter = cache->wayCount();
......
......@@ -80,6 +80,9 @@ namespace otawa {
iteration = 1;
iteration_max = 1;
}
if(iteration == 0) {
iteration = 1;
}
IN_LOOP(b) = in_loop;
TOTAL_BOUND(b) = iteration;
MAX_BOUND(b) = iteration_max;
......
......@@ -24,6 +24,7 @@
#include "../../cache_block_id/include/cache_block_id.h"
#include <multiset.h>
#include <otawa/cfg/Loop.h>
namespace otawa {
namespace ucb_otawa {
......@@ -45,6 +46,12 @@ namespace otawa {
bool bb;
BasicBlock *basic_block;
// Loop informations
bool is_top;
Loop* loop_of;
bool is_loop_header;
int loop_id;
//----------------------------------------------------------
std::vector<struct preemption_node*> pred;
......@@ -66,6 +73,10 @@ namespace otawa {
bool arc;
preemption_node() {
is_top = true;
loop_of = NULL;
is_loop_header = false;
loop_id = -1;
synth = false;
bb = false;
lb = false;
......
#include "include/ucb_otawa.h"
#include <otawa/cfg/Loop.h>
#include <multiset.h>
using namespace Mathset;
......@@ -45,13 +45,34 @@ namespace otawa {
}
bool is_in_loop(struct preemption_node* node, int loop_id) {
if(node->loop_id == loop_id) {
return true;
}
Loop* parent_loop = node->loop_of;
while(parent_loop != NULL) {
if(parent_loop->header()->id() == loop_id) {
return true;
}
parent_loop = parent_loop->parent();
}
return false;
}
void insert_fct(struct preemption_graph* graph) {
void insert_fct(struct preemption_graph* graph, int top_loop_id) {
for(int i = 0; i < graph->nodes.size(); i++) {
if(graph->nodes[i]->is_top) {
graph->nodes[i]->loop_id = top_loop_id;
}
if(graph->nodes[i]->synth) {
insert_fct(graph->nodes[i]->fct);
insert_fct(graph->nodes[i]->fct, graph->nodes[i]->loop_id);
std::vector<struct preemption_node*> pred = graph->nodes[i]->pred;
......@@ -148,6 +169,17 @@ namespace otawa {
category_t status = cache::CATEGORY(lb);
tmp = new struct preemption_node;
if(graph->nodes[i]->is_loop_header) {
tmp->is_loop_header = true;
} else {
tmp->is_loop_header = false;
}
tmp->loop_id = graph->nodes[i]->loop_id;
tmp->loop_of = Loop::of(graph->nodes[i]->basic_block);
tmp->is_top = graph->nodes[i]->is_top;
tmp->status = status;
tmp->bb = false;
tmp->lb = true;
......@@ -207,6 +239,11 @@ namespace otawa {
//copier l'id
tmp->id_b = b->id();
//Loop
tmp->loop_id = Loop::of(b)->header()->id();
tmp->is_top = Loop::of(b)->isTop();
tmp->is_loop_header = (tmp->id_b == tmp->loop_id);
bool found = false;
for(int i = 0; i < graph->nodes.size(); i++) {
if(graph->nodes[i]->id_b == tmp->id_b) {
......@@ -260,24 +297,34 @@ namespace otawa {
bool mark_always(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited) {
bool found = false;
//If not visited yet
for(int i = 0; i < visited.size(); i++) {
if(visited[i] == node->id) {
//we return false because we do not encounter any block from the same CBL on this path
return false;
}
}
if(node->cb_id == cb_id) {
//If the node is from the same CBL we return true
//It is the first block from this CBL encounter
return true;
} else {
//we said we visit this block
visited.push_back(node->id);
bool not_reach = true;
//we visit predecessors (and build path)
for(int i = 0; i < node->pred.size(); i++) {
if(mark_always(node->pred[i], lb_id, cb_id, visited)) {
not_reach = false;
break;
}
}
//if this block is contains in a hit path then we cachedthe CBL in it
if(not_reach) {
return false;
} else {
......@@ -287,58 +334,41 @@ namespace otawa {
}
}
bool is_reached(struct preemption_node* node, int lb_id, std::vector<int> visited) {
bool found = false;
for(int i = 0; i < visited.size(); i++) {
if(visited[i] == node->id) {
return false;
}
}
if(node->id == lb_id) {
return true;
}
visited.push_back(node->id);
for(int i = 0; i < node->pred.size(); i++) {
if(is_reached(node->pred[i], lb_id, visited)) {
return true;
}
}
bool mark_hit(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited, int loop_id) {
// if the node is not in the loop then it can't be in path that provoke an hit
if(is_in_loop(node, loop_id)) {
return false;
}
bool mark_miss(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited) {
bool found = false;
//If not visited yet
for(int i = 0; i < visited.size(); i++) {
if(visited[i] == node->id) {
//we return false because we do not encounter any block from the same CBL on this path
return false;
}
}
if(node->cb_id == cb_id) {
if(node->id == lb_id) {
//If the node is from the same CBL we return true
//It is the first block from this CBL encounter
return true;
} else {
//we said we visit this block
visited.push_back(node->id);
if(is_reached(node, lb_id, visited)) {
return true;
}
return false;
}
} else {
visited.push_back(node->id);
bool not_reach = true;
//we visit predecessors (and build path)
for(int i = 0; i < node->pred.size(); i++) {
if(mark_always(node->pred[i], lb_id, cb_id, visited)) {
if(mark_hit(node->pred[i], lb_id, cb_id, visited, loop_id)) {
not_reach = false;
break;
}
}
//if this block is contains in a hit path then we cachedthe CBL in it
if(not_reach) {
return false;
} else {
......@@ -348,34 +378,41 @@ namespace otawa {
}
}
bool mark_hit(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited) {
bool mark_miss(struct preemption_node* node, int lb_id, Address cb_id, std::vector<int> visited, int loop_id) {
bool found = false;
// if the node is not in the loop then it can't be in path that provoke an hit
if(!is_in_loop(node, loop_id)) {
return false;
}
//If not visited yet
for(int i = 0; i < visited.size(); i++) {
if(visited[i] == node->id) {
//we return false because we do not encounter any block from the same CBL on this path
return false;
}
}
if(node->cb_id == cb_id) {
if(node->id != lb_id) {
visited.push_back(node->id);
if(is_reached(node, lb_id, visited)) {
return false;
}
//If the node is from the same CBL we return true
//It is the first block from this CBL encounter
return true;
} else {
return false;
}
} else {
//we said we visit this block
visited.push_back(node->id);
bool not_reach = true;
//we visit predecessors (and build path)
for(int i = 0; i < node->pred.size(); i++) {
if(mark_always(node->pred[i], lb_id, cb_id, visited)) {
if(mark_miss(node->pred[i], lb_id, cb_id, visited, loop_id)) {
not_reach = false;
break;
}
}
//if this block is contains in a hit path then we cachedthe CBL in it
if(not_reach) {
return false;
} else {
......@@ -401,14 +438,14 @@ namespace otawa {
case FIRST_MISS:
std::cout << " FIRST MISS ---------------------------------" << std::endl;
for(int i = 0; i < node->pred.size(); i++) {
mark_miss(node->pred[i], node->id, node->cb_id, visited);
mark_miss(node->pred[i], node->id, node->cb_id, visited, node->loop_id);
}
break;
case FIRST_HIT:
std::cout << " FIRST HIT ---------------------------------" << std::endl;
for(int i = 0; i < node->pred.size(); i++) {
mark_hit(node->pred[i], node->id, node->cb_id, visited);
mark_hit(node->pred[i], node->id, node->cb_id, visited, node->loop_id);
}
break;
......@@ -542,7 +579,8 @@ namespace otawa {
link_all_nodes_for_real(graph);
int id = 0;
insert_fct(graph);
insert_fct(graph, graph->nodes[0]->loop_id);
insert_lb(graph, id);
compute_useful_cache_blocks(graph);
delete_doublon(graph);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment