PIPS
task_parallelization.h File Reference
#include "task_private.h"
#include "dg.h"
#include "graph.h"
+ Include dependency graph for task_parallelization.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  annotation
 
struct  cluster
 

Macros

#define MPI_COMM_WORLD_STRING   "MPI_COMM_WORLD"
 
#define MPI_GENERATION_NBR_CLUSTER   "MPI_NBR_CLUSTER"
 
#define MPI_GENERATION_PREFIX   "MPI_DUPLICATE_VARIABLE_PREFIX"
 
#define MPI_GENERATION_PRIVATE_VARIABLES_LIST   "MPI_PRIVATE_VARIABLES_LIST"
 
#define MPI_GENERATION_PRIVATE_PARAMETER   "MPI_PRIVATE_PARAMETER"
 
#define COMMENT_VARIABLE_REPLICATION   " Generated by Pass VARIABLE_REPLICATION\n"
 
#define COMMENT_COPY_VARIABLE   " Generated by Pass COPY_VARIABLE\n"
 
#define COMMENT_MPI_CONVERSION   " Generated by Pass MPI_CONVERSION\n"
 

Typedefs

typedef dg_arc_label arc_label
 Warning! Do not modify this file that is automatically generated! More...
 
typedef dg_vertex_label vertex_label
 

Functions

_Bool statement_equal_p (statement, statement)
 
vertex statement_to_vertex (statement, graph)
 
graph partitioning_sdg (statement)
 
void print_SDGs (statement, graph, FILE *, gen_array_t)
 
_Bool sequence_dependence_graph (char *)
 
_Bool costly_task (statement)
 cost_model.c More...
 
double polynomial_to_numerical (Ppolynome)
 
double size_of_regions (list)
 
double edge_cost (statement, statement)
 
double t_level (vertex, graph, gen_array_t)
 First parameter is the top level (earliest start time) for each node. More...
 
void top_level (graph, gen_array_t)
 
void bottom_level (graph, gen_array_t)
 Second parameter is the bottom level (latest start time) for each node. More...
 
void priorities (gen_array_t)
 
void initialization (graph, gen_array_t)
 
void parse_instrumented_file (char *, graph, gen_array_t)
 
void allocate_task_to_cluster (statement, int, int)
 BDSC.c. More...
 
int BDSC (sequence, int, int, int)
 
int DSC (sequence, int)
 
list topological_sort (statement)
 
int hierarchical_schedule (statement, int, int, int, _Bool)
 
_Bool hbdsc_parallelization (char *)
 he main function for performing the hierarchical scheduling (scheduled SDG) using BDSC and generating the graph (unstructured) BDSC-based top-down hierarchical scheduling More...
 
_Bool dsc_code_parallelization (char *)
 he main function for performing the hierarchical scheduling (scheduled SDG) using DSC and generating SPIRE More...
 
_Bool bdsc_code_instrumentation (char *)
 instrumentation.c More...
 
void cluster_stage_spire_generation (persistant_statement_to_cluster, graph, statement, int)
 he main function More...
 
_Bool spire_shared_unstructured_to_structured (char *)
 
_Bool spire_distributed_unstructured_to_structured (char *)
 
statement make_com_loopbody (entity, _Bool, list, int)
 communication_generation.c More...
 
statement region_to_com_nest (effect, _Bool, int)
 
void communications_construction (graph, statement, persistant_statement_to_cluster, int)
 
_Bool openmp_task_generation (char *)
 openmp_generation.c More...
 
_Bool mpi_task_generation (char *)
 mpi_generation.c More...
 
bool parallel_task_mapping_undefined_p (void)
 task_mapping.c More...
 
void reset_parallel_task_mapping (void)
 
void error_reset_parallel_task_mapping (void)
 
void set_parallel_task_mapping (statement_task)
 
statement_task get_parallel_task_mapping (void)
 
void init_parallel_task_mapping (void)
 
void close_parallel_task_mapping (void)
 
void store_parallel_task_mapping (statement, task)
 
void update_parallel_task_mapping (statement, task)
 
task load_parallel_task_mapping (statement)
 
task delete_parallel_task_mapping (statement)
 
bool bound_parallel_task_mapping_p (statement)
 
void store_or_update_parallel_task_mapping (statement, task)
 
void print_task (task)
 Pass: TASK_MAPPING Debug mode: MPI_GENERATION_DEBUG_LEVEL Resource generated: More...
 
string task_to_string (task, bool)
 
bool task_mapping (const char *)
 PIPS pass. More...
 
bool copy_value_of_write (const char *)
 copy_value_of_write.c More...
 
bool copy_value_of_write_with_cumulated_regions (const char *)
 PIPS pass. More...
 
bool variable_replication (const char *)
 variable_replication.c More...
 
bool eliminate_original_variables (const char *)
 eliminate_original_variables.c More...
 
bool mpi_conversion (const char *)
 mpi_conversion.c More...
 

Variables

int NBCLUSTERS
 cproto-generated files More...
 
int MEMORY_SIZE
 
string INSTRUMENTED_FILE
 
gen_array_t annotations
 Global variables. More...
 
gen_array_t clusters
 
graph kdg
 HBDSC.c. More...
 
graph ddg
 
statement return_st
 
persistant_statement_to_cluster stmt_to_cluster
 
list com_declarations_to_add
 spire_generation.c More...
 

Macro Definition Documentation

◆ COMMENT_COPY_VARIABLE

#define COMMENT_COPY_VARIABLE   " Generated by Pass COPY_VARIABLE\n"

Definition at line 47 of file task_parallelization.h.

◆ COMMENT_MPI_CONVERSION

#define COMMENT_MPI_CONVERSION   " Generated by Pass MPI_CONVERSION\n"

Definition at line 48 of file task_parallelization.h.

◆ COMMENT_VARIABLE_REPLICATION

#define COMMENT_VARIABLE_REPLICATION   " Generated by Pass VARIABLE_REPLICATION\n"

Definition at line 46 of file task_parallelization.h.

◆ MPI_COMM_WORLD_STRING

#define MPI_COMM_WORLD_STRING   "MPI_COMM_WORLD"

Definition at line 38 of file task_parallelization.h.

◆ MPI_GENERATION_NBR_CLUSTER

#define MPI_GENERATION_NBR_CLUSTER   "MPI_NBR_CLUSTER"

Definition at line 40 of file task_parallelization.h.

◆ MPI_GENERATION_PREFIX

#define MPI_GENERATION_PREFIX   "MPI_DUPLICATE_VARIABLE_PREFIX"

Definition at line 41 of file task_parallelization.h.

◆ MPI_GENERATION_PRIVATE_PARAMETER

#define MPI_GENERATION_PRIVATE_PARAMETER   "MPI_PRIVATE_PARAMETER"

Definition at line 44 of file task_parallelization.h.

◆ MPI_GENERATION_PRIVATE_VARIABLES_LIST

#define MPI_GENERATION_PRIVATE_VARIABLES_LIST   "MPI_PRIVATE_VARIABLES_LIST"

Definition at line 43 of file task_parallelization.h.

Typedef Documentation

◆ arc_label

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/task_parallelization/task_parallelization-local.h instead, to add your own modifications. header file built by cproto task_parallelization-local.h Instantiation of the dependence graph:

Definition at line 15 of file task_parallelization.h.

◆ vertex_label

Definition at line 16 of file task_parallelization.h.

Function Documentation

◆ allocate_task_to_cluster()

void allocate_task_to_cluster ( statement  ready_st,
int  cl_p,
int  order 
)

BDSC.c.

Parameters
ready_steady_st
cl_pl_p
orderrder

Definition at line 100 of file BDSC.c.

100  {
102  list vertices = graph_vertices(kdg);
103  an->scheduled = true;
104  an->order_sched = order;
105  an->cluster = cl_p;
108  else
110  //delete ready_st from successors(tasks(cl_p))
111  FOREACH(VERTEX, pre, vertices) {
112  statement parent = vertex_to_statement(pre);
114  if(anp->cluster == cl_p)
115  {
116  FOREACH(SUCCESSOR, su, (vertex_successors(pre))) {
117  vertex v = successor_vertex(su);
118  statement child = vertex_to_statement(v);
119  if(statement_equal_p(child, ready_st)){
120  double *ec = (double *)malloc(sizeof(double));
121  *ec = 0;
122  gen_array_addto(anp->edge_cost,(int)statement_ordering(ready_st), ec);
123  gen_array_addto(annotations, (int)statement_ordering(parent), anp);
124  }
125  }
126  }
127  }
128 
129  cluster *cl = gen_array_item(clusters, cl_p);
130  double time = cl->time;
131  double time1 = (time > an->tlevel) ? (time + an->task_time) : (an->tlevel + an->task_time);
132  cl->time = time1;
135  cl->data = l_data;
136  }
137  gen_array_addto(clusters, cl_p, cl);
138  update_priority_values(ready_st);
139  return;
140 }
static void update_priority_values(statement ready_st)
Definition: BDSC.c:81
persistant_statement_to_cluster stmt_to_cluster
Definition: HBDSC.c:56
graph kdg
Global variables.
Definition: HBDSC.c:52
void update_persistant_statement_to_cluster(persistant_statement_to_cluster f, intptr_t k, intptr_t v)
Definition: ri.c:1543
void extend_persistant_statement_to_cluster(persistant_statement_to_cluster f, intptr_t k, intptr_t v)
Definition: ri.c:1546
bool bound_persistant_statement_to_cluster_p(persistant_statement_to_cluster f, intptr_t k)
Definition: ri.c:1552
gen_array_t clusters
Definition: SDG.c:63
gen_array_t annotations
Global variables.
Definition: SDG.c:62
void gen_array_addto(gen_array_t a, size_t i, void *what)
Definition: array.c:87
void * gen_array_item(const gen_array_t a, size_t i)
Definition: array.c:143
list RegionsMustUnion(list l1, list l2, bool(*union_combinable_p)(effect, effect))
list RegionsMustUnion(list l1, list l2, union_combinable_p) input : two lists of regions output : a l...
list regions_dup(list)
bool r_w_combinable_p(effect, effect)
void * malloc(YYSIZE_T)
#define successor_vertex(x)
Definition: graph.h:118
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
size_t gen_length(const list l)
Definition: list.c:150
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
static vertex statement_to_vertex(statement s, graph g)
Definition: impact_check.c:227
static bool statement_equal_p(statement s1, statement s2)
Definition: unstructured.c:55
#define statement_ordering(x)
Definition: ri.h:2454
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References annotations, bound_persistant_statement_to_cluster_p(), annotation::cluster, clusters, annotation::data, cluster::data, annotation::edge_cost, extend_persistant_statement_to_cluster(), FOREACH, gen_array_addto(), gen_array_item(), gen_length(), graph_vertices, kdg, malloc(), annotation::order_sched, r_w_combinable_p(), regions_dup(), RegionsMustUnion(), annotation::scheduled, statement_equal_p(), statement_ordering, statement_to_vertex(), stmt_to_cluster, SUCCESSOR, successor_vertex, annotation::task_time, cluster::time, annotation::tlevel, update_persistant_statement_to_cluster(), update_priority_values(), VERTEX, vertex_successors, and vertex_to_statement().

Referenced by BDSC(), DSC(), DSRW(), find_cluster(), hierarchical_schedule(), and zeroing_multiple_edges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BDSC()

int BDSC ( sequence  seq,
int  P,
int  M,
int  ordering 
)

canf instruction should be scheduled in the master cluster (by convention 0)

f(get_bool_property("BDSC_DISTRIBUTED_MEMORY")) zeroing_p = zeroing_multiple_edges(ready_task, order,M); function Not validated else

Parameters
seqeq
orderingrdering

Definition at line 535 of file BDSC.c.

535  {
536  if(P <= 0)
537  return 0;
538  int nbclusters = 0;
539  int order = 0, cl_p = -1;
540  list unscheduled_tasks = NIL;
541  list ready_tasks = NIL, unready_tasks = NIL;
542  list stmts = sequence_statements(seq);
543  statement ready_task = statement_undefined, unready_task = statement_undefined;
544  gen_array_t annotations_s = schedule_failsafe();
545  bool other_rules_p = false, scanf_p = false;
550  FOREACH(statement, st, stmts){
551  if(!declaration_statement_p(st)) {
552  unscheduled_tasks = CONS(STATEMENT, st, unscheduled_tasks);
553  if(ready_node(st))
554  ready_tasks = CONS(STATEMENT, st, ready_tasks);
555  else
556  unready_tasks = CONS(STATEMENT, st, unready_tasks);
557  }
558  }
559  while(gen_length(unscheduled_tasks) > 0 ){
560  ready_task = select_task_with_highest_priority(ready_tasks, statement_undefined);
561  unready_task = select_task_with_highest_priority(unready_tasks, ready_task);
562  other_rules_p = false, scanf_p = false;
563  if(statement_call_p(ready_task)){
564  entity f = call_function(statement_call(ready_task));
567  scanf_p = true;
568  }
569  if(scanf_p){
570  /*scanf instruction should be scheduled in the master cluster
571  (by convention 0)*/
572  allocate_task_to_cluster(ready_task, 0, order);
573  if(nbclusters == 0)
574  nbclusters ++;
575  }
576  else{
577  if(statement_undefined_p(unready_task)){
578  cl_p = -1;
579  statement min_pred = ready_task;
580  bool zeroing_p = true;
581  /*if(get_bool_property("BDSC_DISTRIBUTED_MEMORY"))
582  zeroing_p = zeroing_multiple_edges(ready_task, order,M);
583  //function Not validated
584  else*/
585  {
586  min_start_time min_pred_s = tlevel_decrease(ready_task,M);
587  min_pred = min_pred_s.min_tau;
588  if(min_pred != statement_undefined)
589  {
591  cl_p = anp->cluster;
592  allocate_task_to_cluster(ready_task,cl_p, order);
593  }
594  }
595  if(min_pred == statement_undefined || !zeroing_p)
596  other_rules_p = true;
597  }
598  else {
599  other_rules_p = DSRW(ready_task, unready_task,order,M);
600  }
601  if(other_rules_p)
602  nbclusters = find_cluster(ready_task, nbclusters, P, M, order, stmts, annotations_s);
603  if(nbclusters == -1)//not enough memorry
604  return -1;
605  }
606  gen_remove_once(&unscheduled_tasks, ready_task);
607  FOREACH(statement, st, unready_tasks){
608  if(ready_node(st))
609  gen_remove_once(&unready_tasks, st);
610  }
611  ready_tasks = NIL;
612  FOREACH(statement, st, unscheduled_tasks) {
613  if(ready_node(st))
614  ready_tasks = CONS(STATEMENT, st, ready_tasks);
615  }
616  order ++;
617  }
618  gen_array_free(annotations_s);
619  update_parallel_task(ordering, nbclusters);
620  return nbclusters;
621 }
static statement select_task_with_highest_priority(list tasks, statement ready)
Definition: BDSC.c:431
static gen_array_t schedule_failsafe()
Definition: BDSC.c:451
static void initialization_clusters(bool first_p)
eset to zero for each new sequence to handle
Definition: BDSC.c:487
void allocate_task_to_cluster(statement ready_st, int cl_p, int order)
BDSC.c.
Definition: BDSC.c:100
static int find_cluster(statement ready_task, int nbclusters, int P, int M, int order, list stmts, gen_array_t annotations_s)
Definition: BDSC.c:511
static bool DSRW(statement ready_st, statement unready_st, int order, int M)
Definition: BDSC.c:407
static bool ready_node(statement st)
Definition: BDSC.c:59
static void update_parallel_task(int ordering, int nbclusters)
Definition: BDSC.c:503
static min_start_time tlevel_decrease(statement ready_st, int M)
Definition: BDSC.c:175
void gen_array_free(gen_array_t a)
Definition: array.c:70
void bottom_level(graph dg, gen_array_t annotations)
Second parameter is the bottom level (latest start time) for each node.
Definition: cost_model.c:223
void top_level(graph dg, gen_array_t annotations)
Definition: cost_model.c:211
void priorities(gen_array_t annotations)
Definition: cost_model.c:253
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
Definition: list.c:691
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
call statement_call(statement)
Get the call of a statement.
Definition: statement.c:1406
bool statement_call_p(statement)
Definition: statement.c:364
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define ENTITY_FSCANF_P(e)
#define ENTITY_SCANF_P(e)
#define ENTITY_ISOC99_SSCANF_P(e)
#define ENTITY_ISOC99_SCANF_P(e)
#define ENTITY_SSCANF_P(e)
#define ENTITY_ISOC99_FSCANF_P(e)
#define call_function(x)
Definition: ri.h:709
#define sequence_statements(x)
Definition: ri.h:2360
#define statement_undefined_p(x)
Definition: ri.h:2420
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
Global variables.
Definition: BDSC.c:53
statement min_tau
Definition: BDSC.c:55

References allocate_task_to_cluster(), annotations, bottom_level(), call_function, annotation::cluster, CONS, declaration_statement_p(), DSRW(), ENTITY_FSCANF_P, ENTITY_ISOC99_FSCANF_P, ENTITY_ISOC99_SCANF_P, ENTITY_ISOC99_SSCANF_P, ENTITY_SCANF_P, ENTITY_SSCANF_P, f(), find_cluster(), FOREACH, gen_array_free(), gen_array_item(), gen_length(), gen_remove_once(), initialization_clusters(), kdg, min_start_time::min_tau, NIL, priorities(), ready_node(), schedule_failsafe(), select_task_with_highest_priority(), sequence_statements, STATEMENT, statement_call(), statement_call_p(), statement_ordering, statement_undefined, statement_undefined_p, tlevel_decrease(), top_level(), and update_parallel_task().

Referenced by hierarchical_schedule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bdsc_code_instrumentation()

_Bool bdsc_code_instrumentation ( char *  module_name)

instrumentation.c

The proper effect to detect the I/O operations:

omplexities (task processing time)

irst step is to cumulate dependences hierarchically (between sequences) on granularities : loop, test and simple instruction

Reorder the module, because new statements have been generated.

Parameters
module_nameodule_name

Definition at line 141 of file instrumentation.c.

142 {
143  statement module_stat = (statement)db_get_memory_resource(DBR_CODE, module_name, true);
144  set_ordering_to_statement(module_stat);
146  set_current_module_statement(module_stat);
149  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
150  /* The proper effect to detect the I/O operations: */
155  db_get_memory_resource(DBR_REGIONS, module_name, true));
158 
159  kdg = (graph) db_get_memory_resource (DBR_SDG, module_name, true );
160 
161  /*Complexities (task processing time)*/
163 
164  /*first step is to cumulate dependences hierarchically (between
165  sequences) on granularities : loop, test and simple instruction*/
166  list vertices = graph_vertices(kdg);
167  FOREACH(VERTEX, v, vertices){
172  vertex s = successor_vertex(su);
173  statement child = vertex_to_statement(s);
174  edge_cost_polynome(stmt,child);
175  }
176  }
177  }
178  /* Reorder the module, because new statements have been generated. */
179  module_reorder(module_stat);
180  gen_consistent_p((gen_chunk*)module_stat);
181  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(module_name), module_stat);
192  return true;
193 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void reset_complexity_map(void)
void set_complexity_map(statement_mapping)
void set_methods_for_convex_effects(void)
methods.c
Definition: methods.c:235
void init_convex_rw_prettyprint(const char *)
void set_rw_effects(statement_effects)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
void reset_rw_effects(void)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
int gen_consistent_p(gen_chunk *obj)
GEN_CONSISTENT_P dynamically checks the type correctness of OBJ.
Definition: genClib.c:2398
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
static void task_time_polynome(statement s)
static void edge_cost_polynome(statement s1, statement s2)
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
char * strdup()
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
Definition: mappings.c:624
void set_transformer_map(statement_mapping)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
void reset_transformer_map(void)
Definition: statement.c:54
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212
A gen_chunk is used to store every object.
Definition: genC.h:58

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, declaration_statement_p(), edge_cost_polynome(), FOREACH, free_value_mappings(), gen_consistent_p(), get_current_module_entity(), graph_vertices, init_convex_rw_prettyprint(), kdg, module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), reset_complexity_map(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_precondition_map(), reset_proper_rw_effects(), reset_rw_effects(), reset_transformer_map(), set_complexity_map(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_methods_for_convex_effects(), set_ordering_to_statement(), set_precondition_map(), set_proper_rw_effects(), set_rw_effects(), set_transformer_map(), statement_to_vertex(), strdup(), SUCCESSOR, successor_vertex, task_time_polynome(), VERTEX, vertex_successors, and vertex_to_statement().

+ Here is the call graph for this function:

◆ bottom_level()

void bottom_level ( graph  dg,
gen_array_t  annotations 
)

Second parameter is the bottom level (latest start time) for each node.

Parameters
dgg
annotationsnnotations

Definition at line 223 of file cost_model.c.

224 {
225  double max, level;
226  list vertices = (graph_vertices(dg));
227  annotation *an, *anp;
228  FOREACH(VERTEX, v, vertices) {
229  max = 0;
231  FOREACH(VERTEX, pre, (graph_vertices(dg))) {
232  statement parent = vertex_to_statement(pre);
233  anp = gen_array_item(annotations, (int)statement_ordering(parent));
234  FOREACH(SUCCESSOR, su, (vertex_successors(pre))) {
235  vertex s = successor_vertex(su);
236  statement child = vertex_to_statement(s);
237  if(statement_equal_p(child, sv) && gen_array_item(annotations, (int)statement_ordering(parent)) )
238  {
239  double edge_c = *(double *)(gen_array_item(anp->edge_cost,statement_ordering(sv)));
240  level = anp->blevel + edge_c;
241  if(level > max)
242  max = level;
243  }
244  }
245  }
247  an->blevel = an->task_time + max;
249  }
250  return;
251 }
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
#define max(a, b)
#define level

References annotations, annotation::blevel, dg, annotation::edge_cost, FOREACH, gen_array_addto(), gen_array_item(), graph_vertices, level, max, statement_equal_p(), statement_ordering, SUCCESSOR, successor_vertex, annotation::task_time, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by BDSC(), and DSC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bound_parallel_task_mapping_p()

bool bound_parallel_task_mapping_p ( statement  )

◆ close_parallel_task_mapping()

void close_parallel_task_mapping ( void  )

◆ cluster_stage_spire_generation()

void cluster_stage_spire_generation ( persistant_statement_to_cluster  stmt_to_cluster,
graph  tg,
statement  stmt,
int  P 
)

he main function

Parameters
stmt_to_clustertmt_to_cluster
tgg
stmttmt

Definition at line 120 of file spire_generation.c.

121 {
123  if(!get_bool_property("COSTLY_TASKS_ONLY") | costly_task(stmt)){
124  statement st_finish = statement_undefined;
126  switch(instruction_tag(inst)){
127  case is_instruction_block:{
128  list cluster_stages = topological_sort(stmt);
129  list list_cl = NIL;
130  FOREACH(LIST, cluster_stage, cluster_stages) {
131  st_finish = cluster_stage_spire(stmt_to_cluster, tg, cluster_stage, P);
132  gen_consistent_p((gen_chunk*)st_finish);
133  list_cl = CONS(STATEMENT, st_finish, list_cl);
134  }
136  statement_instruction(stmt) = ins_seq;
139  gen_free_list(cluster_stages);
140  break;
141  }
142  case is_instruction_test:{
143  test t = instruction_test(inst);
146  break;
147  }
148  case is_instruction_loop :{
149  loop l = statement_loop(stmt);
150  statement body = loop_body(l);
152  break;
153  }
154  default:
155  break;
156  }
157  }
159  return;
160 }
list topological_sort(statement stmt)
Definition: HBDSC.c:192
instruction make_instruction_sequence(sequence _field_)
Definition: ri.c:1169
sequence make_sequence(list a)
Definition: ri.c:2125
bool costly_task(statement st)
cost_model.c
Definition: cost_model.c:52
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define LIST(x)
Definition: genC.h:93
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
statement add_declaration_statement_at_beginning(statement, entity)
Definition: statement.c:2795
#define is_instruction_block
soft block->sequence transition
#define loop_body(x)
Definition: ri.h:1644
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define test_false(x)
Definition: ri.h:2837
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define statement_declarations(x)
Definition: ri.h:2460
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_test(x)
Definition: ri.h:1517
void cluster_stage_spire_generation(persistant_statement_to_cluster stmt_to_cluster, graph tg, statement stmt, int P)
he main function
static statement cluster_stage_spire(persistant_statement_to_cluster stmt_to_cluster, graph tg, list cluster_stage, int p)
return SPIRE for a cluster stage

References add_declaration_statement_at_beginning(), cluster_stage_spire(), CONS, costly_task(), ENTITY, FOREACH, gen_consistent_p(), gen_free_list(), gen_nreverse(), get_bool_property(), instruction_tag, instruction_test, is_instruction_block, is_instruction_loop, is_instruction_test, LIST, loop_body, make_instruction_sequence(), make_sequence(), NIL, STATEMENT, statement_declarations, statement_instruction, statement_loop(), statement_undefined, stmt_to_cluster, test_false, test_true, and topological_sort().

Referenced by cluster_stage_spire(), spire_distributed_unstructured_to_structured(), and spire_shared_unstructured_to_structured().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ communications_construction()

void communications_construction ( graph  tg,
statement  stmt,
persistant_statement_to_cluster  st_to_cluster,
int  kp 
)
Parameters
tgg
stmttmt
st_to_clustert_to_cluster
kpp

Definition at line 337 of file communication_generation.c.

338 {
342  switch(instruction_tag(inst)){
343  case is_instruction_block:{
344  list vertices = graph_vertices(tg), coms_send = NIL, coms_recv = NIL, coms_st = NIL;
345  list barrier = NIL;
346  MAPL(stmt_ptr,
347  {
348  statement ss = STATEMENT(CAR(stmt_ptr ));
349  if(statement_block_p(ss)){
351  MAPL(sb_ptr,
352  {
353  statement sb = STATEMENT(CAR(sb_ptr ));
354  if(statement_block_p(sb)){
356  MAPL(ss_ptr,
357  {
358  statement s = STATEMENT(CAR(ss_ptr ));
359  barrier = CONS(STATEMENT,s,barrier);
360  },
361  instruction_block(sbinst));
362  }
363  else
364  barrier = CONS(STATEMENT,sb,barrier);
365  },
366  instruction_block(sinst));
367  }
368  else
369  barrier = CONS(STATEMENT,ss,barrier);
370  },
371  instruction_block(inst));
372  FOREACH(STATEMENT, s, barrier)
373  {
374  bool found_p = false;
375  FOREACH(VERTEX, pre, vertices) {
376  statement this = vertex_to_statement(pre);
378  found_p = true;
379  break;
380  }
381  }
382  if(found_p){
383  int ki = apply_persistant_statement_to_cluster(st_to_cluster, statement_ordering(s));
384  list args_send = gen_recv_communications(s, st_to_cluster, tg, kp);
385  list args_recv = gen_send_communications(s, statement_to_vertex(s,tg), st_to_cluster, kp);
386  if(gen_length(args_recv) > 0 && (kp != ki) )
387  coms_recv = CONS(STATEMENT, com_call(PREDECESSORS, args_recv, ki), coms_recv);
388  if(gen_length(args_send) > 0 && (kp != ki) )
389  coms_send = CONS(STATEMENT, com_call(SUCCESSORS, args_send, ki), coms_send);
390  communications_construction(tg, s, st_to_cluster, ki);
391  }
392  else
393  communications_construction(tg, s, st_to_cluster, kp);
394  }
395  if((gen_length(coms_send) > 0 || gen_length(coms_recv) > 0) && (kp != -1)){
396  statement new_s = make_statement(
403  if(gen_length(coms_recv) > 0){
404  FOREACH(STATEMENT, st, coms_recv){
405  coms_st = CONS(STATEMENT, st, coms_st);
406  }
407  }
408  coms_st = CONS(STATEMENT, new_s, coms_st);
409  if(gen_length(coms_send) > 0){
410  FOREACH(STATEMENT, st, coms_send){
411  coms_st = CONS(STATEMENT, st, coms_st);
412  }
413  }
419  }
420  break;
421  }
422  case is_instruction_test:{
423  test t = instruction_test(inst);
424  communications_construction(tg, test_true(t), st_to_cluster, kp);
425  communications_construction(tg, test_false(t), st_to_cluster, kp);
426  break;
427  }
428  case is_instruction_loop :{
429  loop l = statement_loop(stmt);
430  statement body = loop_body(l);
431  communications_construction(tg, body, st_to_cluster, kp);
432  break;
433  }
434  default:
435  break;
436  }
437  }
438  return;
439 }
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
intptr_t apply_persistant_statement_to_cluster(persistant_statement_to_cluster f, intptr_t k)
Definition: ri.c:1540
synchronization make_synchronization_none(void)
Definition: ri.c:2424
#define SUCCESSORS
static statement com_call(bool neighbor, list args_com, int k)
#define PREDECESSORS
static list gen_send_communications(statement s, vertex tau, persistant_statement_to_cluster st_to_cluster, int kp)
static list gen_recv_communications(statement sv, persistant_statement_to_cluster st_to_cluster, graph tg, int kp)
void communications_construction(graph tg, statement stmt, persistant_statement_to_cluster st_to_cluster, int kp)
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define statement_block_p(stat)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define instruction_block(i)
#define empty_comments
Empty comments (i.e.
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
#define statement_synchronization(x)
Definition: ri.h:2466
#define statement_label(x)
Definition: ri.h:2450
#define statement_extensions(x)
Definition: ri.h:2464
#define statement_comments(x)
Definition: ri.h:2456
Definition: statement.c:4047

References apply_persistant_statement_to_cluster(), bound_persistant_statement_to_cluster_p(), CAR, com_call(), CONS, empty_comments, empty_extensions(), FOREACH, gen_consistent_p(), gen_length(), gen_recv_communications(), gen_send_communications(), graph_vertices, instruction_block, instruction_tag, instruction_test, is_instruction_block, is_instruction_loop, is_instruction_test, loop_body, make_instruction_sequence(), make_sequence(), make_statement(), make_synchronization_none(), MAPL, NIL, PREDECESSORS, STATEMENT, statement_block_p, statement_comments, statement_equal_p(), statement_extensions, statement_instruction, statement_label, statement_loop(), STATEMENT_NUMBER_UNDEFINED, statement_ordering, STATEMENT_ORDERING_UNDEFINED, statement_synchronization, statement_to_vertex(), SUCCESSORS, test_false, test_true, VERTEX, and vertex_to_statement().

Referenced by spire_distributed_unstructured_to_structured().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy_value_of_write()

bool copy_value_of_write ( const char *  module_name)

copy_value_of_write.c

copy_value_of_write.c

Reorder the module, because some statements have been added. Well, the order on the remaining statements should be the same, but by reordering the statements, the number are consecutive. Just for pretty print... :-)

Parameters
module_nameodule_name

Definition at line 542 of file copy_value_of_write.c.

542  {
544  bool good_result_p = true;
545 
546  debug_on("MPI_GENERATION_DEBUG_LEVEL");
547  pips_debug(1, "begin\n");
548 
549  //-- configure environment --//
551 
553  db_get_memory_resource(DBR_CODE, module_name, true) );
555 
556  pips_assert("Statement should be OK before...",
558 
560 
561  //-- get dependencies --//
562 // if(use_points_to) {
563 // set_pointer_info_kind(with_points_to); //enough?
564 // }
566  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
568  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
570  db_get_memory_resource(DBR_TASK, module_name, true));
571 
572 
573  //-- Make the job -- //
575 // gen_recurse(module_statement, statement_domain, copy_write_statement, gen_true);
576 // if(use_points_to) {
577 // //TODO
578 // //gen_recurse(module_statement, statement_domain, gen_true, identity_statement_remove_with_points_to);
579 // }
580 
581  pips_assert("Statement should be OK after...",
583 
584  // Removed useless block created by the insert_statement
586 
587  /* Reorder the module, because some statements have been added.
588  Well, the order on the remaining statements should be the same,
589  but by reordering the statements, the number are consecutive. Just
590  for pretty print... :-) */
592 
593  pips_assert("Statement should be OK after...",
595 
596  //-- Save modified code to database --//
599 
606 
607  pips_debug(1, "end\n");
608  debug_off();
609 
610  return (good_result_p);
611 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
static statement module_statement
Definition: alias_check.c:125
void unspaghettify_statement(statement)
The real entry point of unspaghettify:
static void copy_write_statement(statement s)
copy_write_statement for the statement s, check if there is/are write effect foreach write effect mak...
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
void set_parallel_task_mapping(statement_task)
void reset_parallel_task_mapping(void)
statement_task get_parallel_task_mapping(void)

References copy_write_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_recurse, gen_true(), get_current_module_statement(), get_parallel_task_mapping(), module_name(), module_name_to_entity(), module_reorder(), module_statement, pips_assert, pips_debug, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_parallel_task_mapping(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_parallel_task_mapping(), set_proper_rw_effects(), statement_consistent_p(), statement_domain, strdup(), and unspaghettify_statement().

+ Here is the call graph for this function:

◆ copy_value_of_write_with_cumulated_regions()

bool copy_value_of_write_with_cumulated_regions ( const char *  module_name)

PIPS pass.

Reorder the module, because some statements have been added. Well, the order on the remaining statements should be the same, but by reordering the statements, the number are consecutive. Just for pretty print... :-)

Parameters
module_nameodule_name

Definition at line 806 of file copy_value_of_write.c.

806  {
808  bool good_result_p = true;
809 
810  debug_on("MPI_GENERATION_DEBUG_LEVEL");
811  pips_debug(1, "begin\n");
812 
813  //-- configure environment --//
815 
817  db_get_memory_resource(DBR_CODE, module_name, true) );
819 
820  pips_assert("Statement should be OK before...",
822 
824 
825  //-- get dependencies --//
826 // if(use_points_to) {
827 // set_pointer_info_kind(with_points_to); //enough?
828 // }
830  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
832  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
834  //set_out_effects((statement_effects)
835  db_get_memory_resource(DBR_LIVE_OUT_REGIONS, module_name, true));
837  db_get_memory_resource(DBR_TASK, module_name, true));
838 
839 
840  //-- Make the job -- //
841  //No gen_recurse, only want to work on statement on the first level of the function
843 // gen_recurse(module_statement, statement_domain, gen_true, copy_write_statement_with_cumulated_regions);
844 // if(use_points_to) {
845 // //TODO
846 // //gen_recurse(module_statement, statement_domain, gen_true, copy_write_statement_with_cumulated_regions);
847 // }
848 
849  pips_assert("Statement should be OK after...",
851 
852  // Removed useless block created by the insert_statement
854 
855  /* Reorder the module, because some statements have been added.
856  Well, the order on the remaining statements should be the same,
857  but by reordering the statements, the number are consecutive. Just
858  for pretty print... :-) */
860 
861  pips_assert("Statement should be OK after...",
863 
864  //-- Save modified code to database --//
866 
874 
875  pips_debug(1, "end\n");
876  debug_off();
877 
878  return (good_result_p);
879 }
static void copy_write_statement_with_cumulated_regions(statement module_statement)
copy_write_statement_with_cumulated_regions foreach first level statement in module_statement generat...
void reset_live_out_regions(void)
void set_live_out_regions(statement_effects)

References copy_write_statement_with_cumulated_regions(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, get_current_module_statement(), module_name(), module_name_to_entity(), module_reorder(), module_statement, pips_assert, pips_debug, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_live_out_regions(), reset_ordering_to_statement(), reset_parallel_task_mapping(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_live_out_regions(), set_ordering_to_statement(), set_parallel_task_mapping(), set_proper_rw_effects(), statement_consistent_p(), strdup(), and unspaghettify_statement().

+ Here is the call graph for this function:

◆ costly_task()

_Bool costly_task ( statement  st)

cost_model.c

Parameters
stt

Definition at line 52 of file cost_model.c.

52  {
53  bool costly_p = false;
56  return true;
57  else{
58  switch(instruction_tag(inst)){
60  MAPL( stmt_ptr,
61  {
62  statement local_stmt = STATEMENT(CAR(stmt_ptr ));
63  costly_p = costly_p || costly_task(local_stmt);
64  },
65  instruction_block(inst));
66  return costly_p;
67  break;
68  }
69  case is_instruction_test :{
70  test t = instruction_test(inst);
71  return costly_task(test_true(t)) ||
73  break;
74  }
75  case is_instruction_loop :{
76  return true;
77  }
79  return true;
80  }
82  return true;
83  }
84  case is_instruction_call:{
85  return user_call_p(statement_call(st));
86  }
87  default:
88  return false;
89  }
90  }
91 }
bool statement_contains_user_call_p(statement)
Definition: statement.c:3939
bool user_call_p(call c)
Test if a call is a user call.
Definition: expression.c:4361
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_forloop
Definition: ri.h:1477

References CAR, instruction_block, instruction_tag, instruction_test, is_instruction_block, is_instruction_call, is_instruction_forloop, is_instruction_loop, is_instruction_test, is_instruction_whileloop, MAPL, STATEMENT, statement_call(), statement_contains_user_call_p(), statement_instruction, test_false, test_true, and user_call_p().

Referenced by cluster_stage_spire(), cluster_stage_spire_generation(), hierarchical_schedule(), and hierarchical_schedule_step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete_parallel_task_mapping()

task delete_parallel_task_mapping ( statement  )

◆ DSC()

int DSC ( sequence  seq,
int  ordering 
)
Parameters
seqeq
orderingrdering

Definition at line 623 of file BDSC.c.

623  {
624  int M = -1;
625  int nbclusters = 0;
626  int order = 0, cl_p = -1;
627  list unscheduled_tasks = NIL;
628  list ready_tasks = NIL, unready_tasks = NIL;
629  list stmts = sequence_statements(seq);
630  statement ready_task = statement_undefined, unready_task = statement_undefined;
631  gen_array_t annotations_s = schedule_failsafe();
632  bool other_rules_p = false;
636  FOREACH(statement, st, stmts){
637  unscheduled_tasks = CONS(STATEMENT, st, unscheduled_tasks);
638  if(ready_node(st))
639  ready_tasks = CONS(STATEMENT, st, ready_tasks);
640  else
641  unready_tasks = CONS(STATEMENT, st, unready_tasks);
642  }
643  while(gen_length(unscheduled_tasks) > 0 ){
644  ready_task = select_task_with_highest_priority(ready_tasks, statement_undefined);
645  unready_task = select_task_with_highest_priority(unready_tasks, ready_task);
646  other_rules_p = false;
647  if(statement_undefined_p(unready_task)){
648  cl_p = -1;
649  statement min_pred = ready_task;
650  bool zeroing_p = true;
651  if(get_bool_property("BDSC_DISTRIBUTED_MEMORY"))
652  zeroing_p = zeroing_multiple_edges(ready_task, order,M);
653  else
654  {
655  min_start_time min_pred_s = tlevel_decrease(ready_task,M);
656  min_pred = min_pred_s.min_tau;
657  if(min_pred != statement_undefined)
658  {
660  cl_p = anp->cluster;
661  allocate_task_to_cluster(ready_task,cl_p, order);
662  }
663  }
664  if(min_pred == statement_undefined || !zeroing_p)
665  other_rules_p = true;
666  }
667  else {
668  other_rules_p = DSRW(ready_task, unready_task,order,M);
669  }
670  if(other_rules_p){
671  cluster *cl_s = (cluster *)malloc(sizeof(cluster));
672  cl_s->time = 0;
673  cl_s->data = NIL;
674  int i = nbclusters++;
675  gen_array_addto(clusters, i, cl_s);
676  allocate_task_to_cluster(ready_task, i, order);
677  }
678  gen_remove_once(&unscheduled_tasks, ready_task);
679  FOREACH(statement, st, unready_tasks){
680  if(ready_node(st))
681  gen_remove_once(&unready_tasks, st);
682  }
683  ready_tasks = NIL;
684  FOREACH(statement, st, unscheduled_tasks) {
685  if(ready_node(st))
686  ready_tasks = CONS(STATEMENT, st, ready_tasks);
687  }
688  order ++;
689  }
690  gen_array_free(annotations_s);
691  update_parallel_task(ordering, nbclusters);
692  return nbclusters;
693 }
static bool zeroing_multiple_edges(statement ready_st, int order, int M)
Definition: BDSC.c:225

References allocate_task_to_cluster(), annotations, bottom_level(), annotation::cluster, clusters, CONS, cluster::data, DSRW(), FOREACH, gen_array_addto(), gen_array_free(), gen_array_item(), gen_length(), gen_remove_once(), get_bool_property(), kdg, malloc(), min_start_time::min_tau, NIL, priorities(), ready_node(), schedule_failsafe(), select_task_with_highest_priority(), sequence_statements, STATEMENT, statement_ordering, statement_undefined, statement_undefined_p, cluster::time, tlevel_decrease(), top_level(), update_parallel_task(), and zeroing_multiple_edges().

Referenced by hierarchical_schedule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dsc_code_parallelization()

_Bool dsc_code_parallelization ( char *  module_name)

he main function for performing the hierarchical scheduling (scheduled SDG) using DSC and generating SPIRE

The proper effect to detect the I/O operations:

omplexities (task processing time)

roperties to set the parameters of BDSC

ost model generation

SC-based top-down hierarchical scheduling

Reorder the module, because new statements have been generated.

Parameters
module_nameodule_name

Definition at line 473 of file HBDSC.c.

474 {
475  statement module_stat;
476  if (!get_bool_property("COMPLEXITY_EARLY_EVALUATION"))
477  set_bool_property("COMPLEXITY_EARLY_EVALUATION", true);
478  module_stat = (statement)db_get_memory_resource(DBR_CODE, module_name, true);
479  set_ordering_to_statement(module_stat);
481  set_current_module_statement(module_stat);
484  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
485  /* The proper effect to detect the I/O operations: */
490  db_get_memory_resource(DBR_REGIONS, module_name, true));
495 
496  kdg = (graph) db_get_memory_resource (DBR_DG, module_name, true );
497 
498  /*Complexities (task processing time)*/
500 
501  /*Properties to set the parameters of BDSC*/
502  NBCLUSTERS = 1;//INT_MAX;
503  MEMORY_SIZE = -1;
504  INSTRUMENTED_FILE = strdup(get_string_property("BDSC_INSTRUMENTED_FILE"));
505  /*cost model generation */
508  if(sizeof(INSTRUMENTED_FILE) == 8)
510  else
512 
514  /*DSC-based top-down hierarchical scheduling*/
515  hierarchical_schedule(module_stat, 0, NBCLUSTERS, MEMORY_SIZE, true);
516  /* Reorder the module, because new statements have been generated. */
517  module_reorder(module_stat);
518  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module_name, module_stat);
534  return true;
535 }
int hierarchical_schedule(statement stmt, int k, int P, int M, bool dsc_p)
Definition: HBDSC.c:311
persistant_statement_to_cluster make_persistant_statement_to_cluster(void)
Definition: ri.c:1537
int MEMORY_SIZE
Definition: SDG.c:58
string INSTRUMENTED_FILE
Definition: SDG.c:59
int NBCLUSTERS
parameters of BDSC, to be recovered using pips properties
Definition: SDG.c:57
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void parse_instrumented_file(char *file_name, graph dg, gen_array_t annotations)
Definition: cost_model.c:296
void initialization(graph dg, gen_array_t annotations)
Definition: cost_model.c:267
void reset_out_effects(void)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
void generic_effects_reset_all_methods(void)
char * get_string_property(const char *)
void set_bool_property(const char *, bool)

References annotations, clusters, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, free_value_mappings(), gen_array_free(), gen_array_make(), generic_effects_reset_all_methods(), get_bool_property(), get_current_module_entity(), get_string_property(), hierarchical_schedule(), init_convex_rw_prettyprint(), initialization(), INSTRUMENTED_FILE, kdg, make_persistant_statement_to_cluster(), MEMORY_SIZE, module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), NBCLUSTERS, parse_instrumented_file(), reset_complexity_map(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_ordering_to_statement(), reset_out_effects(), reset_precondition_map(), reset_proper_rw_effects(), reset_rw_effects(), reset_transformer_map(), set_bool_property(), set_complexity_map(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_methods_for_convex_effects(), set_ordering_to_statement(), set_out_effects(), set_precondition_map(), set_proper_rw_effects(), set_rw_effects(), set_transformer_map(), stmt_to_cluster, and strdup().

+ Here is the call graph for this function:

◆ edge_cost()

double edge_cost ( statement  s1,
statement  s2 
)
Parameters
s11
s22

Definition at line 147 of file cost_model.c.

148 {
149  Ppolynome transfer_time = POLYNOME_NUL;
152  list l_communications = RegionsIntersection(regions_dup(l_write), regions_dup(l_read), w_r_combinable_p);
153  FOREACH(REGION,reg,l_communications){
154  Ppolynome reg_footprint = region_enumerate(reg);
155  //reg_footprint = polynome_mult(reg_footprint, expression_to_polynome(int_to_expression(SizeOfElements(variable_basic(type_variable(entity_type(region_entity(reg))))))));
156  //reg_footprint =
157  //polynome_mult(reg_footprint,expression_to_polynome(int_to_expression(2.5)));//\beta= 2.5 on Cmmcluster
158  polynome_add(&transfer_time, reg_footprint);
159  }
160  //polynome_add(&transfer_time, latency);// the latency \alpha = 15000 on Cmmcluster
161  //polynome_fprint(stderr,transfer_time,entity_local_name,default_is_inferior_var);
162  return polynomial_to_numerical(transfer_time);
163 }
double polynomial_to_numerical(Ppolynome poly_amount)
Definition: cost_model.c:93
#define REGION
list RegionsIntersection(list l1, list l2, bool(*intersection_combinable_p)(effect, effect))
list RegionsIntersection(list l1,l2, bool (*intersection_combinable_p)(effect, effect)) input : outpu...
list regions_write_regions(list)
list regions_read_regions(list)
Ppolynome region_enumerate(effect)
bool w_r_combinable_p(effect, effect)
list load_statement_local_regions(statement)
void polynome_add(Ppolynome *ppp, Ppolynome pp2)
void polynome_add(Ppolynome* ppp, Ppolynome pp2) (*ppp) = (*ppp) + pp2.
Definition: pnome-bin.c:171
#define POLYNOME_NUL
s1
Definition: set.c:247

References FOREACH, load_statement_local_regions(), polynome_add(), POLYNOME_NUL, polynomial_to_numerical(), REGION, region_enumerate(), regions_dup(), regions_read_regions(), regions_write_regions(), RegionsIntersection(), s1, and w_r_combinable_p().

Referenced by initialization().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eliminate_original_variables()

bool eliminate_original_variables ( const char *  module_name)

eliminate_original_variables.c

eliminate_original_variables.c

Reorder the module, because some statements have been added. Well, the order on the remaining statements should be the same, but by reordering the statements, the number are consecutive. Just for pretty print... :-)

Parameters
module_nameodule_name

Definition at line 474 of file eliminate_original_variables.c.

474  {
475  entity module;
477  bool good_result_p = true;
478 
479  debug_on("MPI_GENERATION_DEBUG_LEVEL");
480  pips_debug(1, "begin\n");
481 
482  //-- configure environment --//
485 
487  db_get_memory_resource(DBR_CODE, module_name, true) );
489 
490  pips_assert("Statement should be OK before...",
492 
494 
495  //-- get dependencies --//
497  db_get_memory_resource(DBR_TASK, module_name, true));
498 
499 
500  //-- Make the job -- //
502 // gen_recurse(module_statement, statement_domain, gen_true, eliminate_in_statement);
503 
504 
505  /* Reorder the module, because some statements have been added.
506  Well, the order on the remaining statements should be the same,
507  but by reordering the statements, the number are consecutive. Just
508  for pretty print... :-) */
510 
511  pips_assert("Statement should be OK after...",
513 
514  //-- Save modified code to database --//
516 
521 
522  pips_debug(1, "end\n");
523  debug_off();
524 
525  return (good_result_p);
526 }
static bool make_eliminate_original_variables(__attribute__((unused)) entity module, statement module_statement)
static char * module
Definition: pips.c:74

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, get_current_module_entity(), get_current_module_statement(), make_eliminate_original_variables(), module, module_name(), module_name_to_entity(), module_reorder(), module_statement, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_parallel_task_mapping(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_parallel_task_mapping(), statement_consistent_p(), and strdup().

+ Here is the call graph for this function:

◆ error_reset_parallel_task_mapping()

void error_reset_parallel_task_mapping ( void  )

◆ get_parallel_task_mapping()

statement_task get_parallel_task_mapping ( void  )

Referenced by copy_value_of_write(), and task_mapping().

+ Here is the caller graph for this function:

◆ hbdsc_parallelization()

_Bool hbdsc_parallelization ( char *  module_name)

he main function for performing the hierarchical scheduling (scheduled SDG) using BDSC and generating the graph (unstructured) BDSC-based top-down hierarchical scheduling

The proper effect to detect the I/O operations:

omplexities (task processing time)

roperties to set the parameters of BDSC

ost model generation

Parameters
module_nameodule_name

Definition at line 396 of file HBDSC.c.

397 {
398  statement module_stat;
399  string tg_name = NULL;
400  FILE *ftg;
401  if (!get_bool_property("COMPLEXITY_EARLY_EVALUATION"))
402  set_bool_property("COMPLEXITY_EARLY_EVALUATION", true);
403  module_stat = (statement)db_get_memory_resource(DBR_CODE, module_name, true);
404  set_ordering_to_statement(module_stat);
406  set_current_module_statement(module_stat);
409  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
410  /* The proper effect to detect the I/O operations: */
415  db_get_memory_resource(DBR_REGIONS, module_name, true));
420  kdg = (graph) db_get_memory_resource (DBR_SDG, module_name, true );
421  /*Complexities (task processing time)*/
423  /*Properties to set the parameters of BDSC*/
424  NBCLUSTERS = get_int_property("BDSC_NB_CLUSTERS");
425  MEMORY_SIZE = get_int_property("BDSC_MEMORY_SIZE");
426  INSTRUMENTED_FILE = strdup(get_string_property("BDSC_INSTRUMENTED_FILE"));
427 
428  /*cost model generation */
432  if(strlen(INSTRUMENTED_FILE) == 0)
434  else
437  hierarchical_schedule(module_stat, 0, NBCLUSTERS, MEMORY_SIZE, false);
439  "/",module_name,"/",module_name, "_scheduled_sdg.dot", NULL));
440  ftg = safe_fopen(tg_name, "w");
441  fprintf( ftg, "digraph {\n compound=true;ratio=fill; node[fontsize=24,fontname=\"Courier\",labelloc=\"t\"];nodesep=.05;\n" );
442  print_SDGs(module_stat, kdg, ftg, annotations);
443  fprintf( ftg, "\n}\n" );
444  safe_fclose(ftg, tg_name);
445  free(tg_name);
446 
447  DB_PUT_MEMORY_RESOURCE(DBR_SDG, module_name, (char*) kdg);
449  DB_PUT_MEMORY_RESOURCE(DBR_SCHEDULE, module_name, (char*) stmt_to_cluster);
465  return true;
466 }
static void initialization_clusters(bool first_p)
eset to zero for each new sequence to handle
Definition: HBDSC.c:122
int get_int_property(const string)
void print_SDGs(statement stmt, graph tg, FILE *ftg, gen_array_t annotations)
Definition: SDG.c:520
void gen_array_full_free(gen_array_t a)
Definition: array.c:77
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
void free(void *)
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References annotations, clusters, concatenate(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, fprintf(), free(), free_value_mappings(), gen_array_full_free(), gen_array_make(), gen_consistent_p(), generic_effects_reset_all_methods(), get_bool_property(), get_current_module_entity(), get_int_property(), get_string_property(), hierarchical_schedule(), init_convex_rw_prettyprint(), initialization(), initialization_clusters(), INSTRUMENTED_FILE, kdg, make_persistant_statement_to_cluster(), MEMORY_SIZE, module_name(), module_name_to_entity(), module_to_value_mappings(), NBCLUSTERS, parse_instrumented_file(), print_SDGs(), reset_complexity_map(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_ordering_to_statement(), reset_out_effects(), reset_precondition_map(), reset_proper_rw_effects(), reset_rw_effects(), reset_transformer_map(), safe_fclose(), safe_fopen(), set_bool_property(), set_complexity_map(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_methods_for_convex_effects(), set_ordering_to_statement(), set_out_effects(), set_precondition_map(), set_proper_rw_effects(), set_rw_effects(), set_transformer_map(), stmt_to_cluster, and strdup().

◆ hierarchical_schedule()

int hierarchical_schedule ( statement  ,
int  ,
int  ,
int  ,
_Bool   
)

◆ init_parallel_task_mapping()

void init_parallel_task_mapping ( void  )

Referenced by task_mapping().

+ Here is the caller graph for this function:

◆ initialization()

void initialization ( graph  dg,
gen_array_t  annotations 
)
Parameters
dgg
annotationsnnotations

Definition at line 267 of file cost_model.c.

268 {
269  list vertices = graph_vertices(dg);
270  int sigma = get_int_property("BDSC_SENSITIVITY");
271  float clock = 1, overhead = 0;
272  srand(time(NULL));
273  FOREACH(VERTEX, v, vertices){
275  annotation *item = (annotation *)malloc(sizeof(annotation));
276  float x = (float)((float)rand()/((float)RAND_MAX) * (float)sigma/100);
277  item->task_time = clock * task_time(stmt) * (1 + x ) + overhead;
279  FOREACH(SUCCESSOR, su, (vertex_successors(v))){//statement_to_vertex(stmt, dg)))) {
280  vertex s = successor_vertex(su);
281  statement child = vertex_to_statement(s);
282  double *ec = (double *)malloc(sizeof(double));
283  *ec = clock * edge_cost(stmt, child) * (1+((float)rand()/(float)RAND_MAX * sigma/100)) + overhead;
284  gen_array_addto(item->edge_cost, statement_ordering(child), ec);
285  }
286  item->scheduled = false;
287  item->order_sched = -1;
288  item->cluster = -1;
289  item->nbclusters = 0;
290  item->data = used_data(stmt);
292  }
293  return;
294 }
static list used_data(statement(st))
Definition: cost_model.c:126
static double task_time(statement s)
Definition: cost_model.c:134
double edge_cost(statement s1, statement s2)
Definition: cost_model.c:147
static char * x
Definition: split_file.c:159

References annotations, annotation::cluster, annotation::data, dg, edge_cost(), annotation::edge_cost, FOREACH, gen_array_addto(), gen_array_make(), gen_length(), get_int_property(), graph_vertices, malloc(), annotation::nbclusters, annotation::order_sched, annotation::scheduled, statement_ordering, SUCCESSOR, successor_vertex, task_time(), annotation::task_time, used_data(), VERTEX, vertex_successors, vertex_to_statement(), and x.

Referenced by dsc_code_parallelization(), hbdsc_parallelization(), and make_unstructured_from_loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_parallel_task_mapping()

◆ make_com_loopbody()

statement make_com_loopbody ( entity  ,
_Bool  ,
list  ,
int   
)

◆ mpi_conversion()

bool mpi_conversion ( const char *  module_name)

mpi_conversion.c

mpi_conversion.c

Reorder the module, because some statements have been added. Well, the order on the remaining statements should be the same, but by reordering the statements, the number are consecutive. Just for pretty print... :-)

Parameters
module_nameodule_name

Definition at line 1989 of file mpi_conversion.c.

1989  {
1990  entity module;
1992  bool good_result_p = true;
1993 
1994  debug_on("MPI_GENERATION_DEBUG_LEVEL");
1995  pips_debug(1, "begin\n");
1996 
1997  //-- configure environment --//
2000 
2002  db_get_memory_resource(DBR_CODE, module_name, true) );
2004 
2005  pips_assert("Statement should be OK before...",
2007 
2009 
2010  //-- get dependencies --//
2011 // if(use_points_to) {
2012 // set_pointer_info_kind(with_points_to); //enough?
2013 // }
2015  db_get_memory_resource(DBR_TASK, module_name, true));
2016 
2017  //-- Make the job -- //
2019 
2020  pips_assert("Statement should be OK after...",
2022 
2023  // Removed useless block created by the insert_statement
2025 
2026  /* Reorder the module, because some statements have been added.
2027  Well, the order on the remaining statements should be the same,
2028  but by reordering the statements, the number are consecutive. Just
2029  for pretty print... :-) */
2031 
2032  pips_assert("Statement should be OK after...",
2034 
2035  //-- Save modified code to database --//
2037 
2042 
2043  pips_debug(1, "end\n");
2044  debug_off();
2045 
2046  return (good_result_p);
2047 }
static statement make_mpi_conversion(entity module, statement module_statement)

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, get_current_module_entity(), get_current_module_statement(), make_mpi_conversion(), module, module_name(), module_name_to_entity(), module_reorder(), module_statement, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_parallel_task_mapping(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_parallel_task_mapping(), statement_consistent_p(), strdup(), and unspaghettify_statement().

+ Here is the call graph for this function:

◆ mpi_task_generation()

_Bool mpi_task_generation ( char *  module_name)

mpi_generation.c

Parameters
module_nameodule_name

Definition at line 348 of file mpi_generation.c.

349 {
351  statement module_stat_i = (statement)db_get_memory_resource(DBR_DISTRIBUTED_SPIRE_CODE, module_name, true);
352  statement module_stat = copy_statement(module_stat_i);
353  set_ordering_to_statement(module_stat);
355  set_current_module_statement(module_stat);
356  init_stmt = mpi_initialize(module_stat, module);
357  gen_flat_mpi(module_stat, 0);
358  mpi_finalize(module_stat);
359  module_reorder(module_stat);
360  gen_consistent_p((gen_chunk*)module_stat);
361  DB_PUT_MEMORY_RESOURCE(DBR_PARALLELIZED_CODE, module_name, module_stat);
365  return true;
366 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
static statement mpi_initialize(statement stmt, entity module)
Generate int rank0; MPI_Status status0; MPI_Request *request0; ierr = MPI_Init( &argc,...
static void mpi_finalize(statement stmt)
static void gen_flat_mpi(statement stmt, int nesting_level)
static statement init_stmt
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450

References copy_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, gen_consistent_p(), gen_flat_mpi(), init_stmt, local_name_to_top_level_entity(), module, module_name(), module_name_to_entity(), module_reorder(), mpi_finalize(), mpi_initialize(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), set_current_module_entity(), set_current_module_statement(), and set_ordering_to_statement().

+ Here is the call graph for this function:

◆ openmp_task_generation()

_Bool openmp_task_generation ( char *  module_name)

openmp_generation.c

openmp_generation.c

Parameters
module_nameodule_name

Definition at line 160 of file openmp_generation.c.

161 {
162  statement module_stat_i = (statement)db_get_memory_resource(DBR_SHARED_SPIRE_CODE, module_name, true);
163  statement module_stat = copy_statement(module_stat_i);
164  set_ordering_to_statement(module_stat);
166  set_current_module_statement(module_stat);
167  gen_openmp(module_stat, false);
168  if(omp_parallel)
169  gen_omp_parallel(module_stat);
171  insert_statement(module_stat, return_st, false);
172  module_reorder(module_stat);
173  DB_PUT_MEMORY_RESOURCE(DBR_PARALLELIZED_CODE, module_name, module_stat);
177  return true;
178 }
statement return_st
Definition: HBDSC.c:53
void insert_statement(statement, statement, bool)
This is the normal entry point.
Definition: statement.c:2570
static bool omp_parallel
static bool gen_openmp(statement stmt, bool nested_p)
static void gen_omp_parallel(statement stmt)

References copy_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, gen_omp_parallel(), gen_openmp(), insert_statement(), module_name(), module_name_to_entity(), module_reorder(), omp_parallel, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), return_st, set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), and statement_undefined_p.

+ Here is the call graph for this function:

◆ parallel_task_mapping_undefined_p()

bool parallel_task_mapping_undefined_p ( void  )

◆ parse_instrumented_file()

void parse_instrumented_file ( char *  file_name,
graph  dg,
gen_array_t  annotations 
)
Parameters
file_nameile_name
dgg
annotationsnnotations

Definition at line 296 of file cost_model.c.

297 {
298  FILE *finstrumented;
299  double cost;
300  int ordering, ordering2;
301  finstrumented = fopen(file_name,"r");
302  list vertices = graph_vertices(dg);
303  annotation *item;
304  FOREACH(VERTEX, v, vertices){
306  item = (annotation *)malloc(sizeof(annotation));
307  item->edge_cost = gen_array_make(0);
309  vertex s = successor_vertex(su);
310  statement child = vertex_to_statement(s);
311  double *ec = (double *)malloc(sizeof(double));
312  *ec = 0;
313  gen_array_addto(item->edge_cost, statement_ordering(child), ec);
314  }
316  }
317  while (!feof(finstrumented) && (fscanf(finstrumented,"%d->%d = %lf \n", &ordering,&ordering2, &cost)))
318  {
319  if(ordering2 == -1){
320  item = gen_array_item(annotations, ordering);
321  item->task_time = (double)cost;
322  if(item->edge_cost == NULL)
323  item->edge_cost = gen_array_make(0);
324  gen_array_addto(annotations, ordering, item);
325  }
326  else {
327  item = gen_array_item(annotations, ordering);
328  if(item->edge_cost == NULL)
329  item->edge_cost = gen_array_make(0);
330  double *ec = (double *)malloc(sizeof(double));
331  *ec = cost;
332  gen_array_addto(item->edge_cost, ordering2, ec);
333  gen_array_addto(annotations, ordering, item);
334  }
335 
336  }
337  fclose(finstrumented);
338  return;
339 }
static string file_name

References annotations, dg, annotation::edge_cost, file_name, FOREACH, gen_array_addto(), gen_array_item(), gen_array_make(), graph_vertices, malloc(), statement_ordering, statement_to_vertex(), SUCCESSOR, successor_vertex, annotation::task_time, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by dsc_code_parallelization(), and hbdsc_parallelization().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ partitioning_sdg()

graph partitioning_sdg ( statement  module_stmt)
Parameters
module_stmtodule_stmt

Definition at line 455 of file SDG.c.

456 {
458  return clean_sdg(module_stmt, sdg);
459 }
static graph clean_sdg(statement module_stmt, graph tg)
Second step to form a clustered DG (SDG), delete dependences between statement s1 and another stateme...
Definition: SDG.c:421
static graph sdg
Definition: SDG.c:54
static bool sequence_dg(statement stmt)
Definition: SDG.c:321
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752

References clean_sdg(), gen_null(), gen_recurse, sdg, sequence_dg(), and statement_domain.

Referenced by sequence_dependence_graph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ polynomial_to_numerical()

double polynomial_to_numerical ( Ppolynome  poly_amount)

if polynomial is not a constant monomial, we use
an heuristic to map it into a numerical constant take the higher degree monomial and decide upon its coefficient

Parameters
poly_amountoly_amount

Definition at line 93 of file cost_model.c.

94 {
95  double size = 0.f;
96  /* if polynomial is not a constant monomial, we use
97  * an heuristic to map it into a numerical constant
98  * take the higher degree monomial
99  * and decide upon its coefficient
100  */
101  if(!POLYNOME_UNDEFINED_P(poly_amount))
102  {
103  int max_degree = polynome_max_degree(poly_amount);
104  for(Ppolynome p = poly_amount; !POLYNOME_NUL_P(p); p = polynome_succ(p)) {
105  int curr_degree = (int)vect_sum(monome_term(polynome_monome(p)));
106  if(curr_degree == max_degree) {
107  size = monome_coeff(polynome_monome(p));
108  break;
109  }
110  }
111  }
112  return size;
113 }
void const char const char const int
Value vect_sum(Pvecteur v)
Value vect_sum(Pvecteur v): somme des coefficients d'un vecteur (i.e.
Definition: reductions.c:261
int polynome_max_degree(Ppolynome pp)
int polynome_max_degree(Ppolynome pp) returns the degree of polynomial pp Let's hope there aren't too...
Definition: pnome-reduc.c:113
#define POLYNOME_UNDEFINED_P(pp)
#define monome_term(pm)
#define polynome_monome(pp)
#define monome_coeff(pm)
Macros definitions.
#define POLYNOME_NUL_P(pp)
#define polynome_succ(pp)

References int, monome_coeff, monome_term, polynome_max_degree(), polynome_monome, POLYNOME_NUL_P, polynome_succ, POLYNOME_UNDEFINED_P, and vect_sum().

Referenced by edge_cost(), size_of_regions(), and task_time().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_SDGs()

void print_SDGs ( statement  stmt,
graph  tg,
FILE *  ftg,
gen_array_t  annotations 
)
Parameters
stmttmt
tgg
ftgtg
annotationsnnotations

Definition at line 520 of file SDG.c.

520  {
522  switch(instruction_tag(inst))
523  {
524  case is_instruction_block :
525  {
527  list stmts = sequence_statements(seq);
528  fprintf( ftg, "subgraph cluster%d { color = blue; \n ",count );
529  FOREACH(STATEMENT, s, stmts) {
530  list vertices = graph_vertices(tg);
531  annotation *anp = NULL;
532  FOREACH(VERTEX, pre, vertices) {
533  statement parent = vertex_to_statement(pre);
534  if(statement_equal_p(parent, s)){
536  anp = gen_array_item(annotations, (int)statement_ordering(parent));
537  print_sdg_task(ftg, annotations, parent);
538  FOREACH(SUCCESSOR, su, (vertex_successors(pre))) {
539  vertex s = successor_vertex(su);
540  statement child = vertex_to_statement(s);
541  print_sdg_task(ftg, annotations, child);
544  if(an->cluster!=-1)
545  {//FFT
546  double edge_c = (intptr_t)(gen_array_item(anp->edge_cost,statement_ordering(child)));
547  fprintf( ftg,"%d -> %d [style=filled,color=blue,fontsize=16,label=\"%ld\",color=black];\n", (int)statement_ordering(parent),(int)statement_ordering(child),(long)(edge_c));
548  }
549  }
550  else
551  fprintf( ftg,"%d -> %d [style=filled,color=blue,fontsize=16,color=black];\n", (int)statement_ordering(parent),(int)statement_ordering(child));
552  }
553  }
554  }
555  }
556  fprintf( ftg, "} \n " );
557  count ++;
558  stmts = sequence_statements(seq);
559  FOREACH(STATEMENT, s, stmts)
560  print_SDGs(s,tg, ftg, annotations);
561  break;
562  }
563  case is_instruction_test:
564  {
565  test t = instruction_test(inst);
566  print_SDGs(test_true(t),tg, ftg, annotations);
567  print_SDGs(test_false(t),tg, ftg, annotations);
568  break;
569  }
570  case is_instruction_loop :
571  {
572  loop l = statement_loop(stmt);
573  print_SDGs(loop_body(l),tg, ftg, annotations);
574  break;
575  }
577  {
579  print_SDGs(forloop_body(l),tg, ftg, annotations);
580  break;
581  }
583  {
586  break;
587  }
588  default:
589  break;
590  }
591  return;
592 }
bool statement_equal_p(statement s1, statement s2)
Definition: SDG.c:123
static void print_sdg_task(FILE *ftg, gen_array_t annotations, statement stmt)
return a dot graph for SDG, print only nodes that have at least one successor
Definition: SDG.c:500
static int count
Definition: SDG.c:519
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
sequence statement_sequence(statement)
Get the sequence of a statement sequence.
Definition: statement.c:1328
whileloop statement_whileloop(statement)
Get the whileloop of a statement.
Definition: statement.c:1383
forloop statement_forloop(statement)
Get the forloop of a statement.
Definition: statement.c:1426
#define whileloop_body(x)
Definition: ri.h:3162
#define forloop_body(x)
Definition: ri.h:1372
#define intptr_t
Definition: stdint.in.h:294

References annotations, annotation::cluster, count, annotation::edge_cost, FOREACH, forloop_body, fprintf(), gen_array_item(), gen_array_nitems(), graph_vertices, instruction_tag, instruction_test, intptr_t, is_instruction_block, is_instruction_forloop, is_instruction_loop, is_instruction_test, is_instruction_whileloop, loop_body, print_sdg_task(), sequence_statements, STATEMENT, statement_equal_p(), statement_forloop(), statement_instruction, statement_loop(), statement_ordering, statement_sequence(), statement_whileloop(), SUCCESSOR, successor_vertex, test_false, test_true, VERTEX, vertex_successors, vertex_to_statement(), and whileloop_body.

Referenced by hbdsc_parallelization(), and sequence_dependence_graph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_task()

void print_task ( task  t)

Pass: TASK_MAPPING Debug mode: MPI_GENERATION_DEBUG_LEVEL Resource generated:

  • DBR_TASK

Definition at line 73 of file task_mapping.c.

73  {
74  if(task_undefined_p(t))
75  fprintf(stderr, "Undefined task\n");
76  // For debugging with gdb, dynamic type checking
77  else if(task_domain_number(t)!=task_domain)
78  (void) fprintf(stderr,"Arg. \"t\"is not a task.\n");
79  else {
80  fprintf(stderr, "%s", task_to_string(t, false));
81  }
82 }
string task_to_string(task t, bool pretty_print)
Definition: task_mapping.c:84
#define task_undefined_p(x)
Definition: task_private.h:90
#define task_domain_number(x)
Definition: task_private.h:113
#define task_domain
newgen_statement_task_domain_defined
Definition: task_private.h:32

References fprintf(), task_domain, task_domain_number, task_to_string(), and task_undefined_p.

Referenced by assign_statement_task_mapping(), and print_ctx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ priorities()

void priorities ( gen_array_t  annotations)
Parameters
annotationsnnotations

Definition at line 253 of file cost_model.c.

254 {
255  size_t i;
256  for(i = 0; i< gen_array_nitems(annotations); i++){
257  if(gen_array_item(annotations, i) != NULL){
259  item->prio = item->tlevel + item->blevel;
260  gen_array_addto(annotations, i, item);
261  }
262  }
263  return;
264 }

References annotations, annotation::blevel, gen_array_addto(), gen_array_item(), gen_array_nitems(), annotation::prio, and annotation::tlevel.

Referenced by BDSC(), and DSC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ region_to_com_nest()

statement region_to_com_nest ( effect  ,
_Bool  ,
int   
)

◆ reset_parallel_task_mapping()

void reset_parallel_task_mapping ( void  )

◆ sequence_dependence_graph()

_Bool sequence_dependence_graph ( char *  module_name)

The proper effect to detect the I/O operations:

dg contains the original dependences before clustering and scheduling, it is saved to not make a side effect on the original dg when constructing the SDG

Parameters
module_nameodule_name

Definition at line 593 of file SDG.c.

594 {
595  //entity module;
596  statement module_stat;
597  string tg_name = NULL;
598  FILE *ftg;
599  //module = local_name_to_top_level_entity(module_name);
600  module_stat = (statement)db_get_memory_resource(DBR_CODE, module_name, true);
601  set_ordering_to_statement(module_stat);
603  set_current_module_statement(module_stat);
606  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
607  /* The proper effect to detect the I/O operations: */
612  db_get_memory_resource(DBR_REGIONS, module_name, true));
617 
618  ddg = (graph) db_get_memory_resource (DBR_DG, module_name, true );
619  /*ddg contains the original dependences before clustering and scheduling, it
620  is saved to not make a side effect on the original dg when
621  constructing the SDG*/
622  sdg = copy_graph(ddg);
623  sdg = partitioning_sdg(module_stat);
625  "/",module_name,"/",module_name, "_sdg.dot", NULL));
626  ftg = safe_fopen(tg_name, "w");
627  fprintf( ftg, "digraph {\n compound=true;ratio=fill; node[fontsize=24,fontname=\"Courier\",labelloc=\"t\"];nodesep=.05;\n" );
628  print_SDGs(module_stat, sdg, ftg, gen_array_make(0));
629  fprintf( ftg, "\n}\n" );
630  safe_fclose(ftg, tg_name);
631  free(tg_name);
632 
634  DB_PUT_MEMORY_RESOURCE(DBR_SDG, module_name, (char*) sdg);
635 
647  return true;
648 }
graph ddg
Definition: HBDSC.c:52
graph copy_graph(graph p)
GRAPH.
Definition: graph.c:20
graph partitioning_sdg(statement module_stmt)
Definition: SDG.c:455

References concatenate(), copy_graph(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, ddg, fprintf(), free(), free_value_mappings(), gen_array_make(), generic_effects_reset_all_methods(), get_current_module_entity(), init_convex_rw_prettyprint(), module_name(), module_name_to_entity(), module_to_value_mappings(), partitioning_sdg(), print_SDGs(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_ordering_to_statement(), reset_out_effects(), reset_precondition_map(), reset_proper_rw_effects(), reset_rw_effects(), reset_transformer_map(), safe_fclose(), safe_fopen(), sdg, set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_methods_for_convex_effects(), set_ordering_to_statement(), set_out_effects(), set_precondition_map(), set_proper_rw_effects(), set_rw_effects(), set_transformer_map(), and strdup().

+ Here is the call graph for this function:

◆ set_parallel_task_mapping()

void set_parallel_task_mapping ( statement_task  )

◆ size_of_regions()

double size_of_regions ( list  l_data)
Parameters
l_data_data

Definition at line 115 of file cost_model.c.

116 {
117  Ppolynome transfer_time = POLYNOME_NUL;
118  FOREACH(REGION,reg,l_data){
119  Ppolynome reg_footprint= region_enumerate(reg);
121  polynome_add(&transfer_time, reg_footprint);
122  }
123  return polynomial_to_numerical(transfer_time);
124 }
#define region_entity(reg)
Ppolynome polynome_mult(Ppolynome pp1, Ppolynome pp2)
Ppolynome polynome_mult(Ppolynome pp1, Ppolynome pp2) returns pp1 * pp2.
Definition: pnome-bin.c:287
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
Ppolynome expression_to_polynome(expression exp)
===========================================================================
Definition: expression.c:3650
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
Definition: size.c:297
#define type_variable(x)
Definition: ri.h:2949
#define entity_type(x)
Definition: ri.h:2792
#define variable_basic(x)
Definition: ri.h:3120

References entity_type, expression_to_polynome(), FOREACH, int_to_expression(), polynome_add(), polynome_mult(), POLYNOME_NUL, polynomial_to_numerical(), REGION, region_entity, region_enumerate(), SizeOfElements(), type_variable, and variable_basic.

Referenced by MCW(), and transfer_cost().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ spire_distributed_unstructured_to_structured()

_Bool spire_distributed_unstructured_to_structured ( char *  module_name)

The proper effect to detect the I/O operations:

Reorder the module, because new statements have been generated.

Parameters
module_nameodule_name

Definition at line 192 of file spire_generation.c.

193 {
194  statement module_stat = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
195  statement module_stat_i = copy_statement(module_stat);
196  set_ordering_to_statement(module_stat);
198  set_current_module_statement(module_stat);
201  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
202  /* The proper effect to detect the I/O operations: */
207  db_get_memory_resource(DBR_REGIONS, module_name, true));
209  db_get_memory_resource(DBR_IN_REGIONS, module_name, true));
211  db_get_memory_resource(DBR_OUT_REGIONS, module_name, true));
214 
215  kdg = (graph) db_get_memory_resource (DBR_SDG, module_name, true );
217  stmt_to_cluster_i = (persistant_statement_to_cluster)db_get_memory_resource(DBR_SCHEDULE, module_name, true);
219 
220  NBCLUSTERS = get_int_property("BDSC_NB_CLUSTERS");
221  MEMORY_SIZE = get_int_property("BDSC_MEMORY_SIZE");
223  char *rtl_prefix = "_rtl";
224  FOREACH(entity, e, entities) {
225  if (strncmp(entity_local_name(e), rtl_prefix, strlen(rtl_prefix)) == 0){
227  }
228  }
233  module_stat = add_declaration_statement(module_stat, e);
235  insert_statement(module_stat, return_st, false);
236  /* Reorder the module, because new statements have been generated. */
237  module_reorder(module_stat);
238  DB_PUT_MEMORY_RESOURCE(DBR_DISTRIBUTED_SPIRE_CODE, strdup(module_name), module_stat);
239  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(module_name), module_stat_i);
252  return true;
253 }
persistant_statement_to_cluster copy_persistant_statement_to_cluster(persistant_statement_to_cluster p)
PERSISTANT_STATEMENT_TO_CLUSTER.
Definition: ri.c:1501
statement add_declaration_statement(statement, entity)
Definition: statement.c:2790
list gen_filter_tabulated(bool(*)(gen_chunk *), int)
returns the list of entities with this caracteristics.
Definition: tabulated.c:144
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
struct _newgen_struct_persistant_statement_to_cluster_ * persistant_statement_to_cluster
Definition: ri.h:263
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
list com_declarations_to_add
spire_generation.c
void gen_clear_tabulated_element(gen_chunk *obj)
GEN_CLEAR_TABULATED_ELEMENT only clears the entry for object OBJ in the gen_tabulated_ and gen_tabula...
Definition: tabulated.c:251

References add_declaration_statement(), cluster_stage_spire_generation(), com_declarations_to_add, communications_construction(), copy_persistant_statement_to_cluster(), copy_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, entity_domain, entity_local_name(), FOREACH, free_value_mappings(), gen_clear_tabulated_element(), gen_filter_tabulated(), gen_true(), generic_effects_reset_all_methods(), get_current_module_entity(), get_int_property(), init_convex_rw_prettyprint(), insert_statement(), kdg, MEMORY_SIZE, module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), NBCLUSTERS, NIL, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_in_effects(), reset_ordering_to_statement(), reset_out_effects(), reset_precondition_map(), reset_proper_rw_effects(), reset_rw_effects(), reset_transformer_map(), return_st, set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_in_effects(), set_methods_for_convex_effects(), set_ordering_to_statement(), set_out_effects(), set_precondition_map(), set_proper_rw_effects(), set_rw_effects(), set_transformer_map(), statement_undefined_p, stmt_to_cluster, and strdup().

+ Here is the call graph for this function:

◆ spire_shared_unstructured_to_structured()

_Bool spire_shared_unstructured_to_structured ( char *  module_name)
Parameters
module_nameodule_name

Definition at line 163 of file spire_generation.c.

164 {
165  statement module_stat = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
166  statement module_stat_i = copy_statement(module_stat);
167  set_ordering_to_statement(module_stat);
169  set_current_module_statement(module_stat);
170 
171  kdg = (graph) db_get_memory_resource (DBR_SDG, module_name, true );
173  gen_consistent_p((gen_chunk*)stmt_to_cluster_i);
175  NBCLUSTERS = get_int_property("BDSC_NB_CLUSTERS");
176  MEMORY_SIZE = get_int_property("BDSC_MEMORY_SIZE");
179  insert_statement(module_stat, return_st, false);
180  module_reorder(module_stat);
181  gen_consistent_p((gen_chunk*)module_stat);
182  DB_PUT_MEMORY_RESOURCE(DBR_SHARED_SPIRE_CODE, strdup(module_name), module_stat);
183  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(module_name), module_stat_i);
184 
189  return true;
190 }

References cluster_stage_spire_generation(), copy_persistant_statement_to_cluster(), copy_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, gen_consistent_p(), get_int_property(), insert_statement(), kdg, MEMORY_SIZE, module_name(), module_name_to_entity(), module_reorder(), NBCLUSTERS, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), return_st, set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), statement_undefined_p, stmt_to_cluster, and strdup().

+ Here is the call graph for this function:

◆ statement_equal_p()

_Bool statement_equal_p ( statement  s1,
statement  s2 
)
Parameters
s11
s22

Definition at line 123 of file SDG.c.

124 {
126 }
#define statement_number(x)
Definition: ri.h:2452

References s1, statement_number, and statement_ordering.

Referenced by print_SDGs(), same_level_p(), sequence_dg(), statement_in_sequence_p(), and statement_to_vertex().

+ Here is the caller graph for this function:

◆ statement_to_vertex()

vertex statement_to_vertex ( statement  s,
graph  g 
)

Definition at line 131 of file SDG.c.

132 {
133  MAP(VERTEX, v, {
135  if (statement_equal_p(s, sv))
136  return v;
137  }, graph_vertices(g));
138  return vertex_undefined;
139 }
#define vertex_undefined
Definition: graph.h:128
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226

References graph_vertices, MAP, statement_equal_p(), VERTEX, vertex_to_statement(), and vertex_undefined.

Referenced by sequence_dg().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store_or_update_parallel_task_mapping()

void store_or_update_parallel_task_mapping ( statement  ,
task   
)

◆ store_parallel_task_mapping()

void store_parallel_task_mapping ( statement  ,
task   
)

◆ t_level()

double t_level ( vertex  v,
graph  dg,
gen_array_t  annotations 
)

First parameter is the top level (earliest start time) for each node.

intptr_t)

Parameters
dgg
annotationsnnotations

Definition at line 168 of file cost_model.c.

169 {
170  double max = 0, level;
171  list vertices = (graph_vertices(dg));
172  annotation *an,*anp;
174  FOREACH(VERTEX, pre, vertices) {
175  statement parent = vertex_to_statement(pre);
176  FOREACH(SUCCESSOR, su, (vertex_successors(pre))) {
177  vertex s = successor_vertex(su);
178  statement child = vertex_to_statement(s);
179  if(statement_equal_p(child, sv) && !statement_equal_p(child,parent) && gen_array_item(annotations, (int)statement_ordering(parent))){
180  double tl_p;
181  anp = gen_array_item(annotations, (int)statement_ordering(parent));
182  double edge_c = *(double *)/*(intptr_t)*/(gen_array_item(anp->edge_cost, statement_ordering(sv)));
183  if(anp->tlevel != -1)
184  tl_p = anp->tlevel;
185  else
186  tl_p = t_level(pre, dg, annotations);
187  level = tl_p + anp->task_time + edge_c ;
188  if(level > max)
189  max = level;
190  }
191  else {
192  if(statement_equal_p(child, sv) && !statement_equal_p(child,parent) && gen_array_item(annotations, (int)statement_ordering(parent))==NULL )
193  {
194  anp = gen_array_item(annotations, (int)statement_ordering(parent));
195  double edge_c = *(double *)(gen_array_item(anp->edge_cost,statement_ordering(sv)));
196  level = t_level(pre, dg, annotations) + anp->task_time + edge_c;
197  if(level > max)
198  max = level;
199  }
200  }
201  }
202  }
205  else
206  an = (annotation *)malloc(sizeof(annotation));
207  an->tlevel = max;
209  return max;
210 }
size_t gen_array_size(const gen_array_t a)
Definition: array.c:137
double t_level(vertex v, graph dg, gen_array_t annotations)
First parameter is the top level (earliest start time) for each node.
Definition: cost_model.c:168

References annotations, dg, annotation::edge_cost, FOREACH, gen_array_addto(), gen_array_item(), gen_array_size(), graph_vertices, level, malloc(), max, statement_equal_p(), statement_ordering, SUCCESSOR, successor_vertex, annotation::task_time, annotation::tlevel, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by top_level(), and update_priority_values().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ task_mapping()

bool task_mapping ( const char *  module_name)

PIPS pass.

Parameters
module_nameodule_name

Definition at line 430 of file task_mapping.c.

430  {
431  entity module;
433  bool good_result_p = true;
434 
435  debug_on("MPI_GENERATION_DEBUG_LEVEL");
436  pips_debug(1, "begin\n");
437 
438  //-- configure environment --//
441 
443  db_get_memory_resource(DBR_CODE, module_name, true) );
445 
446  pips_assert("Statement should be OK before...",
448 
450 
451  //-- get dependencies --//
452  // nothing except code and entity done before.
453 
454  //TODO look to add parameter in private list?
455  // look module is type functionnal -> list parameter convert to list entitty
456 
457  //-- Make the job -- //
459  // gen_recurse(module_statement, statement_domain, gen_true, print_pragma);
460 
461  //useless, normally we don't modify the code
462  //pips_assert("Statement should be OK after...",
463  // statement_consistent_p(module_statement));
464 
465  //-- Save modified code to database --//
466  // DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(module_name), module_statement);
468  // DB_PUT_MEMORY_RESOURCE(DBR_CALLEES, module_name,
469  // compute_callees(module_statement));
470 
474 
475  pips_debug(1, "end\n");
476  debug_off();
477 
478  return (good_result_p);
479 }
static bool make_task_mapping(__attribute__((unused)) entity module, statement module_statement)
compute the task mapping requires the module statement as param only parse pragma on fisrt level stat...
Definition: task_mapping.c:370
void init_parallel_task_mapping(void)

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, get_current_module_entity(), get_current_module_statement(), get_parallel_task_mapping(), init_parallel_task_mapping(), make_task_mapping(), module, module_name(), module_name_to_entity(), module_statement, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_parallel_task_mapping(), set_current_module_entity(), set_current_module_statement(), and statement_consistent_p().

+ Here is the call graph for this function:

◆ task_to_string()

string task_to_string ( task  t,
bool  pretty_print 
)
Parameters
pretty_printretty_print

Definition at line 84 of file task_mapping.c.

84  {
85  char tid[10+4];
86  string tprivate = "";
87  char tcluster[18+4];
88  char tsync[23+5];
89  snprintf(tid, 10+4, "task_id=%"_intFMT"\n", task_id(t));
90  snprintf(tcluster, 18+4, "task_on_cluster=%"_intFMT"\n", task_on_cluster(t));
91  snprintf(tsync, 23+5, "task_synchronization=%s\n", task_synchronization(t)?"true":"false");
92  tprivate = "task_private_data={";
94  pips_debug(8, "%s", entity_name(ep));
95  tprivate = concatenate(tprivate, pretty_print?entity_user_name(ep):entity_name(ep), "; ", (char *) NULL);
96  }
97  tprivate = strdup(concatenate(tprivate, "}\n", (char *) NULL));
98  return concatenate(tid, tprivate, tcluster, tsync, (char *) NULL);
99 }
#define _intFMT
Definition: newgen_types.h:57
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
#define entity_name(x)
Definition: ri.h:2790
#define task_synchronization(x)
Definition: task_private.h:121
#define task_id(x)
Definition: task_private.h:115
#define task_on_cluster(x)
Definition: task_private.h:119
#define task_private_data(x)
Definition: task_private.h:117

References _intFMT, concatenate(), ENTITY, entity_name, entity_user_name(), FOREACH, pips_debug, strdup(), task_id, task_on_cluster, task_private_data, and task_synchronization.

Referenced by prepare_context(), and print_task().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ top_level()

void top_level ( graph  dg,
gen_array_t  annotations 
)
Parameters
dgg
annotationsnnotations

Definition at line 211 of file cost_model.c.

212 {
213  list vertices = graph_vertices(dg);
214  FOREACH(VERTEX, v, vertices){
215  t_level(v, dg, annotations);
216  }
217  return;
218 }

References annotations, dg, FOREACH, graph_vertices, t_level(), and VERTEX.

Referenced by BDSC(), and DSC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ topological_sort()

list topological_sort ( statement  stmt)
Parameters
stmttmt

Definition at line 192 of file HBDSC.c.

193 {
194  list K = NIL; uint i;
195  list cluster_stages = NIL;
196  list vertices = graph_vertices(kdg);
198  for(i = 0;i<gen_length(vertices);i++){
199  gen_array_addto(I, i, 0);
200  }
202  FOREACH(VERTEX, v, vertices) {
203  statement parent = vertex_to_statement(v);
204  if(statement_equal_p(st,parent)){
205  FOREACH(SUCCESSOR, su, (vertex_successors(v))) {
206  vertex w = successor_vertex(su);
207  statement child = vertex_to_statement(w);
208  gen_array_addto(I, (int)statement_ordering(child), gen_array_item(I, (int)statement_ordering(child)) + 1);
209  }
210  }
211  }
212  }
214  if(gen_array_item(I, statement_ordering(st)) == 0)
215  K = CONS(STATEMENT, st, K);
216  }
217  list L = gen_copy_seq(K);
218  cluster_stages = CONS(LIST, L, cluster_stages);
219  bool insert_p = false;
220  while(K != NIL){
221  statement st = STATEMENT(CAR(gen_last(K)));
222  gen_remove_once(&K, st);
223  FOREACH(VERTEX, pre, vertices) {
224  statement parent = vertex_to_statement(pre);
225  if(statement_equal_p(parent, st)){
226  FOREACH(SUCCESSOR, su, (vertex_successors(pre))) {
227  vertex v = successor_vertex(su);
228  statement child = vertex_to_statement(v);
229  gen_array_addto(I, (int)statement_ordering(child), gen_array_item(I, (int)statement_ordering(child)) - 1);
230  if(gen_array_item(I, statement_ordering(child)) == 0 && gen_occurences(child, K) == 0) {
231  K = CONS(STATEMENT, child, K);
232  insert_p = true;
233  }
234  }
235  break;
236  }
237  }
238  list M = NIL;
239  bool ins_p = true,found_p=false;
240  FOREACH(STATEMENT, stmt, K){
241  found_p = false;
242  FOREACH(STATEMENT, stmtl, L){
243  if(statement_equal_p(stmt,stmtl))
244  found_p = true;
245  }
246  if(!found_p)
247  M = CONS(STATEMENT,stmt,M);
248  else{
249  ins_p = false;
250  found_p = false;
251  }
252  }
253  if( ins_p && gen_length(M) > 0 && insert_p){
254  cluster_stages = CONS(LIST, M, cluster_stages);
255  insert_p = false;
256  L = gen_copy_seq(K);
257  }
258  }
259  gen_array_free(I);
260  return rebuild_topological_sort(cluster_stages);
261 }
static list rebuild_topological_sort(list stages)
Definition: HBDSC.c:146
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
int gen_occurences(const void *vo, const list l)
count occurences of vo in l
Definition: list.c:746
Definition: pip__tab.h:30

References CAR, CONS, FOREACH, gen_array_addto(), gen_array_free(), gen_array_item(), gen_array_make(), gen_copy_seq(), gen_last(), gen_length(), gen_occurences(), gen_remove_once(), graph_vertices, kdg, LIST, NIL, rebuild_topological_sort(), sequence_statements, STATEMENT, statement_equal_p(), statement_ordering, statement_sequence(), SUCCESSOR, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().

Referenced by cluster_stage_spire_generation(), and hierarchical_schedule_step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_parallel_task_mapping()

void update_parallel_task_mapping ( statement  ,
task   
)

◆ variable_replication()

bool variable_replication ( const char *  module_name)

variable_replication.c

variable_replication.c

Reorder the module, because some statements have been added. Well, the order on the remaining statements should be the same, but by reordering the statements, the number are consecutive. Just for pretty print... :-)

Parameters
module_nameodule_name

Definition at line 148 of file variable_replication.c.

148  {
149  //entity module;
151  bool good_result_p = true;
152 
153  debug_on("MPI_GENERATION_DEBUG_LEVEL");
154  pips_debug(1, "begin\n");
155 
156  //-- configure environment --//
158  //module = get_current_module_entity();
159 
161  db_get_memory_resource(DBR_CODE, module_name, true) );
163 
164  pips_assert("Statement should be OK before...",
166 
168 
169  //-- get dependencies --//
171  db_get_memory_resource(DBR_TASK, module_name, true));
172 
173  //-- Make the job -- //
176 
177  /* Reorder the module, because some statements have been added.
178  Well, the order on the remaining statements should be the same,
179  but by reordering the statements, the number are consecutive. Just
180  for pretty print... :-) */
182 
183  pips_assert("Statement should be OK after...",
185 
186  //-- Save modified code to database --//
188 
193 
194  pips_debug(1, "end\n");
195  debug_off();
196 
197  return (good_result_p);
198 }
static bool make_global_variable_declaration_replication()
static bool make_declaration_replication(statement module_statement)
only replicate declaration declare at the first scope of the function.

References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, get_current_module_statement(), make_declaration_replication(), make_global_variable_declaration_replication(), module_name(), module_name_to_entity(), module_reorder(), module_statement, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_parallel_task_mapping(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_parallel_task_mapping(), statement_consistent_p(), and strdup().

+ Here is the call graph for this function:

Variable Documentation

◆ annotations

◆ clusters

◆ com_declarations_to_add

list com_declarations_to_add
extern

◆ ddg

graph ddg
extern

Definition at line 52 of file HBDSC.c.

Referenced by sequence_dependence_graph().

◆ INSTRUMENTED_FILE

string INSTRUMENTED_FILE
extern

Definition at line 59 of file SDG.c.

Referenced by dsc_code_parallelization(), and hbdsc_parallelization().

◆ kdg

◆ MEMORY_SIZE

◆ NBCLUSTERS

◆ return_st

◆ stmt_to_cluster