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

Go to the source code of this file.

Macros

#define HYPERPLANE_OPTIONS   "X"
 Warning! Do not modify this file that is automatically generated! More...
 

Functions

statement hyperplane (list, bool(*)(statement))
 cproto-generated files More...
 
bool interactive_hyperplane_direction (Value *, int)
 hyperplane_direction.c More...
 
void scanning_base_hyperplane (Value[], int, matrice)
 scanning_base.c More...
 
void base_G_h1_unnull (Value[], int, matrice)
 
void global_parallelization (const char *)
 global_parallelization.c More...
 
bool loop_hyperplane (const char *)
 
statement code_generation (list, Pvecteur[], Pbase, Pbase, Psysteme, bool)
 code_generation.c More...
 
bool static_partitioning_matrix (matrice, int, const char *)
 tiling.c More...
 
bool interactive_partitioning_matrix (matrice, int)
 Query the user for a partitioning matrix P. More...
 
Psysteme tile_hyperplane_constraints (Pbase, Pbase, matrice, Pvecteur)
 Generate the tile membership constraints between a tile coordinates and an iteration coordinate. More...
 
Psysteme local_tile_constraints (Pbase, Pbase, Psysteme, matrice, Pvecteur *, statement)
 
Pvecteur loop_nest_to_offset (list)
 
statement tiling_transformation (list, bool(*)(statement))
 
bool loop_tiling (const char *)
 
bool check_tiling_legality (statement, matrice, int)
 
Psysteme sc_projection_concat_proj_on_variables (Psysteme, Pbase)
 
statement parallel_tiling (list, bool(*)(statement))
 
bool parallel_loop_tiling (const char *)
 
void do_symbolic_tiling (statement, list)
 symbolic_tiling.c More...
 
bool symbolic_tiling (const char *)
 
int loop_unimodular (string)
 unimodular.c More...
 

Macro Definition Documentation

◆ HYPERPLANE_OPTIONS

#define HYPERPLANE_OPTIONS   "X"

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

Modify src/Libs/hyperplane/hyperplane-local.h instead, to add your own modifications. header file built by cproto hyperplane-local.h package hyperplane

Definition at line 34 of file hyperplane.h.

Function Documentation

◆ base_G_h1_unnull()

void base_G_h1_unnull ( Value  [],
int  ,
matrice   
)

◆ check_tiling_legality()

bool check_tiling_legality ( statement  loopnest_st,
matrice  H,
int  dim 
)
Parameters
loopnest_stoopnest_st
dimim

Definition at line 812 of file tiling.c.

813 {
814  const char * module_name = get_current_module_name();
815  graph dg = (graph) db_get_memory_resource(DBR_DG, module_name, true);
816  int bl;
817  matrice HC;
818  // statement mod_stat = get_current_module_statement();
819  bool legal=true;
822  // Verify s is a statement in the loop nest
826 
829 
830  vertex v2 = successor_vertex(su);
831  statement s2 = vertex_to_statement( v2 );
832  // Verify s2 is a statement in the loop nest
836 
837  if(statement_in_loopnest_p) { // s and s2 are in the loop nest
839 
840  if ( conflict_cone(c) != cone_undefined ) {
841  //test H.D >0 for sommets, rays, and lines
843  if( !SG_UNDEFINED_P(gs)) {
844  Pbase b=gs->base;
845  bl=vect_size(b);
846 
847  if (bl==dim)
848  check_positive_dependence(gs, H,dim, &legal);
849  else {
850  if (bl > dim) {
851  HC=matrice_new(bl,bl);
852  int row,col;
853  ifdebug(8) {
854  fprintf(stdout," Different SIZES for base %d and matrice %d, Partial tiling case ?\n",bl,dim);
855  }
856  // Complete matrix Ht for the first non tiled dimension of the loop nest
857  // for 1<=i<=bl-dim, if di!=0 hji>=loop increment
858  // only loop with increment 1 are tiled ==> hji =1
859  matrice_identite(HC,bl,0);
860  DENOMINATOR(HC)=DENOMINATOR(H);
861  for (row=1; row<=bl; row++) {
862  if (row>=bl-dim+1) {
863  for(col=1; col<bl-dim+1;col++) {
864  ACCESS(HC, bl, row, col)=DENOMINATOR(H) ;
865  }
866  for(col=bl-dim+1; col<=bl;col++) {
867  ACCESS(HC, bl, row, col)= ACCESS(H, dim, row-bl+dim, col-bl+dim);
868  }
869  }
870  else {
871  ACCESS(HC, bl, row, row)=DENOMINATOR(H);
872  }
873  }
874  check_positive_dependence(gs, HC,bl, &legal);
875  matrice_free(HC);
876  }
877  else
878  pips_user_warning(" Different SIZES for dependence cone basis %d and partitioning matrice %d\n",bl,dim);
879  }
880  }
881  }
882  }
883  }
884  }
885  }
886  }
887  return(legal);
888 }
static void statement_in_loopnest(statement s)
Definition: tiling.c:738
static statement test_statement_of_reference
Definition: tiling.c:737
static bool statement_in_loopnest_p
Definition: tiling.c:736
static void check_positive_dependence(Ptsg gs, matrice H, int dim, bool *legal)
Definition: tiling.c:782
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
#define cone_generating_system(x)
Definition: dg.h:130
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define cone_undefined
Definition: dg.h:104
#define conflict_cone(x)
Definition: dg.h:169
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
#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
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#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
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
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
#define DENOMINATOR(matrix)
int DENOMINATEUR(matrix): acces au denominateur global d'une matrice matrix La combinaison *(&()) est...
Definition: matrice-local.h:93
#define matrice_free(m)
Definition: matrice-local.h:78
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77
Value * matrice
package matrice
Definition: matrice-local.h:71
void matrice_identite(matrice, int, int)
void matrice_identite(matrice ID, int n, int level) Construction d'une sous-matrice identite dans ID(...
Definition: sous-matrice.c:322
#define pips_user_warning
Definition: misc-local.h:146
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
struct type_sg * Ptsg
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
#define SG_UNDEFINED_P(sg)
Definition: sg-local.h:74
#define ifdebug(n)
Definition: sg.c:47
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
Definition: sg-local.h:66
Pbase base
Definition: sg-local.h:70

References ACCESS, type_sg::base, check_positive_dependence(), cone_generating_system, cone_undefined, CONFLICT, conflict_cone, db_get_memory_resource(), DENOMINATOR, dg, dg_arc_label_conflicts, FOREACH, fprintf(), gen_recurse, gen_true(), get_current_module_name(), graph_vertices, ifdebug, matrice_free, matrice_identite(), matrice_new, module_name(), pips_user_warning, SG_UNDEFINED_P, statement_domain, statement_in_loopnest(), statement_in_loopnest_p, SUCCESSOR, successor_arc_label, successor_vertex, test_statement_of_reference, vect_size(), VERTEX, vertex_successors, and vertex_to_statement().

Referenced by local_tile_constraints(), and parallel_tiling().

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

◆ code_generation()

statement code_generation ( list  lls,
Pvecteur  pvg[],
Pbase  base_oldindex,
Pbase  base_newindex,
Psysteme  sc_newbase,
bool  preserve_entry_label_p 
)

code_generation.c

code_generation.c

include <sys/stdtypes.h> for debug with dbmalloc include "stdlib.h" statement code_generation(cons *lls,Pvecteur pvg[], Pbase base_oldindex, Pbase base_newindex) generation of hyperplane code for the nested loops (cons *lls). the new nested loops will be ; DOSEQ Ip = ... DOALL Jp = ... DOALL Kp = ... ... ENDDO

modification : Keep the code in the sequential version. Let the parallelisation to generate the parallel code. suggested by BB, modified by Yi-Qing. 17/05/92

make the parallel loops from inner loop to outermost loop

handling of current loop

new bounds for new index related to the old index of the old loop

FI: I do not understand how you could keep a go to target (!) or a list of local variables

Parameters
llsls
pvgvg
base_oldindexase_oldindex
base_newindexase_newindex
sc_newbasec_newbase
preserve_entry_label_preserve_entry_label_p

Definition at line 58 of file code_generation.c.

64 {
65  statement state_lhyp = statement_undefined;
67  loop l_hyp = loop_undefined;
73  Pbase pb = BASE_UNDEFINED;
74 
76  statement_newbase(bl,pvg,base_oldindex);
77  /* make the parallel loops from inner loop to outermost loop*/
78 
79  for(pb=base_reversal(base_newindex);lls!=NIL; lls=CDR(lls), pb = pb->succ) {
80  /* handling of current loop */
81  s_loop = STATEMENT(CAR(lls));
82 
83  /* new bounds for new index related to the old index of the old loop*/
84  make_bound_expression(pb->var, base_newindex,sc_newbase, &lower, &upper);
85  rl = make_range(lower, upper, int_to_expression(1));
86 
87  /*
88  loop l_old = loop_undefined;
89  l_old = instruction_loop(statement_instruction(s_loop));
90  l_hyp = make_loop((entity) pb->var,
91  rl,
92  bl,
93  loop_label(l_old),
94  make_execution(is_execution_sequential,UU),
95  loop_locals(l_old));
96  */
97 
98  /* FI: I do not understand how you could keep a go to target (!)
99  * or a list of local variables
100  */
101  l_hyp = make_loop((entity) pb->var,
102  rl,
103  bl,
106  NIL);
107 
108  bl = makeloopbody(l_hyp, s_loop, true);
109  }
110 
111  instr_lhyp = make_instruction(is_instruction_loop,l_hyp);
112  state_lhyp = copy_statement(s_loop);
113  if(!preserve_entry_label_p)
114  clear_label(state_lhyp);
116  statement_instruction(state_lhyp) = instr_lhyp;
117  return(state_lhyp);
118 }
execution make_execution(enum execution_utype tag, void *val)
Definition: ri.c:838
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
void free_instruction(instruction p)
Definition: ri.c:1118
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
void statement_newbase(statement s, pvg, Pbase base_oldindex)
statement_newbase(statement s, Pvecteur pvg[], Pbase base_oldindex) compute the new statement by perf...
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
statement makeloopbody(loop, statement, bool)
statement makeloopbody(l, s_old) make a statement for a loop body, using the fields of a previously e...
Definition: statement.c:1641
void clear_label(statement)
Definition: statement.c:1568
Psysteme sc_newbase
include <sys/ddi.h>
#define UU
Definition: newgen_types.h:98
void make_bound_expression(Variable index, Pbase base, Psysteme sc, expression *lower, expression *upper)
void make_bound_expression(variable index, Pbase base, Psysteme sc, expression *lower,...
entity entity_empty_label(void)
Definition: entity.c:1105
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
#define loop_body(x)
Definition: ri.h:1644
#define loop_undefined
Definition: ri.h:1612
#define instruction_loop(x)
Definition: ri.h:1520
#define range_undefined
Definition: ri.h:2263
#define instruction_undefined
Definition: ri.h:1454
#define expression_undefined
Definition: ri.h:1223
@ is_instruction_loop
Definition: ri.h:1471
#define statement_instruction(x)
Definition: ri.h:2458
@ is_execution_sequential
Definition: ri.h:1189
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
#define BASE_UNDEFINED

References base_reversal(), BASE_UNDEFINED, CAR, CDR, clear_label(), copy_statement(), entity_empty_label(), expression_undefined, free_instruction(), instruction_loop, instruction_undefined, int_to_expression(), is_execution_sequential, is_instruction_loop, loop_body, loop_undefined, make_bound_expression(), make_execution(), make_instruction(), make_loop(), make_range(), makeloopbody(), NIL, range_undefined, sc_newbase, STATEMENT, statement_instruction, statement_newbase(), statement_undefined, Svecteur::succ, UU, and Svecteur::var.

Referenced by hyperplane(), parallel_tiling(), tiling_transformation(), and unimodular().

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

◆ do_symbolic_tiling()

void do_symbolic_tiling ( statement  base,
list  vector 
)

symbolic_tiling.c

check if tile_size is modified by sloop and generate a temporary variable if needed

we should also check tile_size has no write effect but currently, string_to_expression asserts this

outer loop new index

inner loop

outer loop

will help partial_eval

save

go on for the next one

once we are done, regenerate the whole thing

prepare chain all

set tail

chain all

update

he label have been duplicated by copy_statement

fix signed / unsigned types for further processing otherwise we could end with integer overflow

Parameters
basease
vectorector

Definition at line 64 of file symbolic_tiling.c.

65 {
67  list tiled_loops_outer = NIL;
68  list tiled_loops_inner = NIL;
69  list prelude = NIL;
72  FOREACH(EXPRESSION,tile_size,vector)
73  {
74  loop l = statement_loop(sloop);
75  list tile_expression_effects = proper_effects_of_expression(tile_size);
76  /* check if tile_size is modified by sloop and generate a temporary variable if needed */
77  /* we should also check tile_size has no write effect
78  * but currently, string_to_expression asserts this */
79  FOREACH(EFFECT,teff,tile_expression_effects) {
80  FOREACH(EFFECT,eff,effects) {
81  if(effect_write_p(eff) &&
83  {
88  prelude=CONS(STATEMENT,ass,prelude);
89  goto generate_tile;
90  }
91  }
92  }
93 generate_tile:;
94  /* outer loop new index */
97  expression lower_bound =
99  entity_to_expression(index),
100  copy_expression(tile_size)
101  );
102  expression upperbound_lhs = copy_expression(range_upper(loop_range(l)));
103  expression upperbound_rhs =
105  copy_expression(lower_bound),
107  copy_expression(tile_size),
109  )
110  );
111 
112  expression upper_bound =
114  upperbound_lhs,
115  upperbound_rhs
116  );
117 
118  /* inner loop */
121  make_loop(
122  loop_index(l),
123  make_range(
124  lower_bound,
125  upper_bound,
127  ),
131  NIL
132  )
133  )
134  );
135  /* outer loop */
136  statement outer = sloop;
137  loop_index(l)=index;
138  //range_increment(loop_range(l))=copy_expression(tile_size);
139  /* will help partial_eval */
143  copy_expression(tile_size)
144  );
145  /* save */
146  tiled_loops_outer=CONS(STATEMENT,outer,tiled_loops_outer);
147  tiled_loops_inner=CONS(STATEMENT,inner,tiled_loops_inner);
148 
149  /* go on for the next one */
150  sloop=loop_body(l);
151  }
152  /* once we are done, regenerate the whole thing */
153 
154  /* prepare chain all */
155  tiled_loops_inner=gen_append(tiled_loops_inner,tiled_loops_outer);
156  statement last = STATEMENT(CAR(tiled_loops_inner));
157  statement prev = last;
158  POP(tiled_loops_inner);
159  /* set tail */
160  loop_body(statement_loop(last))=sloop;
161  /* chain all */
162  FOREACH(STATEMENT,curr,tiled_loops_inner) {
163  loop_body(statement_loop(curr))=prev;
164  prev=curr;
165  }
166 
167  /* update */
168  statement_label(base)=entity_empty_label();/*the label have been duplicated by copy_statement */
172 
173  /* fix signed / unsigned types for further processing otherwise we could end with integer overflow */
175 }
instruction make_instruction_loop(loop _field_)
Definition: ri.c:1175
basic make_basic_int(intptr_t _field_)
Definition: ri.c:158
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
execution make_execution_parallel(void)
Definition: ri.c:844
syntax make_syntax_reference(reference _field_)
Definition: ri.c:2494
bdt base
Current expression.
Definition: bdt_read_paf.c:100
bool clean_up_sequences(statement s)
Recursively clean up the statement sequences by fusing them if possible and by removing useless one.
list load_cumulated_rw_effects_list(statement)
list proper_effects_of_expression(expression)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
bool references_may_conflict_p(reference r1, reference r2)
Check if two references may conflict.
Definition: conflicts.c:426
void set_conflict_testing_properties()
conflicts.c
Definition: conflicts.c:68
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_append(list l1, const list l2)
Definition: list.c:471
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
statement make_assign_statement(expression, expression)
Definition: statement.c:583
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
Definition: statement.c:3039
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define DEFAULT_INTEGER_TYPE_SIZE
#define binary_intrinsic_expression(name, e1, e2)
#define DIVIDE_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
#define MIN_OPERATOR_NAME
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
Definition: expression.c:3564
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
entity make_new_scalar_variable(entity, basic)
Definition: variable.c:741
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define range_upper(x)
Definition: ri.h:2290
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define statement_label(x)
Definition: ri.h:2450
#define loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
test de chernikovaa
static void fix_loop_index_sign(loop l)
symbolic tiling less general, but works for symbolics bounds

References AddEntityToCurrentModule(), base, binary_intrinsic_expression, CAR, clean_up_sequences(), CONS, copy_expression(), copy_statement(), DEFAULT_INTEGER_TYPE_SIZE, DIVIDE_OPERATOR_NAME, EFFECT, effect_any_reference, effect_write_p, entity_empty_label(), entity_to_expression(), EXPRESSION, fix_loop_index_sign(), FOREACH, gen_append(), gen_nreverse(), gen_recurse, gen_true(), get_current_module_entity(), instruction_to_statement(), instruction_undefined, int_to_expression(), load_cumulated_rw_effects_list(), loop_body, loop_domain, loop_index, loop_range, make_assign_statement(), make_basic_int(), make_execution_parallel(), make_instruction_block(), make_instruction_loop(), make_loop(), make_new_scalar_variable(), make_op_exp(), make_range(), make_reference(), make_syntax_reference(), MIN_OPERATOR_NAME, MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, NIL, PLUS_OPERATOR_NAME, POP, proper_effects_of_expression(), range_upper, references_may_conflict_p(), set_conflict_testing_properties(), STATEMENT, statement_instruction, statement_label, statement_loop(), statement_undefined, update_expression_syntax(), and update_statement_instruction().

Referenced by do_simdizer_auto_tile_generate_all_tests(), and symbolic_tiling().

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

◆ global_parallelization()

void global_parallelization ( const char *  module_name)

global_parallelization.c

Parameters
module_nameodule_name

Definition at line 51 of file global_parallelization.c.

52 {
54  statement s;
55 
56  pips_assert("global_parallelization", entity_module_p(module));
57  s = (statement) db_get_memory_resource(DBR_CODE, module_name, false);
58 
59  debug_on("HYPERPLANE_DEBUG_LEVEL");
60 
62 
63  debug_off();
64 
65  module_reorder(s);
66 
67  DB_PUT_MEMORY_RESOURCE(DBR_CODE,
69  (char*) s);
70 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void look_for_nested_loop_statements(statement, statement(*)(list, bool(*)(statement)), bool(*)(statement))
look_for_nested_loops.c
static bool always_select()
interfaces with pipsmake for hyperplane transformation
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
statement hyperplane(list lls, _UNUSED_ bool(*u)(statement))
package hyperplane
Definition: hyperplane.c:61
#define debug_on(env)
Definition: misc-local.h:157
#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
static char * module
Definition: pips.c:74
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
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
bool entity_module_p(entity e)
Definition: entity.c:683
char * strdup()

References always_select(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, entity_module_p(), hyperplane(), local_name_to_top_level_entity(), look_for_nested_loop_statements(), module, module_name(), module_reorder(), pips_assert, and strdup().

+ Here is the call graph for this function:

◆ hyperplane()

statement hyperplane ( list  ,
bool(*)(statement  
)

cproto-generated files

hyperplane.c

◆ interactive_hyperplane_direction()

bool interactive_hyperplane_direction ( Value h,
int  n 
)

hyperplane_direction.c

hyperplane_direction.c

In a first phase, trust the user blindly!

Query the user for h's coordinates

Definition at line 40 of file hyperplane_direction.c.

41 {
42  int i;
43  int n_read;
44  string resp = string_undefined;
45  string cn = string_undefined;
46  bool return_status = false;
47 
48  /* Query the user for h's coordinates */
49  pips_assert("hyperplane_direction", n>=1);
50  debug(8, "interactive_hyperplane_direction", "Reading h\n");
51  resp = user_request("Hyperplane direction vector?\n"
52  "(give all its integer coordinates on one line): ");
53  if (resp[0] == '\0') {
54  user_log("Hyperplane loop transformation has been cancelled.\n");
55  return_status = false;
56  }
57  else {
58  cn = strtok(resp, " \t");
59 
60  return_status = true;
61  for( i = 0; i<n; i++) {
62  if(cn==NULL) {
63  user_log("Not enough coordinates. "
64  "Hyperplane loop transformation has been cancelled.\n");
65  return_status = false;
66  break;
67  }
68  n_read = sscanf(cn," " VALUE_FMT, h+i);
69  if(n_read!=1) {
70  user_log("Not enough coordinates. "
71  "Hyperplane loop transformation has been cancelled.\n");
72  return_status = false;
73  break;
74  }
75  cn = strtok(NULL, " \t");
76  }
77  }
78 
79  if(cn!=NULL) {
80  user_log("Too many coordinates. "
81  "Hyperplane loop transformation has been cancelled.\n");
82  return_status = false;
83  }
84 
85  ifdebug(8) {
86  if(return_status) {
87  pips_debug(8, "Hyperplane direction vector:\n");
88  for( i = 0; i<n; i++) {
89  (void) fprintf(stderr," " VALUE_FMT, *(h+i));
90  }
91  (void) fprintf(stderr,"\n");
92  pips_debug(8, "End\n");
93  }
94  else {
95  pips_debug(8, "Ends with failure\n");
96  }
97  }
98 
99  return return_status;
100 }
void user_log(const char *format,...)
Definition: message.c:234
#define VALUE_FMT
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
string user_request(const char *,...)
#define string_undefined
Definition: newgen_types.h:40

References debug(), fprintf(), ifdebug, pips_assert, pips_debug, string_undefined, user_log(), user_request(), and VALUE_FMT.

Referenced by hyperplane().

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

◆ interactive_partitioning_matrix()

bool interactive_partitioning_matrix ( matrice  P,
int  n 
)

Query the user for a partitioning matrix P.

Query the user for P's components

Definition at line 137 of file tiling.c.

138 {
139  int n_read;
140  string resp = string_undefined;
141  string cn = string_undefined;
142  bool return_status = false;
143  int row;
144  int col;
145 
146  DENOMINATOR(P) = VALUE_ONE;
147  /* Query the user for P's components */
148  pips_assert("interactive_partitioning_matrix", n>=1);
149  debug(8, "interactive_partitioning_matrix", "Reading P\n");
150 
151  for(row=1; row<=n; row++) {
152  resp = user_request("Partitioning matrix (%dx%d)?\n"
153  "(give all its integer coordinates on one line of %d per row): ",
154  n, n, n);
155  if (resp[0] == '\0') {
156  user_log("Tiling loop transformation has been cancelled.\n");
157  return_status = false;
158  }
159  else {
160  cn = strtok(resp, " \t");
161 
162  return_status = true;
163  for( col = 1; col<=n; col++) {
164  if(cn==NULL) {
165  user_log("Too few coordinates. "
166  "Tiling loop transformation has been cancelled.\n");
167  return_status = false;
168  break;
169  }
170  n_read = sscanf(cn," " VALUE_FMT, &ACCESS(P, n, row, col));
171  if(n_read!=1) {
172  user_log("Too few coordinates. "
173  "Hyperplane loop transformation has been cancelled.\n");
174  return_status = false;
175  break;
176  }
177  cn = strtok(NULL, " \t");
178  }
179  }
180 
181  if(cn!=NULL) {
182  user_log("Too many coordinates. "
183  "Tiling loop transformation has been cancelled.\n");
184  return_status = false;
185  }
186  }
187 
188  ifdebug(8) {
189  if(return_status) {
190  pips_debug(8, "Partitioning matrix:\n");
191  matrice_fprint(stderr, P, n, n);
192  (void) fprintf(stderr,"\n");
193  pips_debug(8, "End\n");
194  }
195  else {
196  pips_debug(8, "Ends with failure\n");
197  }
198  }
199 
200  return return_status;
201 }
#define VALUE_ONE
void matrice_fprint(FILE *, matrice, int, int)
matrice_io.c
Definition: matrice_io.c:62

References ACCESS, debug(), DENOMINATOR, fprintf(), ifdebug, matrice_fprint(), pips_assert, pips_debug, string_undefined, user_log(), user_request(), VALUE_FMT, and VALUE_ONE.

Referenced by parallel_tiling(), and tiling_transformation().

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

◆ local_tile_constraints()

Psysteme local_tile_constraints ( Pbase  initial_basis,
Pbase  local_tile_basis,
Psysteme  sc,
matrice  P,
Pvecteur pvch,
statement  st 
)

computation of the hyperplane tile direction in the tile basis: = sum(hi)= 1H

The local tile direction is legal and colinear to the partitioning vecteur (pdim)

Build the constraints 0 <= det(HT).[HT. (i -i0)]<det(HT).1 with i0=P.G_tile.i_tile <==> 0 <= det(HT).[HT. (i -P.G_tile.i_tile)]<det(HT).1 <==> 0 <= det(HT).[HT.i -G_tile.i_tile]<= det(HT)-1

Parameters
initial_basisnitial_basis
local_tile_basisocal_tile_basis
scc
pvchvch
stt

Definition at line 407 of file tiling.c.

408 {
409  Psysteme mc = sc_dup(sc),mc2;
410  int dim = base_dimension(initial_basis);
411  int row;
412  int col;
413  Pbase civ = BASE_UNDEFINED;
414  Pbase ctv = BASE_UNDEFINED;
415  Value *h_tile; // hyperplane direction
416  int n = dim;
417  matrice V = matrice_new(n,n);
418  matrice G_tile = matrice_new(n,n);
419  bool legal=false;
420 
421  pips_assert("The two bases have the same dimension", dim == base_dimension(local_tile_basis));
422 
423  string local_tile_direction = (string) get_string_property("LOCAL_TILE_DIRECTION");
424  if (!empty_string_p(local_tile_direction) && strcmp(local_tile_direction,"LI") != 0) {
425  h_tile = (Value*)(malloc(n*sizeof(Value)));
426  if(strcmp(local_tile_direction,"LP") == 0) {
427  /* computation of the hyperplane tile direction in the tile basis: = sum(hi)= 1H */
428  compute_local_change_of_basis(h_tile, P, G_tile, 1 , n, 1);
429  matrice_general_inversion(G_tile,V,n);
430  legal = check_tiling_legality(st,V,n);
431  if (!legal)
432  matrice_identite(G_tile,n,0);
433  }
434  else // search a valid direction colinear to one of the partitioning vectors
435  if(strcmp(local_tile_direction,"LS") == 0) {
436  int pdim;
437  legal=false;
438  for (pdim=1; !legal && pdim<=n; pdim++) {
439  /* The local tile direction is legal and colinear to the partitioning vecteur (pdim) */
440  compute_local_change_of_basis(h_tile, P, G_tile, 2, n, pdim);
441  ifdebug(8) {
442  fprintf(stderr,"Check the legality of the chosen LOCAL basis");
443  (void) fprintf(stderr,"Temporary local tile scanning base G_tile obtained with %d-th Pvecteur :",pdim);
444  matrice_fprint(stderr, G_tile, n, n);
445  }
446  matrice_general_inversion(G_tile,V,n);
447  legal = check_tiling_legality(st,V,n);
448  }
449  if (pdim>n && !legal)
450  matrice_identite(G_tile,n,0);
451  }
452  }
453  else // the local tile direction is the original basis
454  matrice_identite(G_tile,n,0);
455 
456  ifdebug(8) {
457  (void) fprintf(stderr,"The local tile scanning base G_tile - i = G_tile.i_prime is :");
458  matrice_fprint(stderr, G_tile, n, n);
459  }
460  /* Build the constraints
461  0 <= det(HT).[HT. (i -i0)]<det(HT).1 with
462  i0=P.G_tile.i_tile
463  <==> 0 <= det(HT).[HT. (i -P.G_tile.i_tile)]<det(HT).1
464  <==> 0 <= det(HT).[HT.i -G_tile.i_tile]<= det(HT)-1
465  */
466  for(ctv = local_tile_basis; !VECTEUR_NUL_P(ctv) ; ctv = vecteur_succ(ctv)) {
468  sc_dimension(mc)++;
469  }
470  for(row = 1, civ = initial_basis; row <= dim; row++, civ = vecteur_succ(civ)) {
473 
474  for(col = 1, ctv = local_tile_basis; col <= dim ; col++, ctv = vecteur_succ(ctv)) {
475  if(ACCESS(G_tile, dim, row, col)!=VALUE_ZERO) {
476  Value coeff = ACCESS(G_tile, dim, row, col);
477  vect_add_elem(&veq, vecteur_var(ctv), -1*coeff);
478  }
479  }
480  ceq = contrainte_make(veq);
481  sc_add_egalite(mc, ceq);
482  }
483 
484  ifdebug(8) {
485  pips_debug(8, "End with constraint system mc:\n");
487  fprintf(stderr, "sc dimension = %d \n",mc->dimension);
488  }
489  mc2=sc_dup(mc);
490  sc_projection_along_variables_ofl_ctrl(&mc2,initial_basis , OFL_CTRL);
491  ifdebug(8) {
492  pips_debug(8, "End with constraint system mc after change of basis:\n");
494  }
495  scanning_base_to_vect(G_tile, n, local_tile_basis, pvch);
496  return mc2;
497 }
bool check_tiling_legality(statement loopnest_st, matrice H, int dim)
Definition: tiling.c:812
static void compute_local_change_of_basis(Value *h_tile, matrice P, matrice G, int option, int dim, int selected_Pdim)
Definition: tiling.c:376
#define VALUE_ZERO
int Value
Pbase base_add_variable(Pbase b, Variable var)
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end...
Definition: base.c:88
void scanning_base_to_vect(matrice G, int n, Pbase base, pvg)
void scanning_base_to_vect(matrice G,int n,Pbase base,Pvecteur pvg[n]) compute G*base and put the res...
#define CONTRAINTE_UNDEFINED
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
bool empty_string_p(const char *s)
Definition: entity_names.c:239
char * get_string_property(const char *)
void * malloc(YYSIZE_T)
void matrice_general_inversion(matrice a, matrice inv_a, int n)
void matrice_general_inversion(matrice a; matrice inv_a; int n) calcul de l'inversion du matrice gene...
Definition: inversion.c:222
char * string
STRING.
Definition: newgen_types.h:39
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
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
#define vecteur_var(v)
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62
#define vecteur_succ(v)
#define VECTEUR_NUL_P(v)
#define base_dimension(b)
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References ACCESS, Ssysteme::base, base_add_variable(), base_dimension, BASE_UNDEFINED, check_tiling_legality(), compute_local_change_of_basis(), contrainte_make(), CONTRAINTE_UNDEFINED, Ssysteme::dimension, empty_string_p(), entity_local_name(), fprintf(), get_string_property(), ifdebug, malloc(), matrice_fprint(), matrice_general_inversion(), matrice_identite(), matrice_new, OFL_CTRL, pips_assert, pips_debug, sc_add_egalite(), sc_dup(), sc_fprint(), scanning_base_to_vect(), VALUE_ONE, VALUE_ZERO, vect_add_elem(), vect_new(), VECTEUR_NUL_P, vecteur_succ, and vecteur_var.

Referenced by parallel_tiling().

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

◆ loop_hyperplane()

bool loop_hyperplane ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 72 of file global_parallelization.c.

73 {
74  bool return_status = false;
75 
77 
78  return return_status;
79 }
bool interactive_loop_transformation(const char *module_name, statement(*loop_transformation)(list, bool(*)(statement)))

References hyperplane(), interactive_loop_transformation(), and module_name().

+ Here is the call graph for this function:

◆ loop_nest_to_offset()

Pvecteur loop_nest_to_offset ( list  lls)
Parameters
llsls

Definition at line 501 of file tiling.c.

502 {
504  list cs = list_undefined;
505 
506  for (cs = lls; cs != NIL; cs = CDR(cs)){
508  entity ind = loop_index(l);
509  range r = loop_range(l);
510  expression lower = range_lower(r);
511  intptr_t val;
512 
513  if(expression_integer_value(lower, &val)) {
514  vect_chg_coeff(&origin, (Variable) ind, (Value) val);
515  }
516  }
517 
518  return origin;
519 }
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792
#define range_lower(x)
Definition: ri.h:2288
static statement origin
Definition: simdizer.c:411
#define intptr_t
Definition: stdint.in.h:294
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143

References CAR, CDR, expression_integer_value(), instruction_loop, intptr_t, list_undefined, loop_index, loop_range, NIL, origin, range_lower, STATEMENT, statement_instruction, vect_chg_coeff(), and VECTEUR_NUL.

Referenced by parallel_tiling(), and tiling_transformation().

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

◆ loop_tiling()

bool loop_tiling ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 725 of file tiling.c.

726 {
727  bool return_status = false;
728 
730 
731  return return_status;
732 }
statement tiling_transformation(list lls, _UNUSED_ bool(*u)(statement))
Generate tiled code for a loop nest, PPoPP'91, p.
Definition: tiling.c:526

References interactive_loop_transformation(), module_name(), and tiling_transformation().

+ Here is the call graph for this function:

◆ loop_unimodular()

int loop_unimodular ( string  )

◆ parallel_loop_tiling()

bool parallel_loop_tiling ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 1143 of file tiling.c.

1144 {
1145  bool return_status = false;
1147  return return_status;
1148 }
statement parallel_tiling(list lls, _UNUSED_ bool(*u)(statement))
Definition: tiling.c:942

References interactive_loop_transformation(), module_name(), and parallel_tiling().

+ Here is the call graph for this function:

◆ parallel_tiling()

statement parallel_tiling ( list  ,
bool(*)(statement  
)

◆ sc_projection_concat_proj_on_variables()

Psysteme sc_projection_concat_proj_on_variables ( Psysteme  sc,
Pbase  index_base 
)
Parameters
scc
index_basendex_base

Definition at line 890 of file tiling.c.

893 {
894  Pvecteur lvar_proj;
895  Psysteme sc1 = sc_dup(sc);
896  int nb=vect_size(index_base);
897  // Automatic variables read in a CATCH block need to be declared volatile as
898  // specified by the documentation
899  volatile Psysteme sc2,sc3;
900  sc3=sc_init_with_sc(sc);
901 
902  if (!VECTEUR_NUL_P(index_base))
903  {
904  volatile Pvecteur pv1;
905  lvar_proj = vect_copy(base_reversal(index_base));
906  sc2 = sc_copy(sc);
907  for (pv1 = lvar_proj;!VECTEUR_NUL_P(pv1) && nb>1; pv1=pv1->succ, nb--) {
908 
910  sc_elim_var(sc2, vecteur_var(pv1));
911  }
912  TRY {// force the overflow forwarding in order to apply sc_elim_var in case of overflow
913  sc_projection_along_variable_ofl_ctrl
914  (&sc2,vecteur_var(pv1), FWD_OFL_CTRL);
916  }
917  sc2 = sc_normalize(sc2);
918  if (SC_EMPTY_P(sc2)) {
919  sc2 = sc_empty(base_copy(sc->base));
920  break;
921  }
922  else {
924  }
925  // Concatenation of the intermediate system sc2 resulting
926  // from the projection of pv1 and the previous concatenated system sc3
927  sc3 = sc_append(sc3,sc2);
928  if (SC_EMPTY_P(sc3)) {
929  sc3 = sc_empty(base_copy(sc->base));
930  break;
931  }
932  }
933  }
934  sc1 = sc_append(sc1,sc3);
935  sc1 = sc_normalize(sc1);
936  if (SC_EMPTY_P(sc1))
937  sc1 = sc_empty(base_copy(sc->base));
938  return sc1;
939 }
#define CATCH(what)
@ overflow_error
#define UNCATCH(what)
#define TRY
Psysteme sc_empty(Pbase b)
Psysteme sc_empty(Pbase b): build a Psysteme with one unfeasible constraint to define the empty subsp...
Definition: sc_alloc.c:319
Psysteme sc_init_with_sc(Psysteme sc)
This function returns a new empty system which has been initialized with the same dimension and base ...
Definition: sc_alloc.c:303
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
Definition: sc_alloc.c:230
void build_sc_nredund_1pass(Psysteme volatile *ps)
Computation of a new system sc from the system ps, where each constraint of the system ps is added to...
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Psysteme sc_elim_var(Psysteme sc, Variable v)
package sur les systemes de contraintes sc
Definition: sc_unaires.c:49
#define FWD_OFL_CTRL
Pbase vect_copy(Pvecteur b)
direct duplication.
Definition: alloc.c:240
Pbase base_copy(Pbase b)
Direct duplication.
Definition: alloc.c:300

References Ssysteme::base, base_copy(), base_reversal(), build_sc_nredund_1pass(), CATCH, FWD_OFL_CTRL, overflow_error, sc_append(), sc_copy(), sc_dup(), sc_elim_var(), sc_empty(), sc_init_with_sc(), sc_normalize(), Svecteur::succ, TRY, UNCATCH, vect_copy(), vect_size(), VECTEUR_NUL_P, and vecteur_var.

Referenced by parallel_tiling().

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

◆ scanning_base_hyperplane()

void scanning_base_hyperplane ( Value  [],
int  ,
matrice   
)

◆ static_partitioning_matrix()

bool static_partitioning_matrix ( matrice  P,
int  n,
const char *  serialized_matrix 
)

tiling.c

Parameters
serialized_matrixerialized_matrix

Definition at line 104 of file tiling.c.

105 {
106  pips_assert("interactive_partitioning_matrix", n>=1);
107  bool status = false;
108  if( serialized_matrix && !string_undefined_p(serialized_matrix) && !empty_string_p(serialized_matrix))
109  {
110  int row,col;
111  string ctxt0 = string_undefined, ctxt1 = string_undefined;
112  string saved_ptr,buffer,elem = NULL;
113  saved_ptr= buffer = strdup(serialized_matrix);
114  string line = strtok_r(buffer,",",&ctxt0);
115  DENOMINATOR(P) = VALUE_ONE;
116  for(row=1;row<=n;row++){
117  elem = strtok_r(line," ",&ctxt1);
118 
119  for(col=1;col<=n;col++)
120  {
121  if(!elem) elem = col==row ? "1" : "0";
122  ACCESS(P, n, row, col)=atoi(elem);
123  elem = strtok_r(NULL," ",&ctxt1);
124  }
125  line = strtok_r(NULL,",",&ctxt0);
126  }
127  status= ( line == NULL ) && (elem == NULL );
128  free(saved_ptr);
129  }
130  return status;
131 }
struct _newgen_struct_status_ * status
Definition: database.h:31
void free(void *)
#define string_undefined_p(s)
Definition: newgen_types.h:41
static int line
FLEX_SCANNER.
Definition: scanner.c:852
static string buffer
Definition: string.c:113

References ACCESS, buffer, DENOMINATOR, empty_string_p(), free(), line, pips_assert, strdup(), string_undefined, string_undefined_p, and VALUE_ONE.

Referenced by parallel_tiling(), and tiling_transformation().

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

◆ symbolic_tiling()

bool symbolic_tiling ( const char *  module_name)

prelude

postlude

Parameters
module_nameodule_name

Definition at line 199 of file symbolic_tiling.c.

200 {
201  /* prelude */
202  bool result = false;
206 
207  // sometimes empty continues are put here and there and disturb me
209 
210  entity elabel = find_label_entity(
212  get_string_property("LOOP_LABEL")
213  );
215  if( !statement_undefined_p(sloop) )
216  {
218  get_string_property("SYMBOLIC_TILING_VECTOR"),",",
220  if(ENDP(vector))
221  pips_user_warning("must provide a non empty array with expressions valid in current context\n");
222  else if((result=symbolic_tiling_valid_p(sloop,gen_length(vector)))) {
223  do_symbolic_tiling(sloop,vector);
224  }
226  }
227  else pips_user_warning("must provide a valid loop label\n");
228 
229  /* postlude */
232 
236 
237  return result;
238 }
void set_cumulated_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
list string_to_expressions(const char *str, const char *seed, entity module)
split a string using seed as separator and call string_to_expression on each chunk
Definition: expressions.c:98
void gen_full_free_list(list l)
Definition: genClib.c:1023
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
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
size_t gen_length(const list l)
Definition: list.c:150
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
entity find_label_entity(const char *, const char *)
util.c
Definition: util.c:43
#define statement_undefined_p(x)
Definition: ri.h:2420
void do_symbolic_tiling(statement base, list vector)
symbolic_tiling.c
static bool symbolic_tiling_valid_p(statement sloop, size_t depth)
checks if sloop is a perfectly nested loop of depth @depth
statement find_loop_from_label(statement, entity)
Definition: util.c:218

References clean_up_sequences(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_symbolic_tiling(), ENDP, find_label_entity(), find_loop_from_label(), gen_full_free_list(), gen_length(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), get_string_property(), module_name(), module_name_to_entity(), module_reorder(), pips_user_warning, reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), statement_undefined_p, string_to_expressions(), and symbolic_tiling_valid_p().

+ Here is the call graph for this function:

◆ tile_hyperplane_constraints()

Psysteme tile_hyperplane_constraints ( Pbase  initial_basis,
Pbase  tile_basis,
matrice  HT,
Pvecteur  tiling_offset 
)

Generate the tile membership constraints between a tile coordinates and an iteration coordinate.

computation of the hyperplane tile direction in the tile basis: = sum(hi)= 1H

computation of the tile scanning base G.

Build the constraints 0 <= det(HT).[HT. (i -i0)]<det(HT).1 with i0=P.G_tile.i_tile <==> 0 <= det(HT).[HT. (i -P.G_tile.i_tile)]<det(HT).1 <==> 0 <= det(HT).[HT.i -G_tile.i_tile]<= det(HT)-1

Find the origin of the iteration domain. Use 0 as default coordinate

Parameters
initial_basisnitial_basis
tile_basisile_basis
HTT
tiling_offsetiling_offset

Definition at line 274 of file tiling.c.

278 {
279  Psysteme mc = sc_new();
280  int dim = base_dimension(initial_basis);
281  int row;
282  int col,col2;
283  Value k = DENOMINATOR(HT);
284  Value up = k - VALUE_ONE;
285  Pbase civ = BASE_UNDEFINED;
286  Pbase ctv = BASE_UNDEFINED;
287  matrice G_tile;
288  Value *h_tile; // hyperplane direction
289  ifdebug(8) {
290  debug(8, "tile_membership_constraints", "Begin with Matrix HT:\n");
291  matrice_fprint(stderr,HT, dim, dim);
292  }
293  int n = dim;
294  pips_assert("The two bases have the same dimension", dim == base_dimension(tile_basis));
295 
296  ifdebug(8) {
297  pips_debug(8,"hyperplane matrix HT:");
298  matrice_fprint(stderr, HT, n, n);
299  (void) fprintf(stderr,"\n");
300  }
301 
302  /* computation of the hyperplane tile direction in the tile basis: = sum(hi)= 1H */
303  h_tile = (Value*)(malloc(n*sizeof(Value)));
304  G_tile = matrice_new(n,n);
305 
306  string tile_direction = (string) get_string_property("TILE_DIRECTION");
307  if(!empty_string_p(tile_direction) && strcmp(tile_direction,"TP") == 0) {
308  for(col=0; col<n; col++) {
309  h_tile[col]=VALUE_ONE;
310  }
311 
312  ifdebug(8) {
313  (void) fprintf(stdout,"The hyperplane direction h_tile is :");
314  for(col=0; col<n; col++)
315  (void) printf("%d ;",(int)h_tile[col]);
316  (void) printf("\n");
317  }
318  /* computation of the tile scanning base G.
319  */
320  scanning_base_hyperplane(h_tile, n, G_tile);
321  ifdebug(8) {
322  (void) fprintf(stderr,"The tile scanning base G_tile is :");
323  matrice_fprint(stderr, G_tile, n, n);
324  }
325  }
326  else matrice_identite(G_tile,n,0);
327 
328  /* Build the constraints
329  0 <= det(HT).[HT. (i -i0)]<det(HT).1 with
330  i0=P.G_tile.i_tile
331  <==> 0 <= det(HT).[HT. (i -P.G_tile.i_tile)]<det(HT).1
332  <==> 0 <= det(HT).[HT.i -G_tile.i_tile]<= det(HT)-1
333  */
334  for(row = 1; row <= dim; row++) {
335  Pvecteur upper = VECTEUR_NUL;
336  Pvecteur lower = VECTEUR_NUL;
339 
340  for(col = 1, civ = initial_basis; col <= dim; col++, civ = vecteur_succ(civ)) {
341  if(ACCESS(HT, dim, row, col)!=VALUE_ZERO) {
342  Value coeff = ACCESS(HT, dim, row, col);
343  Value offset = vect_coeff(vecteur_var(civ), tiling_offset);
344 
345  vect_add_elem(&upper, vecteur_var(civ), coeff);
346  vect_add_elem(&upper, TCST, value_uminus(offset*coeff));
347  }
348  }
349  for(col2 = 1, ctv = tile_basis; col2 <= dim; col2++,ctv = vecteur_succ(ctv)) {
350 
351  /* Find the origin of the iteration domain. Use 0 as default coordinate */
352  if(ACCESS(G_tile, dim, row, col2)!=VALUE_ZERO) {
353  Value coeff2 = ACCESS(G_tile, dim,row, col2);
354  vect_add_elem(&upper, vecteur_var(ctv), value_uminus(k) *coeff2);
355  }
356  }
357 
358  lower = vect_dup(upper);
359  vect_chg_sgn(lower);
360  vect_add_elem(&upper, TCST, value_uminus(up));
361  cupper = contrainte_make(upper);
362  clower = contrainte_make(lower);
363  sc_add_inegalite(mc, cupper);
364  sc_add_inegalite(mc, clower);
365  }
366  sc_creer_base(mc);
367 
368  ifdebug(8) {
369  pips_debug(8, "End with constraint system mc:\n");
371  }
372 
373  return mc;
374 }
#define value_uminus(val)
unary operators on values
static Value offset
Definition: translation.c:283
void scanning_base_hyperplane(Value[], int, matrice)
scanning_base.c
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
int printf()
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References ACCESS, base_dimension, BASE_UNDEFINED, contrainte_make(), CONTRAINTE_UNDEFINED, debug(), DENOMINATOR, empty_string_p(), entity_local_name(), fprintf(), get_string_property(), ifdebug, malloc(), matrice_fprint(), matrice_identite(), matrice_new, offset, pips_assert, pips_debug, printf(), sc_add_inegalite(), sc_creer_base(), sc_fprint(), sc_new(), scanning_base_hyperplane(), TCST, VALUE_ONE, value_uminus, VALUE_ZERO, vect_add_elem(), vect_chg_sgn(), vect_coeff(), vect_dup(), VECTEUR_NUL, vecteur_succ, and vecteur_var.

Referenced by parallel_tiling().

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

◆ tiling_transformation()

statement tiling_transformation ( list  ,
bool(*)(statement  
)