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

Go to the source code of this file.

Macros

#define COLUMN_MAJOR   true
 Warning! Do not modify this file that is automatically generated! More...
 
#define SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP   "_1"
 
#define SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP   "_2"
 

Functions

Pbase build_image_base (bool, Pbase, Pbase, Pbase)
 cproto-generated files More...
 
void print_fullname_base (Pbase)
 
void update_basis (Pbase, Pbase *, Pbase *, Pbase *, Pbase, Pbase, Pbase *, Pbase *, Pbase *, Pbase *, Pbase *, bool, Pbase)
 Update all the basis needed for data movement generation. More...
 
void sort_tile_indices (Pbase, Pbase *, matrice, int)
 Sort the tile indices base, such that the indices correspond to the tile indices of the array elements accessed by the local entity. More...
 
Psysteme elim_redund_sc_with_sc (Psysteme, Psysteme, Pbase, int)
 Build the system of inequations of sc1 no-redundant with system sc2. More...
 
Pbase variables_in_declaration_list (entity, code)
 
statement movement_computation (entity, bool, bool, bool, entity, Psysteme, Pbase, Pbase, Pbase, Pbase, Pbase, int, int)
 Calcul des nouvelles bornes des boucles et de la nouvelle fonction d'acces a une reference d'un tableau permettant d'exprimer l'ensemble des elements references dans une base. More...
 
Psysteme sc_image_computation (entity, entity, Psysteme, Psysteme, Pbase, Pbase *, entity, Pbase, Pbase, Pbase *, int, int, int, int *, int *)
 This function computes the system of constraints characterizing the image by the array function of the iteration domain. More...
 
expression lower_bound_generation (Psysteme, Pbase, int, int)
 bound_generation.c More...
 
expression upper_bound_generation (Psysteme, Pbase, int, int)
 This fonction generates the upper bounds of the "loop_rank"-th loop. More...
 
expression test_bound_generation (Psysteme, Pbase)
 This function generates the expressions of the guard if it exists. More...
 
statement bound_generation (entity, bool, bool, entity, Pbase, Pbase, Psysteme *, Pbase, int, int[][4])
 Generation of the new loop nest characterizing the new domain. More...
 
expression make_div_expression (expression, cons *)
 operation.c More...
 
expression make_op_expression (entity, cons *)
 
expression complex_bound_generation (Value, Value, Value, Pvecteur, Variable, Pvecteur, Variable)
 complex_bound_generation.c More...
 
expression complex_bound_computation (Psysteme, Pbase, Pcontrainte, Pcontrainte, int)
 
void bound_distribution (Psysteme *, Pbase, int[][4], int, Psysteme *, Psysteme *, Psysteme)
 constraint_distribution.c More...
 
void constraint_distribution (Psysteme, Psysteme *, Pbase, int[][4])
 Distribution of the constraints of the system sc into several systems. More...
 
void egalite_distribution (Psysteme, Psysteme *, Pbase)
 
void wp65_debug_print_text (entity, statement)
 make_loop_body.c More...
 
void wp65_debug_print_module (entity, statement)
 
bool variable_in_declaration_module_p (entity, entity)
 
entity find_operator (entity, string, string)
 
statement make_statement_operator (entity, cons *)
 
statement make_movements_loop_body_wp65 (entity, bool, entity, Pbase, Pbase, Psysteme, Psysteme, Pbase, int, int, int)
 statement make_movements_loop_body_wp65(module,receive_code, ent,local_indices,var_id, sc_neg,sc_pos,index_base,rank, number_of_lower_bounds, number_of_upper_bounds) More...
 
statement make_datum_movement (entity, bool, entity, Pbase, Pbase)
 statement make_datum_movement(module,receive_code,ent, local_indices,var_id) More...
 
statement make_movement_scalar_wp65 (entity, bool, reference, entity)
 statement make_movement_scalar_wp65(receive_code,r) More...
 
Psysteme build_sc_machine (int, int, int, Psysteme, entity, Pbase, entity)
 build_sc_machine.c More...
 
Pvecteur make_loop_indice_equation (Pbase, tiling, Pvecteur, Pvecteur, Pvecteur, int)
 build_sc_tile.c More...
 
Psysteme loop_bounds_to_tile_bounds (Psysteme, Pbase, tiling, Pvecteur, Pvecteur, Pvecteur)
 this function returns the system of constraints More...
 
Variable sc_add_new_variable_name (entity, Psysteme)
 sc_add_variable.c More...
 

Macro Definition Documentation

◆ COLUMN_MAJOR

#define COLUMN_MAJOR   true

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

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

Definition at line 36 of file movements.h.

◆ SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP

#define SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP   "_1"

Definition at line 38 of file movements.h.

◆ SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP

#define SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP   "_2"

Definition at line 39 of file movements.h.

Function Documentation

◆ bound_distribution()

void bound_distribution ( Psysteme ,
Pbase  ,
int  [][4],
int  ,
Psysteme ,
Psysteme ,
Psysteme   
)

◆ bound_generation()

statement bound_generation ( entity  module,
bool  bank_code,
bool  receive_code,
entity  ent,
Pbase  loop_body_indices,
Pbase  var_id,
Psysteme lsystem,
Pbase  index_base,
int  n,
int  sc_info[][4] 
)

Generation of the new loop nest characterizing the new domain.

The set of systems lsystem describes the set of constraints of each loop index. New loop bounds are deduced from these sytems.

Initialisation des systemes

make new bound expression and new range loop

looplabel = make_new_label(initial_module_name);

new code by FI to add continue statements starts here

end of new code by FI

Parameters
moduleodule
bank_codeank_code
receive_codeeceive_code
entnt
loop_body_indicesoop_body_indices
var_idar_id
lsystemsystem
index_basendex_base
sc_infoc_info

Definition at line 328 of file bound_generation.c.

339 {
340 
341  Psysteme ps,*sc_pos,*sc_neg,sc_test;
342  Pvecteur pv;
343  Variable var;
344  int n0_loop,i,first_loop;
345  int number_of_lower_bounds = 0;
346  int number_of_upper_bounds =0;
347  expression lower_bound;
348  expression upper_bound;
349  expression test_bound;
350  range looprange;
351  statement stat, cs;
352  statement loopbody =statement_undefined;
353  test tst;
354  entity looplabel;
355  loop newloop;
356  int space = (n+1) * sizeof(Ssysteme);
357  bool debut = true;
358  int j;
359  debug_on("MOVEMENT_DEBUG_LEVEL");
360  debug(8,"bound_generation","begin\n");
361 
362  /* Initialisation des systemes */
363 
364  sc_neg = (Psysteme *) malloc((unsigned)(space));
365  sc_pos = (Psysteme *) malloc((unsigned)(space));
366  ps = lsystem[1];
367  sc_test = sc_init_with_sc(ps);
368 
369  bound_distribution(lsystem,index_base,sc_info,n,
370  sc_neg,sc_pos,sc_test);
371 
372 
373  if (!CONTRAINTE_UNDEFINED_P(sc_test->inegalites)) {
374  test_bound = test_bound_generation(sc_test,index_base);
375  loopbody = make_datum_movement(module,receive_code,ent,
376  loop_body_indices,
377  var_id);
378  tst = make_test(test_bound,loopbody,
380  stat = test_to_statement(tst);
381  loopbody=make_block_statement(CONS(STATEMENT,stat,NIL));
382  debut=false;
383  }
384 
385  ifdebug(8) {
386  (void) fprintf(stderr, "base des indices \n");
387  for (pv = index_base; pv!=NULL; pv=pv->succ)
388  fprintf (stderr,"%s,",entity_local_name((entity) pv->var));
389 
390  for (i=1;i<=n;i++) {
391  for (j=1; j<=3;j++) {
392  printf ("%d,",sc_info[i][j]); }
393  printf ("\n");
394  }
395  }
396 
397  first_loop = (bank_code) ? 2 : 1;
398 
399  for (n0_loop = vect_size(index_base); n0_loop >= first_loop; n0_loop --) {
400  var = variable_of_rank(index_base,n0_loop);
401 
402  if (sc_info[rank_of_variable(index_base,var)][1]) {
403  ps = lsystem[n0_loop];
404  ifdebug(8) {
405  (void) fprintf(stderr,"LE SYSTEME est :\n");
406  (void) sc_fprint(stderr, ps, (get_variable_name_t) entity_local_name);
407  }
408  number_of_lower_bounds = 0;
409  number_of_upper_bounds = 0;
410  if (debut) {
412  receive_code,ent,
413  loop_body_indices,
414  var_id,
415  sc_neg[n0_loop],
416  sc_pos[n0_loop],
417  index_base,n0_loop,
418  sc_info[n0_loop][3],
419  sc_info[n0_loop][2]);
420  debut = false;
421  }
422  else {
423  /* make new bound expression and new range loop */
424 
425  number_of_upper_bounds=sc_info[n0_loop][2];
426  number_of_lower_bounds=sc_info[n0_loop][3];
427  lower_bound = lower_bound_generation(sc_neg[n0_loop],
428  index_base,
429  number_of_lower_bounds,
430  n0_loop);
431 
432  upper_bound = upper_bound_generation(sc_pos[n0_loop],
433  index_base,
434  number_of_upper_bounds,
435  n0_loop);
436 
437  looprange = make_range(lower_bound,upper_bound,
438  int_to_expression(1));
439 
440  /* looplabel = make_new_label(initial_module_name); */
441  /* new code by FI to add continue statements starts here */
442  looplabel = make_loop_label(9000, module);
443  cs = make_continue_statement(looplabel);
446  CONS(STATEMENT, cs, NIL));
447  else {
448  loopbody = make_block_statement(CONS(STATEMENT, loopbody,
449  CONS(STATEMENT, cs, NIL)));
450  }
451  /* end of new code by FI */
452 
453  if (n0_loop ==1)
454  newloop = make_loop((entity) var,
455  looprange,
456  loopbody,
457  looplabel,
459  UU),
460  NIL);
461  else newloop = make_loop((entity) var,
462  looprange,
463  loopbody,
464  looplabel,
466  NIL);
467 
468  stat = loop_to_statement(newloop);
469 
470  loopbody = make_block_statement(CONS(STATEMENT,stat,NIL));
471  ifdebug(8) {
473  pips_debug(8,"systeme pour la %d boucle \n",n0_loop);
474  (void) sc_fprint(stderr, sc_neg[n0_loop],
476  (void) sc_fprint(stderr, sc_pos[n0_loop],
478  (void) sc_fprint(stderr, sc_test,
480  }
481  }
482  }
483  }
484 
485  free((Psysteme) sc_neg);
486  free((Psysteme) sc_pos);
487 
488  debug(8,"bound_generation","end\n");
489  debug_off();
490  return(loopbody);
491 
492 }
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
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
int rank_of_variable(Pbase base, Variable var)
this function returns the rank of the variable var in the base 0 encodes TCST, but I do not know why,...
Definition: base.c:497
void bound_distribution(Psysteme *pps, Pbase index_base, sc_info, int nb_loop, Psysteme *sc_neg, Psysteme *sc_pos, Psysteme sc_test)
Distribution of the constraints of the system ps in three systems.
#define CONTRAINTE_UNDEFINED_P(c)
void * malloc(YYSIZE_T)
void free(void *)
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
#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
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
statement make_continue_statement(entity)
Definition: statement.c:953
float_t space[SIZE][SIZE]
Definition: jacobi.c:7
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
statement make_movements_loop_body_wp65(entity module, bool receive_code, entity ent, Pbase local_indices, Pbase var_id, Psysteme sc_neg, Psysteme sc_pos, Pbase index_base, int rank, int number_of_lower_bounds, int number_of_upper_bounds)
statement make_movements_loop_body_wp65(module,receive_code, ent,local_indices,var_id,...
void wp65_debug_print_text(entity m, statement s)
include "values.h"
statement make_datum_movement(entity module, bool receive_code, entity ent, Pbase local_indices, Pbase var_id)
statement make_datum_movement(module,receive_code,ent, local_indices,var_id)
#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 debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
expression test_bound_generation(Psysteme sc_test, Pbase index_base)
This function generates the expressions of the guard if it exists.
expression lower_bound_generation(Psysteme sc_neg, Pbase index_base, int number_of_lower_bounds, int loop_rank)
This fonction generates the lower bounds of the "loop_rank"-th loop.
expression upper_bound_generation(Psysteme sc_pos, Pbase index_base, int number_of_upper_bounds, int loop_rank)
This fonction generates the upper bounds of the "loop_rank"-th loop.
#define UU
Definition: newgen_types.h:98
static char * module
Definition: pips.c:74
#define instruction_block_p(i)
#define loop_to_statement(l)
#define test_to_statement(t)
#define instruction_block(i)
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
entity entity_empty_label(void)
Definition: entity.c:1105
entity make_loop_label(int __attribute__((unused)) desired_number, entity module)
Definition: entity.c:370
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 entity_undefined
Definition: ri.h:2761
#define statement_instruction(x)
Definition: ri.h:2458
@ is_execution_parallel
Definition: ri.h:1190
@ is_execution_sequential
Definition: ri.h:1189
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
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
Variable variable_of_rank()
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
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
int printf()
#define ifdebug(n)
Definition: sg.c:47
Pcontrainte inegalites
Definition: sc-local.h:71
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62
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

References bound_distribution(), CONS, CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, entity_empty_label(), entity_local_name(), entity_undefined, fprintf(), free(), gen_nconc(), ifdebug, Ssysteme::inegalites, instruction_block, instruction_block_p, int_to_expression(), is_execution_parallel, is_execution_sequential, loop_to_statement, lower_bound_generation(), make_block_statement(), make_continue_statement(), make_datum_movement(), make_execution(), make_loop(), make_loop_label(), make_movements_loop_body_wp65(), make_range(), make_test(), malloc(), module, NIL, pips_debug, printf(), rank_of_variable(), sc_fprint(), sc_init_with_sc(), space, STATEMENT, statement_instruction, statement_undefined, Svecteur::succ, test_bound_generation(), test_to_statement, upper_bound_generation(), UU, Svecteur::var, variable_of_rank(), vect_size(), and wp65_debug_print_text().

Referenced by movement_computation().

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

◆ build_image_base()

Pbase build_image_base ( bool  bank_code,
Pbase  proc_id,
Pbase  bank_indices,
Pbase  tile_indices 
)

cproto-generated files

movement_computation.c

Parameters
bank_codeank_code
proc_idroc_id
bank_indicesank_indices
tile_indicesile_indices

Definition at line 76 of file movement_computation.c.

81 {
82  Pvecteur pb,ti;
83  Pbase invt = base_reversal(tile_indices);
84  Pbase dupt = base_dup(tile_indices);
85 
86  debug_on("MOVEMENT_DEBUG_LEVEL");
87  debug(8,"build_image_base","begin\n");
88 
89  ti = (COLUMN_MAJOR) ? dupt:invt ;
90 
91  if (bank_code)
92  pb = vect_new(vecteur_var(bank_indices->succ->succ),VALUE_ONE);
93  else
94  pb = vect_new(ti->var,VALUE_ONE);
95  vect_add_elem(&pb,vecteur_var(bank_indices->succ),VALUE_ONE);
96 
97  if (!VECTEUR_NUL_P(ti->succ))
99 
100  if (bank_code)
101  vect_add_elem(&pb,vecteur_var(proc_id),VALUE_ONE);
102  else
103  vect_add_elem(&pb,vecteur_var(bank_indices),VALUE_ONE);
104 
105  vect_rm(dupt);
106  vect_rm(invt);
107  debug(8,"build_image_base","end\n");
108  debug_off();
109  return ((Pbase) pb);
110 }
#define VALUE_ONE
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
#define COLUMN_MAJOR
Package movements
#define vecteur_var(v)
#define VECTEUR_NUL_P(v)
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Definition: alloc.c:268
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_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78
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 base_dup(), base_reversal(), COLUMN_MAJOR, debug(), debug_off, debug_on, Svecteur::succ, VALUE_ONE, Svecteur::var, vect_add_elem(), vect_new(), vect_rm(), VECTEUR_NUL_P, and vecteur_var.

Referenced by update_basis().

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

◆ build_sc_machine()

Psysteme build_sc_machine ( int  pn,
int  bn,
int  ls,
Psysteme  sc_array_function,
entity  proc_id,
Pbase  bank_indices,
entity  entity_var 
)

build_sc_machine.c

build_sc_machine.c

Corinne Ancourt - septembre 1991 this function builds the following system of constraints depending on the machine. It describes the implementation of array elements in the memory in function of bank, ligne size, ligne bank,...

bn is the number of banks, ls the ligne size, ms the first array dimension bank is a variable giving the bank id., ligne a variable corresponding to a ligne in the bank, ofs a variable corresponding to an offset in a ligne of the bank.

if COLUMN_MAJOR is true the system is the following one

 (VAR1-1) + (VAR2-1) *ms == bn*ls* ligne +ls*bank+ofs,
   1 <= bank <= bn ,
   1 <= proc <= pn ,
   0 <= ofs <= ls-1

else it is

  (VAR1-1) * ms + (VAR2-1) == bn*ls*ligne +ls*bank+ofs,
    1 <= bank <= bn ,
    1 <= proc <= pn ,
    0 <= ofs <= ls-1

Si l'on veut utiliser le nombre d'octets il faut remplacer l'equation par deux inequations du type

if COLUMN_MAJOR is true the system is the following one

(VAR1-1) + (VAR2-1) ms <= bn*ls (ligne-1) +ls*(bank-1)+ofs, bn*ls* (ligne-1) +ls*(bank-1)+ofs <= (VAR1) + (VAR2-1) *ms

else it is

(VAR1-1) * ms + (VAR2-1) <= bn*ls*(ligne-1) +ls*(bank-1)+ofs, bn*ls*(ligne-1) +ls*(bank-1)+ofs <= (VAR1-1) * ms + (VAR2)

nb_bytes = SizeOfElements(bas);

bank_indices is assumed to belong the three variables bank_id, L and O (see documentation for more details)

if COLUMN_MAJOR is true then build the constraint
(VAR1-1) + (VAR2-1) *ms == bn*ls*L +ls*bank_id+O, else build the constraint (VAR1-1) * ms + (VAR2-1) == bn*ls*L +ls*bank_id+O, VAR1 and VAR2 correspond to the image array function indices

to deal with MONO dimensional array

to deal with MONO dimensional array

build the constraints 0 <= bank_id <= bn-1

build the constraints 0 <= proc_id <= pn-1

build the constraints 0 <= O <= ls -1

build the constraints 0 <= L

Parameters
pnn
bnn
lss
sc_array_functionc_array_function
proc_idroc_id
bank_indicesank_indices
entity_varntity_var

Definition at line 70 of file build_sc_machine.c.

78 {
79 
80  type t = entity_type(entity_var);
81  Value ms=0;
82  Variable vbank,vligne,vofs;
83  Psysteme sc = sc_init_with_sc(sc_array_function);
84  Pcontrainte pc;
85  Pvecteur pv1,pv2;
86  int nb_bytes=1;
87 
88  debug(8,"build_sc_machine","begin\n");
89  if (type_variable_p(t)) {
90  variable var = type_variable(t);
91  cons * dims = variable_dimensions(var);
92  dimension dim1 = DIMENSION(CAR(dims));
93  expression lower= dimension_lower(dim1);
94  normalized norm1 = NORMALIZE_EXPRESSION(lower);
95  expression upper= dimension_upper(dim1);
96  normalized norm2 = NORMALIZE_EXPRESSION(upper);
97  Value min_ms =VALUE_ZERO, max_ms=VALUE_ZERO;
98  if (normalized_linear_p(norm1) && normalized_linear_p(norm2)) {
99  min_ms = vect_coeff(TCST,(Pvecteur) normalized_linear(norm1));
100  max_ms = vect_coeff(TCST,(Pvecteur) normalized_linear(norm2));
101  }
102  ms = value_plus(value_minus(max_ms,min_ms), VALUE_ONE);
103 
104  /* Si l'on veut utiliser le nombre d'octets il faut remplacer l'equation
105  par deux inequations du type
106 
107  if COLUMN_MAJOR is true the system is the following one
108 
109  (VAR1-1) + (VAR2-1) *ms <= bn*ls* (ligne-1) +ls*(bank-1)+ofs,
110  bn*ls* (ligne-1) +ls*(bank-1)+ofs <= (VAR1) + (VAR2-1) *ms
111 
112  else it is
113 
114  (VAR1-1) * ms + (VAR2-1) <= bn*ls*(ligne-1) +ls*(bank-1)+ofs,
115  bn*ls*(ligne-1) +ls*(bank-1)+ofs <= (VAR1-1) * ms + (VAR2)
116 
117  */
118 
119  /* nb_bytes = SizeOfElements(bas);*/
120 
121  }
122 
123  ifdebug(8) {
124  fprint_string_Value(stderr," MS = ",ms);
125  fprintf(stderr, " \n");
126  }
127 
128  vbank = vecteur_var(bank_indices);
129  vligne = vecteur_var(bank_indices->succ);
130  vofs = vecteur_var(bank_indices->succ->succ);
131  sc->base = vect_add_variable(sc->base,vbank);
132  sc->base = vect_add_variable(sc->base,vligne);
133  sc->base = vect_add_variable(sc->base,vofs);
134 
135  sc->dimension +=3;
136 
137  /* bank_indices is assumed to belong the three variables
138  bank_id, L and O (see documentation for more details) */
139 
140  /* if COLUMN_MAJOR is true then build the constraint
141  (VAR1-1) + (VAR2-1) *ms == bn*ls*L +ls*bank_id+O,
142  else build the constraint
143  (VAR1-1) * ms + (VAR2-1) == bn*ls*L +ls*bank_id+O,
144  VAR1 and VAR2 correspond to the image array function indices */
145  pv1 = vect_new(vbank,int_to_value(-ls));
146  vect_add_elem(&pv1,vligne,int_to_value((-bn*ls)));
147  vect_add_elem(&pv1,vofs,VALUE_MONE);
148  if (COLUMN_MAJOR)
149  pc = sc_array_function->inegalites;
150  else pc = sc_array_function->inegalites->succ;
151  /* to deal with MONO dimensional array */
152  if (pc==NULL) pc= contrainte_make(vect_new(TCST,VALUE_ONE));
153  pv2 = vect_dup(pc->vecteur);
155  pv2 = vect_multiply(pv2,int_to_value(nb_bytes));
156  pv1 = vect_add(pv1,pv2);
157  if (COLUMN_MAJOR)
158  pc = pc->succ;
159  else pc = sc_array_function->inegalites;
160  /* to deal with MONO dimensional array */
161  if (pc==NULL) pc= contrainte_make(vect_new(TCST,VALUE_ONE));
162  pv2 = vect_dup(pc->vecteur);
164  Value nbv = int_to_value(nb_bytes);
165  pv2 = vect_multiply(pv2,value_mult(ms, nbv));
166  pv1 = vect_add(pv1,pv2);
167  pc = contrainte_make(pv1);
168  sc_add_eg(sc,pc);
169 
170  /* build the constraints 0 <= bank_id <= bn-1 */
171 
172  pv2 = vect_new(vbank, VALUE_MONE);
173  pc = contrainte_make(pv2);
174  sc_add_ineg(sc,pc);
175  pv2 = vect_new(vbank, VALUE_ONE);
176  vect_add_elem(&pv2,TCST,int_to_value(- bn+1));
177  pc = contrainte_make(pv2);
178  sc_add_ineg(sc,pc);
179 
180  /* build the constraints 0 <= proc_id <= pn-1 */
181  sc->base = vect_add_variable(sc->base,(char *) proc_id);
182  sc->dimension++;
183  pv2 = vect_new((char *) proc_id, VALUE_MONE);
184  pc = contrainte_make(pv2);
185  sc_add_ineg(sc,pc);
186  pv2 = vect_new((char *) proc_id, VALUE_ONE);
187  vect_add_elem(&pv2,TCST,int_to_value(- pn+1));
188  pc = contrainte_make(pv2);
189  sc_add_ineg(sc,pc);
190 
191 
192  /* build the constraints 0 <= O <= ls -1 */
193 
194  pv2 = vect_new(vofs, VALUE_MONE);
195  pc = contrainte_make(pv2);
196  sc_add_ineg(sc,pc);
197  pv2 = vect_new(vofs, VALUE_ONE);
198  vect_add_elem(&pv2,TCST,int_to_value(- ls +1));
199  pc = contrainte_make(pv2);
200  sc_add_ineg(sc,pc);
201 
202 
203  /* build the constraints 0 <= L */
204 
205  pc = contrainte_make(vect_new(vligne,VALUE_MONE));
206  sc_add_ineg(sc,pc);
207  ifdebug(8) {
208  (void) fprintf(stderr,"Domain Machine :\n");
210  }
211  debug(8,"build_sc_machine","end\n");
212 
213  return(sc);
214 
215 }
#define VALUE_ZERO
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define value_minus(v1, v2)
#define VALUE_MONE
int Value
#define value_plus(v1, v2)
binary operators on values
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
void fprint_string_Value(FILE *, char *, Value)
Definition: io.c:47
Pbase vect_add_variable(Pbase b, Variable v)
package vecteur - routines sur les bases
Definition: base.c:61
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define NORMALIZE_EXPRESSION(e)
#define normalized_linear_p(x)
Definition: ri.h:1779
#define dimension_lower(x)
Definition: ri.h:980
#define type_variable(x)
Definition: ri.h:2949
#define dimension_upper(x)
Definition: ri.h:982
#define variable_dimensions(x)
Definition: ri.h:3122
#define entity_type(x)
Definition: ri.h:2792
#define normalized_linear(x)
Definition: ri.h:1781
#define type_variable_p(x)
Definition: ri.h:2947
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
Definition: scalaires.c:123
Pvecteur vecteur
struct Scontrainte * succ
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#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
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
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 Ssysteme::base, CAR, COLUMN_MAJOR, contrainte_make(), debug(), Ssysteme::dimension, DIMENSION, dimension_lower, dimension_upper, entity_local_name(), entity_type, fprint_string_Value(), fprintf(), ifdebug, Ssysteme::inegalites, int_to_value, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, sc_fprint(), sc_init_with_sc(), Scontrainte::succ, Svecteur::succ, TCST, type_variable, type_variable_p, value_minus, VALUE_MONE, value_mult, VALUE_ONE, value_plus, VALUE_ZERO, variable_dimensions, vect_add(), vect_add_elem(), vect_add_variable(), vect_coeff(), vect_dup(), vect_multiply(), vect_new(), Scontrainte::vecteur, and vecteur_var.

Referenced by sc_image_computation().

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

◆ complex_bound_computation()

expression complex_bound_computation ( Psysteme  ,
Pbase  ,
Pcontrainte  ,
Pcontrainte  ,
int   
)

◆ complex_bound_generation()

expression complex_bound_generation ( Value  ,
Value  ,
Value  ,
Pvecteur  ,
Variable  ,
Pvecteur  ,
Variable   
)

◆ constraint_distribution()

void constraint_distribution ( Psysteme  sc,
Psysteme bound_systems,
Pbase  index_base,
int  sc_info[][4] 
)

Distribution of the constraints of the system sc into several systems.

System sc contains all the contraints having to be used to generate bound expressions for all loop indices.

A new system is defined for each system variable. Each new system defines the set of constraints needed for the generation of loop bound expressions for one variable.

The constraint constraining directly a variable of rank "rank_hr" is added to the system corresponding to the variable "var_hr" except if this variable must not be kept (var_hr is not a loop index). In this last case, the constraint must be combined with another constraint in order to eliminate the variable "var_hr" and to deduce a constraint constrainnig another variable of rank "rank". In that case, the two constraints are added to the system corresponding to the variable "var = variable_of_rank(rank)"

This condition is true if the variable must be kept like loop index. All the constraints constraining directly the variable of rank "rank_hr" are kept in the system bound_systems[rank_hr]

this condition is true if the combination of the two constraints pc1 and pc2 is not redundant for the
system. Then the two constraints are added to the system of the variable of higher rank

Parameters
scc
bound_systemsound_systems
index_basendex_base
sc_infoc_info

Definition at line 164 of file constraint_distribution.c.

169 {
170  Pcontrainte pc1,pc2;
171  int rank,rank_hr,rank_pc1,rank_pc2;
172  Value coeff1,coeff2;
173  int sign1,sign2,i;
174  Variable var_hr;
175  Psysteme sc2 = sc_init_with_sc(sc);
176 
177  debug_on("MOVEMENT_DEBUG_LEVEL");
178  debug(8,"constraint_distribution","begin\n");
179 
180 
181  for (pc1=sc->inegalites; !CONTRAINTE_UNDEFINED_P(pc1); pc1 = pc1->succ) {
182  if ((rank_hr = search_higher_rank(pc1->vecteur,index_base))>0) {
183  if (sc_info[rank_hr][1]) {
184  /* This condition is true if the variable must be kept like
185  loop index. All the constraints constraining directly the
186  variable of rank "rank_hr" are kept in the system
187  bound_systems[rank_hr] */
188 
189  insert_ineq_end_sc(bound_systems[rank_hr],pc1);
190  insert_ineq_end_sc(sc2,pc1);
191  }
192  else {
193  var_hr = variable_of_rank(index_base,rank_hr);
194  rank_pc1 = rank_of_variable
195  (index_base,
197  index_base,
198  var_hr));
199 
200  coeff1 = vect_coeff(var_hr,pc1->vecteur);
201  sign1 = value_sign(coeff1);
202  for (pc2 = pc1; !CONTRAINTE_UNDEFINED_P(pc2);
203  pc2= pc2->succ) {
204  coeff2 = vect_coeff(var_hr,pc2->vecteur);
205  sign2 = value_sign(coeff2);
206  if (value_notzero_p(coeff2) && sign1 == -sign2
207  && !bound_redund_with_sc_p(sc2,pc1,pc2,var_hr)) {
208  /* this condition is true if the combination of the
209  two constraints pc1 and pc2 is not redundant for the
210  system. Then the two constraints are added to the
211  system of the variable of higher rank */
212 
214  index_base,
215  var_hr);
216  rank_pc2 = rank_of_variable(index_base,var2);
217 
218  if (rank_pc1 !=rank_pc2)
219  rank=(rank_pc1 >rank_pc2) ? rank_pc1:rank_pc2;
220  else rank = rank_hr;
221  insert_ineq_end_sc(bound_systems[rank],pc1);
222  insert_ineq_end_sc(bound_systems[rank],pc2);
223  insert_ineq_end_sc(sc2,pc1);
224  insert_ineq_end_sc(sc2,pc2);
225  }
226  }
227  }
228  }
229  }
230  ifdebug(8) {
231  for (i=1;i<=vect_size(index_base);i++) {
232  (void) fprintf(stderr,"Le systeme sur la var. %d est:\n",i);
233  sc_fprint(stderr, bound_systems[i], (get_variable_name_t) entity_local_name);
234  }
235  }
236 
237  debug(8,"constraint_distribution","end\n");
238  debug_off();
239 }
#define value_sign(v)
trian operators on values
#define value_notzero_p(val)
int search_higher_rank(Pvecteur vect, Pbase base)
int search_higher_rank(): this fonction returns the rank of the variable of higher rank in the vecteu...
Definition: base.c:541
static entity rank
bool bound_redund_with_sc_p(Psysteme sc, Pcontrainte ineq1, Pcontrainte ineq2, Variable var)
This function returns true if the constraint C (resulting of the combination of the two constraints i...
void insert_ineq_end_sc(Psysteme sc, Pcontrainte ineq)
This function inserts one constraint ineq at the end of the system of inequalities of sc.
Definition: sc_insert_eq.c:81
Variable search_var_of_higher_rank()

References bound_redund_with_sc_p(), CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, entity_local_name(), fprintf(), ifdebug, Ssysteme::inegalites, insert_ineq_end_sc(), rank, rank_of_variable(), sc_fprint(), sc_init_with_sc(), search_higher_rank(), search_var_of_higher_rank(), Scontrainte::succ, value_notzero_p, value_sign, variable_of_rank(), vect_coeff(), vect_size(), and Scontrainte::vecteur.

Referenced by movement_computation(), and parallel_tiling().

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

◆ egalite_distribution()

void egalite_distribution ( Psysteme  sc,
Psysteme bound_systems,
Pbase  index_base 
)
Parameters
scc
bound_systemsound_systems
index_basendex_base

Definition at line 241 of file constraint_distribution.c.

245 {
246  Pcontrainte pc1;
247  int rank;
248 
249  debug_on("MOVEMENT_DEBUG_LEVEL");
250  debug(8,"egalite_distribution","begin\n");
251 
252  for (pc1=sc->egalites; !CONTRAINTE_UNDEFINED_P(pc1); pc1 = pc1->succ) {
253  if ((rank = search_higher_rank(pc1->vecteur,index_base))>0) {
254  sc_add_eg(bound_systems[rank],pc1);
255  }
256  }
257  debug(8,"egalite_distribution","end\n");
258  debug_off();
259 }
Pcontrainte egalites
Definition: sc-local.h:70

References CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, Ssysteme::egalites, rank, search_higher_rank(), Scontrainte::succ, and Scontrainte::vecteur.

+ Here is the call graph for this function:

◆ elim_redund_sc_with_sc()

Psysteme elim_redund_sc_with_sc ( Psysteme  sc1,
Psysteme  sc2,
Pbase  index_base,
int  dim 
)

Build the system of inequations of sc1 no-redundant with system sc2.

Parameters
sc1c1
sc2c2
index_basendex_base
dimim

Definition at line 262 of file movement_computation.c.

266 {
267  Pcontrainte pc,pc2;
268  Psysteme ps1 = sc_init_with_sc(sc1);
269  Psysteme ps2 = sc_dup(sc2);
270 
271  for (pc =sc1->inegalites; pc != NULL;pc = pc->succ) {
272 
273  pc2 = contrainte_dup(pc);
274  if (search_higher_rank(pc2->vecteur,index_base) > dim ||
275  !ineq_redund_with_sc_p(ps2,pc2)) {
276  pc2 = contrainte_dup(pc);
277  sc_add_ineg(ps1,pc2);
278  pc2 = contrainte_dup(pc);
279  sc_add_ineg(ps2,pc2);
280  }
281  }
282  ps2 = sc_dup(sc2);
283 
284  for (pc = ps1->inegalites; pc != NULL;pc = pc->succ) {
285  pc2 = contrainte_dup(pc);
286  if (search_higher_rank(pc2->vecteur,index_base) > dim ||
287  !ineq_redund_with_sc_p(ps2,pc2)) {
288  pc2 = contrainte_dup(pc);
289  sc_add_ineg(ps2,pc2);
290  }
291  else eq_set_vect_nul(pc);
292  }
293 
294  sc_rm_empty_constraints(ps1, false);
295  return (ps1);
296 }
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132
void eq_set_vect_nul(Pcontrainte)
void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == ...
Definition: unaires.c:84
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool ineq_redund_with_sc_p(Psysteme sc, Pcontrainte ineq)
This function returns true if the inequation ineq is redundant for the system ps and false otherwise.
void sc_rm_empty_constraints(Psysteme ps, bool process_equalities)
package sc: elimination de redondance simple
Definition: sc_elim_eq.c:56

References contrainte_dup(), eq_set_vect_nul(), Ssysteme::inegalites, ineq_redund_with_sc_p(), sc_dup(), sc_init_with_sc(), sc_rm_empty_constraints(), search_higher_rank(), Scontrainte::succ, and Scontrainte::vecteur.

Referenced by movement_computation(), and parallel_tiling().

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

◆ find_operator()

entity find_operator ( entity  module,
string  oper,
string  str 
)
Parameters
moduleodule
operper
strtr

Definition at line 117 of file make_loop_body.c.

118 {
119  entity operator;
120  string name = concatenate(TOP_LEVEL_MODULE_NAME,
123  "_",oper, "_",str,NULL);
124 
125  if ((operator = gen_find_tabulated(name, entity_domain))
126  == entity_undefined)
127  operator=make_entity(strdup(name),
131  UU))),
134  return(operator);
135 }
functional make_functional(list a1, type a2)
Definition: ri.c:1109
storage make_storage_rom(void)
Definition: ri.c:2285
value make_value(enum value_utype tag, void *val)
Definition: ri.c:2832
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
@ is_value_unknown
Definition: ri.h:3035
@ is_type_void
Definition: ri.h:2904
@ is_type_functional
Definition: ri.h:2901
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
char * strdup()

References concatenate(), entity_domain, entity_undefined, gen_find_tabulated(), is_type_functional, is_type_void, is_value_unknown, make_entity, make_functional(), make_storage_rom(), make_type(), make_value(), module, module_local_name(), MODULE_SEP_STRING, NIL, strdup(), TOP_LEVEL_MODULE_NAME, and UU.

Referenced by make_datum_movement(), make_movement_scalar_wp65(), and make_movements_loop_body_wp65().

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

◆ loop_bounds_to_tile_bounds()

Psysteme loop_bounds_to_tile_bounds ( Psysteme  loop_bounds,
Pbase  loop_indices,
tiling  t,
Pvecteur  tile_delay,
Pvecteur  tile_indices,
Pvecteur  tile_local_indices 
)

this function returns the system of constraints

-------—> --------—> ------—> ---—> --------------—> loop_indices = P (tile_indices - tile_delay) + origin + tile_local_indices

P is the matrice describing the tiling. Its determinant is 1.

mise a jour de la base du systeme de contraintes

build the constraints min (=0) <= lti <= max (=ls-1)

build the constraints 0 <= ti

Parameters
loop_boundsoop_bounds
loop_indicesoop_indices
tile_delayile_delay
tile_indicesile_indices
tile_local_indicesile_local_indices

Definition at line 97 of file build_sc_tile.c.

103 {
104  Psysteme sc = sc_dup(loop_bounds);
105  matrice P = (matrice) tiling_tile(t);
106  Pcontrainte pc;
107  Pvecteur li,to,lti,ti,td,pv;
108  int n,m,i,j;
109  Value min,max,val;
110 
111  debug_on("MOVEMENT_DEBUG_LEVEL");
112  debug(8,"loop_bounds_to_tile_bounds","begin\n");
113 
114  /* mise a jour de la base du systeme de contraintes */
115  for (li=loop_indices,n=0;!VECTEUR_NUL_P(li);n++,li = li->succ);
116  for (ti=tile_indices,m=0;
117  !VECTEUR_NUL_P(ti);
118  sc->base = vect_add_variable(sc->base,(char *) ti->var),
119  sc->dimension++,m++,ti = ti->succ);
120  to = (Pvecteur)tiling_origin(t);
121  td = tile_delay;
122 
123  for (i=1,lti =tile_local_indices, li = loop_indices;
124  i<=n;
125  i++,
126  sc->base = vect_add_variable(sc->base,(Variable) lti->var),
127  sc->dimension++,lti = lti->succ,li=li->succ) {
128  j=1;
129  ti = tile_indices;
130  pv = vect_new(vecteur_var(lti),VALUE_ONE);
132  for (j=1;j<=m; j++,ti = ti->succ) {
133  if (value_ne(ACCESS(P,n,i,j),VALUE_CONST(999))) {
134  vect_add_elem(&pv,vecteur_var(ti), ACCESS(P,n,i,j));
135  if (value_notzero_p(val = vect_coeff(li->var,td)))
136  vect_add_elem(&pv,TCST,
137  value_uminus(value_mult(val,ACCESS(P,n,i,j))));
138  } else {
140  sc_add_egalite(sc,
142  VALUE_ONE)));
143  }
144  }
145  if (value_notzero_p(val = vect_coeff(li->var,to)))
146  vect_add_elem(&pv,TCST,val);
147  pc= contrainte_make(pv);
148  sc_add_egalite(sc,pc);
149  }
150 
151  /* build the constraints min (=0) <= lti <= max (=ls-1) */
152  for ( j=1,lti= tile_local_indices;
153  !VECTEUR_NUL_P(lti) ;
154  lti = lti->succ,j++) {
155  min = ACCESS(P,n,1,j);
156  max = ACCESS(P,n,1,j);
157  for (i=1;i<=n;i++) {
158  Value a = ACCESS(P,n,i,j);
159  value_minimum(min, a);
160  value_maximum(max, a);
161  }
162  pv = vect_new(vecteur_var(lti), VALUE_MONE);
164  pc = contrainte_make(pv);
165  sc_add_ineg(sc,pc);
166  pv = vect_new(vecteur_var(lti), VALUE_ONE);
168  pc = contrainte_make(pv);
169  sc_add_ineg(sc,pc);
170  }
171 
172  /* build the constraints 0 <= ti */
173  for (ti =tile_indices; !VECTEUR_NUL_P(ti); ti = ti->succ) {
174  pv = vect_new(vecteur_var(ti), VALUE_MONE);
175  pc = contrainte_make(pv);
176  sc_add_ineg(sc,pc);
177  }
178  ifdebug(8) { fprintf(stderr,"TILE SYSTEM:\n");
180  }
181  debug(8,"loop_bounds_to_tile_bounds","end\n");
182  debug_off();
183  return(sc);
184 }
#define value_maximum(ref, val)
#define VALUE_CONST(val)
#define value_uminus(val)
unary operators on values
#define value_ne(v1, v2)
#define value_minimum(ref, val)
#define min(a, b)
#define max(a, b)
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
Value * matrice
package matrice
Definition: matrice-local.h:71
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
void sc_force_variable_to_zero(Psysteme ps, Variable var)
void sc_force_variable_to_zero(Psysteme ps, Variable var): force la variable var a prendre la valeur ...
Definition: sc_eval.c:251
#define tiling_origin(x)
Definition: tiling.h:70
#define tiling_tile(x)
Definition: tiling.h:68
struct Svecteur * Pvecteur

References ACCESS, Ssysteme::base, contrainte_make(), debug(), debug_off, debug_on, Ssysteme::dimension, entity_local_name(), fprintf(), ifdebug, max, min, sc_add_egalite(), sc_dup(), sc_force_variable_to_zero(), sc_fprint(), Svecteur::succ, TCST, tiling_origin, tiling_tile, VALUE_CONST, value_maximum, value_minimum, value_minus, VALUE_MONE, value_mult, value_ne, value_notzero_p, VALUE_ONE, value_uminus, VALUE_ZERO, Svecteur::var, vect_add_elem(), vect_add_variable(), vect_coeff(), vect_new(), VECTEUR_NUL_P, and vecteur_var.

Referenced by loop_nest_to_wp65_code().

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

◆ lower_bound_generation()

expression lower_bound_generation ( Psysteme  sc_neg,
Pbase  index_base,
int  number_of_lower_bounds,
int  loop_rank 
)

bound_generation.c

bound_generation.c

this condition is true if the constraint constrains directly the variable

In that case the bound expression results from the combination of two constraints. The variable of rank "higher_rank" will be eliminated from these two constraints in order to give only one bound for the "loop_rank" index.

Parameters
sc_negc_neg
index_basendex_base
number_of_lower_boundsumber_of_lower_bounds
loop_rankoop_rank

Definition at line 56 of file bound_generation.c.

60 {
61  Pcontrainte ineq;
62  Variable var = variable_of_rank(index_base,loop_rank);
63  Pvecteur pv2 = VECTEUR_NUL;
64  expression expr,ex1,ex2, lower=expression_undefined ;
65  cons * lex2,* lexpr = NIL;
67  int higher_rank,nlb = 0;
68  Value coeff;
69  bool reductible = false;
70 
71  debug_on("MOVEMENT_DEBUG_LEVEL");
72  debug(8,"lower_bound_generation","begin\n");
73 
74  if (number_of_lower_bounds>=1) {
75  for (ineq = sc_neg->inegalites;
76  !CONTRAINTE_UNDEFINED_P(ineq);
77  ineq=ineq->succ) {
78  Variable var2;
79  Value coeff2,coeff3;
80  reductible = false;
81  higher_rank=search_higher_rank(ineq->vecteur,index_base);
82  if (higher_rank > loop_rank ) {
83  Pcontrainte pc2 = ineq->succ;
84  var2 = variable_of_rank(index_base,higher_rank);
85  coeff2 = vect_coeff(var2,ineq->vecteur);
86  coeff3 = vect_coeff(var2,pc2->vecteur);
87 
88  if (value_one_p(value_abs(coeff2)) ||
89  value_one_p(value_abs(coeff3))) {
90  reductible = true;
91  pv2 = vect_cl2(value_abs(coeff2),pc2->vecteur,
92  value_abs(coeff3),ineq->vecteur);
93  ineq= ineq->succ;
94  }
95  }
96  else pv2 = vect_dup(ineq->vecteur);
97  if (higher_rank <= loop_rank || reductible ) {
98  /* this condition is true if the constraint constrains
99  directly the variable */
100  if (value_notmone_p(coeff= vect_coeff(var,pv2)))
101  vect_add_elem(&pv2, TCST,
103  vect_chg_coeff(&pv2,var,VALUE_ZERO);
104  expr = ex1 = make_vecteur_expression(pv2);
105  if (value_notmone_p(coeff)) {
106  ex2 = int_to_expression(
107  VALUE_TO_INT(value_abs(coeff)));
108  lex2 =CONS(EXPRESSION,ex2,NIL);
109  expr=make_div_expression(ex1,lex2);
110  vect_add_elem(&pv2,TCST,value_plus(coeff,VALUE_ONE));
111  }
112  }
113  else {
114  /* In that case the bound expression results from
115  the combination of two constraints. The variable of
116  rank "higher_rank" will be eliminated from these two
117  constraints in order to give only one bound for
118  the "loop_rank" index. */
119  expr = complex_bound_computation(sc_neg,index_base,
120  ineq,ineq->succ,
121  higher_rank);
122  ineq = ineq->succ;
123 
124  }
125  lexpr = CONS(EXPRESSION, expr,lexpr);
126  nlb ++;
127  }
128  if (nlb > 1)
129  lower = make_op_expression(max,lexpr);
130  else lower = EXPRESSION(CAR(lexpr));
131  }
132  debug(8,"lower_bound_generation","end\n");
133  debug_off();
134 
135  return(lower);
136 }
#define VALUE_TO_INT(val)
#define value_one_p(val)
#define value_notmone_p(val)
#define value_abs(val)
expression complex_bound_computation(Psysteme __attribute__((unused)) sc, Pbase index_base, Pcontrainte ineq1, Pcontrainte ineq2, int rank)
Compute the complex bounds associated to the variable of higher rank, after the variable "el_var" of ...
expression make_div_expression(expression, cons *)
operation.c
Definition: operation.c:42
expression make_op_expression(entity, cons *)
Definition: operation.c:55
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
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define expression_undefined
Definition: ri.h:1223
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
Pvecteur vect_cl2(Value x1, Pvecteur v1, Value x2, Pvecteur v2)
Definition: binaires.c:247
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, complex_bound_computation(), CONS, CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, EXPRESSION, expression_undefined, Ssysteme::inegalites, int_to_expression(), local_name_to_top_level_entity(), make_div_expression(), make_op_expression(), make_vecteur_expression(), max, NIL, search_higher_rank(), Scontrainte::succ, TCST, value_abs, value_notmone_p, VALUE_ONE, value_one_p, value_plus, VALUE_TO_INT, value_uminus, VALUE_ZERO, variable_of_rank(), vect_add_elem(), vect_chg_coeff(), vect_cl2(), vect_coeff(), vect_dup(), Scontrainte::vecteur, and VECTEUR_NUL.

Referenced by bound_generation(), and make_movements_loop_body_wp65().

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

◆ make_datum_movement()

statement make_datum_movement ( entity  module,
bool  receive_code,
entity  ent,
Pbase  local_indices,
Pbase  var_id 
)

statement make_datum_movement(module,receive_code,ent, local_indices,var_id)

This function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the Pvecteur belonging Prod_id if bank_code and Bank_id otherwise

build the list of expressions : Prod_id,ES_A(L,O),1 for bank case and Bank_id,L_A(LJ,LI),1 for engine case

generate the send or the receive call

Parameters
moduleodule
receive_codeeceive_code
entThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices is true if the code is generated for receive

Parameters
local_indicesThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the shared entiy if bank_code and to the local entity otherwise

Parameters
var_idThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

BANK_/WP65_ send/receive_nb_bytes(ES_A,O,1,L,Prod_id) ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

BANK_/WP65_send/receive_nb_bytes(L_A,LI,1,LJ,Bank_id)

L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices correspond to O,L if bank_code and to LJ,LI otherwise

Definition at line 401 of file make_loop_body.c.

410 {
411 
412  expression exp_ent;
413  statement lbody;
414  Pvecteur ofs = local_indices;
415  Pvecteur pvt =VECTEUR_NUL;
416  entity operator_receive,operator_send;
417  cons * args, * args2;
418  type tp = entity_type(ent);
419  int nb_bytes = 0;
420  char *str1;
421  debug_on("MOVEMENT_DEBUG_LEVEL");
422  debug(8,"make_datum_movement","begin\n");
423 
424  if (type_variable_p(tp)) {
425  variable var = type_variable(tp);
426  basic b = variable_basic(var);
427  nb_bytes = SizeOfElements(b);
428  }
429 
430  str1=int2a(nb_bytes);
431  operator_receive = find_operator(module, "RECEIVE",str1);
432  operator_send = find_operator(module,"SEND",str1);
433  free(str1);
434 
435  /* build the list of expressions :
436  Prod_id,ES_A(L,O),1 for bank case and
437  Bank_id,L_A(LJ,LI),1 for engine case
438  */
439 
441  pvt =(!VECTEUR_NUL_P(ofs->succ)) ?
445 
447  pvt =vect_new(vecteur_var(ofs),VALUE_ONE);
450  args2);
451 
453  make_reference(ent,
454  args2
455  )),
457 
458  args = CONS(EXPRESSION,exp_ent,args);
459  args = CONS(EXPRESSION,make_vecteur_expression(vect_dup(var_id)),args);
460  /* generate the send or the receive call */
461 
462  lbody = (receive_code) ?
463  make_statement_operator(operator_receive,args):
464  make_statement_operator(operator_send,args);
465 
466  debug(8,"make_datum_movement","end\n");
467  debug_off();
468  return (lbody);
469 
470 }
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
Value offset_dim1
include "generation.h"
Definition: code.c:67
statement make_statement_operator(entity oper, cons *args)
entity find_operator(entity module, string oper, string str)
Value offset_dim2
Definition: code.c:68
_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 normalized_undefined
Definition: ri.h:1745
@ is_syntax_reference
Definition: ri.h:2691
#define variable_basic(x)
Definition: ri.h:3120
char * int2a(int)
util.c
Definition: util.c:42

References CONS, debug(), debug_off, debug_on, entity_type, EXPRESSION, find_operator(), free(), int2a(), int_to_expression(), is_syntax_reference, make_expression(), make_reference(), make_statement_operator(), make_syntax(), make_vecteur_expression(), module, NIL, normalized_undefined, offset_dim1, offset_dim2, SizeOfElements(), Svecteur::succ, TCST, type_variable, type_variable_p, VALUE_ONE, variable_basic, vect_add(), vect_add_elem(), vect_dup(), vect_new(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

Referenced by bound_generation().

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

◆ make_div_expression()

expression make_div_expression ( expression  ex1,
cons ex2 
)

operation.c

Parameters
ex1x1
ex2x2

Definition at line 42 of file operation.c.

43 {
45 
46  return(make_expression(
48  make_call(div,
50  ex1,ex2))
52 }
call make_call(entity a1, list a2)
Definition: ri.c:269
@ is_syntax_call
Definition: ri.h:2693

References CONS, EXPRESSION, is_syntax_call, local_name_to_top_level_entity(), make_call(), make_expression(), make_syntax(), and normalized_undefined.

Referenced by array_indices_communication(), complex_bound_generation(), lower_bound_generation(), test_bound_generation(), and upper_bound_generation().

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

◆ make_loop_indice_equation()

Pvecteur make_loop_indice_equation ( Pbase  loop_indices,
tiling  tile,
Pvecteur  tile_delay,
Pvecteur  tile_indices,
Pvecteur  tile_local_indices,
int  rank 
)

build_sc_tile.c

build_sc_tile.c

Corinne Ancourt - septembre 1991

Parameters
loop_indicesoop_indices
tileile
tile_delayile_delay
tile_indicesile_indices
tile_local_indicesile_local_indices
rankank

Definition at line 51 of file build_sc_tile.c.

58 {
59  matrice P= (matrice) tiling_tile(tile);
60  Pvecteur to = (Pvecteur)tiling_origin(tile);
61  Pvecteur pv;
62  Pvecteur lti,li,ti= tile_indices;
63  int m = vect_size(loop_indices);
64  int n= m;
65  int i,j;
66  Value val;
67  for (i=1,lti =tile_local_indices, li = loop_indices; i<rank;
68  lti =lti->succ,li= li->succ, i++);
70 
71  for (j=1;j<=m; j++,ti = ti->succ) {
72  if (value_ne(ACCESS(P,n,i,j),VALUE_CONST(999))) {
73  vect_add_elem(&pv,vecteur_var(ti), ACCESS(P,n,i,j));
74  if (value_notzero_p(val = vect_coeff(li->var, tile_delay)))
75  vect_add_elem(&pv,TCST,
76  value_uminus(value_mult(val,ACCESS(P,n,i,j))));
77  }
78  }
79  if (value_notzero_p(val = vect_coeff(li->var,to)))
80  vect_add_elem(&pv,TCST,val);
81  ifdebug(8) {
82  fprintf(stderr, "Equation defining the tiling\n");
83  vect_dump(pv);
84  }
85  return(pv);
86 }
void vect_dump(Pvecteur v)
void vect_dump(Pvecteur v): print sparse vector v on stderr.
Definition: io.c:304
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...
Definition: alloc.c:165

References ACCESS, fprintf(), ifdebug, rank, Svecteur::succ, TCST, tiling_origin, tiling_tile, VALUE_CONST, value_mult, value_ne, value_notzero_p, VALUE_ONE, value_uminus, VALUE_ZERO, Svecteur::var, vect_add_elem(), vect_coeff(), vect_dump(), vect_make(), vect_size(), and vecteur_var.

Referenced by array_indices_communication(), and reference_conversion_computation().

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

◆ make_movement_scalar_wp65()

statement make_movement_scalar_wp65 ( entity  module,
bool  receive_code,
reference  r,
entity  var_id 
)

statement make_movement_scalar_wp65(receive_code,r)

This function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

call BANK_/WP65_send/receive_nb_bytes(S)

In the case of engine code generation the loop body must be :

call BANK_/WP65_send/receive_nb_bytes(S)

where nb_bytes is the number of bytes needed for the variable location

nb_bytes is the number of bytes needed for the variable location

build the expression : S

args = CONS(EXPRESSION,int_expr(nb_bytes),NIL);

generate the send or the receive call

Parameters
moduleodule
receive_codeeceive_code
rThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
In the case of engine code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
where nb_bytes is the number of bytes needed for the variable location is true if the code is generated for receive
var_idThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
In the case of engine code generation the loop body must be :
call BANK_/WP65_send/receive_nb_bytes(S)
where nb_bytes is the number of bytes needed for the variable location corresponds to scalaire entity

Definition at line 485 of file make_loop_body.c.

490 {
491 
492  statement lbody;
493  cons * args;
494  expression expr;
495  list lexp1;
496  entity
497  operator_receive, operator_send,
498  var = reference_variable(r);
499  type t;
500  int nb_bytes=4; /* nb_bytes is the number of bytes
501  needed for the variable location */
502  basic bas;
503  char *str1;
504 
505  debug_on("MOVEMENT_DEBUG_LEVEL");
506  pips_debug(8, "begin\n");
507  pips_debug(8, "considering %s\n", entity_local_name(var));
508 
509  t = entity_type(var);
510 
511  if (type_variable_p(t)) {
512  variable var = type_variable(t);
513  bas = variable_basic(var);
514  nb_bytes = SizeOfElements(bas);
515  }
516  str1=int2a(nb_bytes);
517  operator_receive = find_operator(module, "RECEIVE",str1);
518  operator_send = find_operator(module,"SEND",str1);
519  free(str1);
520 
521  /* build the expression : S */
522  /* args = CONS(EXPRESSION,int_expr(nb_bytes),NIL);*/
523 
527  args = CONS(EXPRESSION,expr,lexp1);
528  args = CONS(EXPRESSION,
530  VALUE_ONE)),args);
531  /* generate the send or the receive call */
532 
533  lbody = (receive_code) ?
534  make_statement_operator(operator_receive,args):
535  make_statement_operator(operator_send,args);
536  ifdebug(9) {
537  pips_debug(9, "returning :\n");
539  }
540 
541  pips_debug(8,"end\n");
542  debug_off();
543  return (lbody);
544 
545 }
#define reference_variable(x)
Definition: ri.h:2326

References CONS, debug_off, debug_on, entity_local_name(), entity_type, entity_undefined, EXPRESSION, find_operator(), free(), ifdebug, int2a(), int_to_expression(), is_syntax_reference, make_expression(), make_statement_operator(), make_syntax(), make_vecteur_expression(), module, NIL, normalized_undefined, pips_debug, reference_variable, SizeOfElements(), type_variable, type_variable_p, VALUE_ONE, variable_basic, vect_new(), and wp65_debug_print_text().

Referenced by constant_symbolic_communication(), make_load_blocks(), and make_store_blocks().

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

◆ make_movements_loop_body_wp65()

statement make_movements_loop_body_wp65 ( entity  module,
bool  receive_code,
entity  ent,
Pbase  local_indices,
Pbase  var_id,
Psysteme  sc_neg,
Psysteme  sc_pos,
Pbase  index_base,
int  rank,
int  number_of_lower_bounds,
int  number_of_upper_bounds 
)

statement make_movements_loop_body_wp65(module,receive_code, ent,local_indices,var_id, sc_neg,sc_pos,index_base,rank, number_of_lower_bounds, number_of_upper_bounds)

This function generates the loop body of the movement code. In the case of bank code generation the loop body must be :

O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)

ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices

create the new indices new_ind1 et new_ind2 corresponding to LI1 et LI2 when the code is generated for engines and O1 et O2 when code is generated for banks vecteur_var(ofs) is respectivly LI or O

build the expression new_ind2 - new_ind1+1

build the list of expressions : Prod_id,ES_A(L,O1),O2-O1+1 for bank case and Bank_id,L_A(LJ,LI1),LI2-LI1+1 for engine case

generate the send or the receive call

build the test around stat

if (pmin == INT_MIN || pmax == INT_MAX || pmax > pmin) {

}

build the whole code:

O1 = ..... O2 = ..... IF (O1.LE.O2) THEN BANK_/WP65_send/receive(Prod_id,ES_A(L,O1),O2-O1+1) for bank case or: LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive(Bank_id,L_A(LJ,LI1),LI2-LI1+1) for engine case

Parameters
moduleodule
receive_codeeceive_code
entThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices is true if the code is generated for receive

Parameters
local_indicesThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the shared entiy if bank_code and to the local entity otherwise

Parameters
var_idThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices correspond to O,L if bank_code and to LI,LJ otherwise

Parameters
sc_negThis function generates the loop body of the movement code. In the case of bank code generation the loop body must be :
O1 = .....
O2 = .....
IF (O1.LE.O2) THEN
BANK_/WP65_send/receive_nb_bytes(Prod_id,ES_A(L,O1),O2-O1+1)
ES_A is the emulated shared variable given as entity ent. Prod_id is the Processeur id. given as a Pvecteur in var_id. O and L are the local indices for the bank passed like Pbase in local_indices.

In the case of engine code generation the loop body must be :

LI1 = .... LI2 = .... IF (LI1.LE.LI2) THEN BANK_/WP65_send/receive_nb_bytes(Bank_id,L_A(LJ,LI1),LI2-LI1+1) L_A is the local variable given as entity in ent. Bank_id is the bank id, given as Pvecteur in var_id. LJ, and LI are the local indices passed like Pbase in local_indices corresponds to the Pvecteur belonging Prod_id if bank_code and Bank_id otherwise

Parameters
sc_posc_pos
index_basendex_base
rankank
number_of_lower_boundsumber_of_lower_bounds
number_of_upper_boundsumber_of_upper_bounds

Definition at line 182 of file make_loop_body.c.

195 {
196  expression lower_bound,upper_bound;
197  expression expr_ind1,expr_ind2,expr,expr2,exp_ent,expr_cond;
198  entity new_ind1,new_ind2, mod;
199  entity operator_assign,operator_minus,operator_plus,operator_le,
200  operator_receive,operator_send;
201  string lower_or_equal;
202  statement stat,stat1,stat2,lbody;
203  Pvecteur pvt,ofs = local_indices;
204  type tp = entity_type(ent);
205  Value pmin,pmax;
206  int nb_bytes = 0;
207  text t;
208  test test1;
209  cons * args, * args2, * lex2, * lex3;
210  char *str1;
211  Psysteme sctmp=NULL;
212  debug_on("MOVEMENT_DEBUG_LEVEL");
213  debug(8,"make_movements_loop_body_wp65","begin\n");
214 
215  operator_assign=
218  entity_domain);
219 
220  operator_minus=
223  entity_domain);
224  operator_plus=
227  entity_domain);
228 
229  if (type_variable_p(tp)) {
230  variable var = type_variable(tp);
231  basic b = variable_basic(var);
232  nb_bytes = SizeOfElements(b);
233  }
234 
235  str1=int2a(nb_bytes);
236  operator_receive = find_operator(module, "RECEIVE",str1);
237  operator_send = find_operator(module,"SEND",str1);
238  free(str1);
239 
240  ofs = local_indices;
241 
242  /* create the new indices new_ind1 et new_ind2 corresponding to
243  LI1 et LI2 when the code is generated for engines
244  and O1 et O2 when code is generated for banks
245  vecteur_var(ofs) is respectivly LI or O */
246 
247 
248 
250  expr_ind1 = make_vecteur_expression(vect_new((char *) new_ind1,
251  vecteur_val(ofs)));
252 
254  expr_ind2 = make_vecteur_expression(vect_new((char *) new_ind2,
255  vecteur_val(ofs)));
256 
257  /* build the expression new_ind2 - new_ind1+1 */
258 
259  lex2 = CONS(EXPRESSION,expr_ind1,NIL);
260  expr = make_op_expression(operator_minus,
261  CONS(EXPRESSION,expr_ind2,lex2));
262 
264  expr2 = make_op_expression(operator_plus,
265  CONS(EXPRESSION,expr,lex2));
266 
267  /* build the list of expressions :
268  Prod_id,ES_A(L,O1),O2-O1+1 for bank case and
269  Bank_id,L_A(LJ,LI1),LI2-LI1+1 for engine case
270 
271  */
272 
273  args = CONS(EXPRESSION,expr2,NIL);;
274  pvt =vect_new((char *) new_ind1, vecteur_val(ofs));
276 
277  expr_ind1 = make_vecteur_expression(pvt);
278 
279  pvt =(!VECTEUR_NUL_P(ofs->succ)) ?
283  args2 = CONS(EXPRESSION,
285  NIL);
286  args2 = CONS(EXPRESSION,expr_ind1,args2);
288  make_reference(ent,
289  args2
290  )),
292  args = CONS(EXPRESSION,exp_ent,args);
293  args = CONS(EXPRESSION,make_vecteur_expression(vect_dup(var_id)),args);
294 
295  /* generate the send or the receive call */
296 
297  stat =(receive_code) ? make_statement_operator(operator_receive,args)
298  : make_statement_operator(operator_send,args);
299 
300  /* build the test around stat */
301 
302  sctmp = sc_dup(sc_pos);
303  sctmp = sc_append(sctmp,sc_neg);
304 
305 
306  (void)sc_minmax_of_variable(sctmp, vecteur_var(ofs), &pmin, &pmax);
307  ifdebug(4) {
308  fprint_string_Value(stderr, "borne min ", pmin);
309  fprint_string_Value(stderr, ", borne sup ", pmax);
310  fprintf(stderr,"\n");
311  }
312  /* if (pmin == INT_MIN || pmax == INT_MAX || pmax > pmin) { */
314 
315  expr_ind1 = make_vecteur_expression(vect_new((char *) new_ind1,
316  vecteur_val(ofs)));
317 
319  expr_ind2 = make_vecteur_expression(vect_new((char *) new_ind2,
320  vecteur_val(ofs)));
321 
322 
323  lower_or_equal = concatenate(TOP_LEVEL_MODULE_NAME,
324  MODULE_SEP_STRING,".LE.", NULL);
325 
326  if ((operator_le =
327  gen_find_tabulated(lower_or_equal, entity_domain))
328  == entity_undefined)
330  lower_or_equal);
331  expr_cond = MakeBinaryCall(operator_le,expr_ind1,expr_ind2);
332 
333  test1 = make_test(expr_cond,stat,make_continue_statement(entity_empty_label()));
334  stat = test_to_statement(test1);
335  /* }*/
336  /* build the whole code:
337 
338  O1 = .....
339  O2 = .....
340  IF (O1.LE.O2) THEN
341  BANK_/WP65_send/receive(Prod_id,ES_A(L,O1),O2-O1+1) for bank case
342  or:
343  LI1 = ....
344  LI2 = ....
345  IF (LI1.LE.LI2) THEN
346  BANK_/WP65_send/receive(Bank_id,L_A(LJ,LI1),LI2-LI1+1) for engine case */
347  expr_ind1 = make_vecteur_expression(vect_new((char *) new_ind1,
348  vecteur_val(ofs)));
349  expr_ind2 = make_vecteur_expression(vect_new((char *) new_ind2,
350  vecteur_val(ofs)));
351  lower_bound = lower_bound_generation(sc_neg,index_base,
352  number_of_lower_bounds,
353  rank);
354  lex2 = CONS(EXPRESSION,lower_bound,NIL);
355  stat1 = make_statement_operator(operator_assign,
356  CONS(EXPRESSION,expr_ind1,lex2));
357 
358  upper_bound = upper_bound_generation(sc_pos,index_base,
359  number_of_upper_bounds,
360  rank);
361 
362  lex2 = CONS(EXPRESSION,upper_bound,NIL);
363  stat2 = make_statement_operator(operator_assign,
364  CONS(EXPRESSION,expr_ind2,lex2));
365  lex2 = CONS(STATEMENT,stat,NIL);
366  lex3 = CONS(STATEMENT,stat2,lex2);
367 
368  lbody = make_block_statement(CONS(STATEMENT,stat1,lex3));
369  ifdebug(8) {
371  t = Text_Statement(mod, 2, lbody);
372  print_text(stderr,t);
373  }
374  debug(8,"make_movements_loop_body_wp65","end\n");
375  debug_off();
376 
377 
378  return (lbody);
379 
380 }
string make_entity_fullname(const char *module_name, const char *local_name)
END_EOLE.
Definition: entity_names.c:230
static entity find_entity(entity module, Pvecteur pv, string st)
#define SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP
#define SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP
text Text_Statement(entity, int, statement)
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define ASSIGN_OPERATOR_NAME
Definition: ri-util-local.h:95
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
Definition: entity.c:1586
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
bool sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, Value *pmax)
void sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour tr...
Definition: sc_eval.c:143
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
void print_text(FILE *fd, text t)
Definition: print.c:195
#define vecteur_val(v)

References ASSIGN_OPERATOR_NAME, concatenate(), CONS, debug(), debug_off, debug_on, entity_domain, entity_empty_label(), entity_local_name(), entity_type, entity_undefined, EXPRESSION, find_entity(), find_operator(), FindOrCreateEntity(), fprint_string_Value(), fprintf(), free(), gen_find_tabulated(), ifdebug, int2a(), int_to_expression(), is_syntax_reference, local_name_to_top_level_entity(), lower_bound_generation(), make_block_statement(), make_continue_statement(), make_entity_fullname(), make_expression(), make_op_expression(), make_reference(), make_statement_operator(), make_syntax(), make_test(), make_vecteur_expression(), MakeBinaryCall(), MINUS_OPERATOR_NAME, module, MODULE_SEP_STRING, NIL, normalized_undefined, offset_dim1, offset_dim2, PLUS_OPERATOR_NAME, print_text(), rank, sc_append(), sc_dup(), sc_minmax_of_variable(), SizeOfElements(), STATEMENT, Svecteur::succ, SUFFIX_FOR_TEMP_VAR1_IN_INNER_LOOP, SUFFIX_FOR_TEMP_VAR2_IN_INNER_LOOP, TCST, test_to_statement, Text_Statement(), TOP_LEVEL_MODULE_NAME, type_variable, type_variable_p, upper_bound_generation(), VALUE_ONE, variable_basic, vect_add(), vect_add_elem(), vect_dup(), vect_new(), VECTEUR_NUL_P, vecteur_val, and vecteur_var.

Referenced by bound_generation().

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

◆ make_op_expression()

expression make_op_expression ( entity  op,
cons ex2 
)
Parameters
opp
ex2x2

Definition at line 55 of file operation.c.

56 {
58  make_call(op,ex2)),
60 }

References is_syntax_call, make_call(), make_expression(), make_syntax(), and normalized_undefined.

Referenced by complex_bound_generation(), lower_bound_generation(), make_movements_loop_body_wp65(), test_bound_generation(), and upper_bound_generation().

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

◆ make_statement_operator()

statement make_statement_operator ( entity  oper,
cons args 
)
Parameters
operper
argsrgs

Definition at line 138 of file make_loop_body.c.

139 {
145  make_call (oper, args)),
146  NIL,
147  NULL,
149 }
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
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
synchronization make_synchronization_none(void)
Definition: ri.c:2424
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define string_undefined
Definition: newgen_types.h:40
#define STATEMENT_NUMBER_UNDEFINED
default values
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
@ is_instruction_call
Definition: ri.h:1474

References empty_extensions(), entity_empty_label(), is_instruction_call, make_call(), make_instruction(), make_statement(), make_synchronization_none(), NIL, STATEMENT_NUMBER_UNDEFINED, STATEMENT_ORDERING_UNDEFINED, and string_undefined.

Referenced by make_datum_movement(), make_movement_scalar_wp65(), and make_movements_loop_body_wp65().

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

◆ movement_computation()

statement movement_computation ( entity  module,
bool  used_def,
bool  bank_code,
bool  receive_code,
entity  private_entity,
Psysteme  sc_image,
Pbase  const_base,
Pbase  bank_indices,
Pbase  tile_indices,
Pbase  ppid,
Pbase  loop_body_indices,
int  n,
int  dim_h 
)

Calcul des nouvelles bornes des boucles et de la nouvelle fonction d'acces a une reference d'un tableau permettant d'exprimer l'ensemble des elements references dans une base.

Cette base est pour le moment la base de Hermite associee a la fonction d'acces au tableau

constains the list of variables for which integer projection might be necessary

constains the variables remaining in the system after all the projections i.e. constants, index loops. It is usefull to project (FM) on these variables at the end for collecting more informations on variables and to eliminate redundant constraints

corresponds to the loop indices of the generated code. Then it is Bank_id, LJ,L,LI in case of engine code and Bank_id, LJ,L,O in case of bank code

contains the local indices O and L if it is the generation of bank code and LI, LJ if it is for engine code

int sc_info[sc_image->dimension+1][3]; // this is NOT ANSI C

added

Translate each entity in its appropriated entity full name for generating module code

allocation d'un tableau de systemes et d'une table contenant des infos sur ces systemes

update the different basis

Projection on each variable having unity coefficients in the system

Projection on the others variables having to be eliminated from the system. In case of Copy-in local memory code generation, the FM projection algorithm is used. For Copy-back code generation interger projection algorithm is used.

vect_chg_coeff(&lvar_coeff_nunit,vecteur_var(pv1),0);

Computation of sample constraints contraining only index variables

why 11?

ore restrictive system

Elimination of redundant constraints for integer systems

Constraints distribution. Lsc[i] will contain all constraints contraining the i-th index variable

Computation of constraints contraining symbolic constants

Elimination of constraints redundant in list_of_systems[i] with the "symbolic constant system"

if you get through this pp, it core dumps much later on:-)

Parameters
moduleodule
used_defsed_def
bank_codeank_code
receive_codeis true if it is the generation of code for bank false if it is for engine
private_entityis true if the generated code must be a RECEIVE, false if it must be a SEND
sc_imagelocal entity
const_basedomain of image
bank_indicesank_indices
tile_indicescontains the index describing the bank: bank_id, L (ligne of bank) and O (offset in the ligne)
ppidcontains the local indices LI, LJ,.. of tile
loop_body_indicesoop_body_indices
ncontains the loop indices situated in the tile
dim_him_h

Definition at line 321 of file movement_computation.c.

340 {
341  Psysteme sc_proj,*list_of_systems,sc_proj2,sc_image2,sc_on_constants;
343  Pvecteur lvar_coeff_nunit = VECTEUR_NUL;
344  /* constains the list of variables for which integer projection
345  might be necessary */
346  Pvecteur lvar_coeff_unit= VECTEUR_NUL;
347 
348  Pbase lindex = BASE_NULLE;
349  /* constains the variables remaining in the system after all the
350  projections i.e. constants, index loops. It is usefull to project (FM)
351  on these variables at the end for collecting more informations on
352  variables and to eliminate redundant constraints */
353 
354  Pbase image_base=BASE_NULLE;
355  /* corresponds to the loop indices of the generated code. Then it is
356  Bank_id, LJ,L,LI in case of engine code
357  and Bank_id, LJ,L,O in case of bank code */
358 
359 
360  Pbase loop_body_offsets;
361  /* contains the local indices O and L if it is the generation of bank
362  code and LI, LJ if it is for engine code */
363 
364  Pbase index_base=BASE_NULLE;
365  Pbase const_base2;
366  Pbase var_id;
367  int dim_h2= dim_h;
368  unsigned space;
369 #define maxscinfosize 100
370  /* int sc_info[sc_image->dimension+1][3]; // this is NOT ANSI C */
371  int sc_info[maxscinfosize][4];
372  int i;
373  Pvecteur pv1= NULL;
374  Pbase btmp = BASE_NULLE;
375  debug_on("MOVEMENT_DEBUG_LEVEL");
376  debug(3,"movement_computation","begin\n");
377 
378  assert(sc_image->dimension<maxscinfosize); /* added */
379 
380  /* Translate each entity in its appropriated entity full name
381  for generating module code */
382 
384  sc_image = sc_variables_rename(sc_image, bank_indices, btmp,
386  sc_image = sc_variables_rename(sc_image, const_base, btmp,
388  sc_image = sc_variables_rename(sc_image,tile_indices, btmp,
390  bank_indices= vect_rename(bank_indices, btmp,
392  tile_indices= vect_rename(tile_indices, btmp,
394  const_base= vect_rename(const_base, btmp,
396  ppid = vect_rename(ppid, btmp,
398 
399  const_base2 =base_dup(const_base);
400  sc_image2 = sc_dup(sc_image);
401  sc_proj = sc_dup(sc_image2);
402  n = sc_image2->dimension;
403 
404  /* allocation d'un tableau de systemes et d'une table
405  contenant des infos sur ces systemes*/
406 
407  space = (n+1) * sizeof(Ssysteme);
408  list_of_systems = (Psysteme *) malloc((unsigned) space);
409  /* update the different basis */
410 
411  update_basis(sc_image2->base,&index_base,&const_base2,&image_base,
412  bank_indices,tile_indices,&lindex,&lvar_coeff_nunit,
413  &lvar_coeff_unit,&loop_body_offsets,&loop_body_indices,
414  bank_code,ppid);
415 
416 
417  dim_h2 = vect_size(image_base);
418 
419  sys_debug(2, "Domain before Projection :\n",sc_proj);
420 
421  /* Projection on each variable having unity coefficients in the system */
422 
423  for (pv1 = lvar_coeff_unit;!VECTEUR_UNDEFINED_P(pv1);pv1=pv1->succ) {
424  if (var_with_unity_coeff_p(sc_proj,vecteur_var(pv1))) {
425  sc_proj = sc_projection(sc_proj,vecteur_var(pv1));
426  sc_proj= sc_normalize(sc_proj);
427  vect_chg_coeff(&lvar_coeff_nunit,vecteur_var(pv1),0);
428  }
429  }
430 
431  sys_debug(2, " After FM projection :\n", sc_proj);
432 
433  sc_proj->inegalites = contrainte_sort(sc_proj->inegalites,
434  sc_proj->base, index_base,
435  true,false);
436  ifdebug(2) {
437  pips_debug(2," After FM projection and sort:\n");
438  sc_fprint(stderr, sc_proj, (get_variable_name_t) entity_local_name);
439  }
440 
441  /* Projection on the others variables having to be eliminated from
442  the system. In case of Copy-in local memory code generation, the
443  FM projection algorithm is used. For Copy-back code generation
444  interger projection algorithm is used.*/
445 
446  if (!used_def)
447  sc_proj = sc_integer_projection_along_variables(
448  sc_image2,sc_proj, index_base, lvar_coeff_nunit, sc_info,dim_h2,n);
449  else {
450  for (pv1 = lvar_coeff_nunit;!VECTEUR_UNDEFINED_P(pv1);pv1=pv1->succ) {
451  sc_proj = sc_projection(sc_proj,vecteur_var(pv1));
452  sc_proj= sc_normalize(sc_proj);
453  }
454  /* vect_chg_coeff(&lvar_coeff_nunit,vecteur_var(pv1),0);*/
455 
456  }
457 
458  ifdebug(2) {
459  sys_debug(2," Before contrainte sort :\n",sc_proj);
460  pips_debug(2," Base index :\n");
461  vect_fprint(stderr, index_base, (get_variable_name_t) entity_local_name);
462  }
463  sc_proj->inegalites = contrainte_sort(sc_proj->inegalites,
464  sc_proj->base, index_base,
465  true,false);
466 
467  sys_debug(5," After contrainte sort:\n",sc_proj);
468 
469  build_sc_nredund_1pass(&sc_proj);
470 
471  sys_debug(5,"After Integer Projection :\n",sc_proj);
472 
473  /* Computation of sample constraints contraining only index variables
474  */
475  sc_proj2 = sc_dup(sc_proj);
476 
477  sys_debug(4, "sc_proj2 [dup] = \n", sc_proj2);
478 
479  if (vect_size(sc_image2->base) <= 11) /* why 11? */
480  {
481  for (pv1 = const_base2; pv1 != NULL; pv1 = pv1->succ)
482  vect_erase_var(&lindex, vecteur_var(pv1));
483 
484  sc_proj = sc_projection_on_list_of_variables
485  (sc_image2, image_base, lindex);
486  sys_debug(9, "sc_proj = \n", sc_proj);
487 
488  sc_proj2 = sc_intersection(sc_proj2,sc_proj2,sc_proj);
489  sys_debug(4, "sc_proj2 [inter] = \n", sc_proj2);
490 
491  sc_proj2 = sc_normalize(sc_proj2);
492  sys_debug(4, "sc_proj2 [norm] = \n", sc_proj2);
493 
494  sys_debug(9, "sc_image2 [minmax] = \n", sc_image2);
495  sc_minmax_of_variables(sc_image2,sc_proj2,const_base2);
496  sys_debug(4, "sc_proj2 [minmax] = \n", sc_proj2);
497  }
498  else /*more restrictive system */
499  sc_minmax_of_variables(sc_image2,sc_proj2,image_base);
500 
501  sys_debug(2, "Iterat. Domain Before redundancy elimin.:\n",sc_proj2);
502 
503  /* Elimination of redundant constraints for integer systems*/
504 
505  sc_proj2->inegalites =
506  contrainte_sort(sc_proj2->inegalites,
507  sc_proj2->base, index_base,
508  false,false);
509 
510  sys_debug(2,"Iterat. Domain After 1rst sort:\n",sc_proj2);
511 
512  sc_integer_projection_information(sc_proj2,index_base, sc_info,dim_h2,n);
513  sc_proj2=build_integer_sc_nredund(sc_proj2,index_base,sc_info,1,dim_h2,n);
514  sys_debug(2," After redundancy elimination :\n",sc_proj2);
515 
516  for (i=1;i<=n;i++)
517  list_of_systems[i] = sc_init_with_sc(sc_proj2);
518 
519  /* Constraints distribution. Lsc[i] will contain all constraints
520  contraining the i-th index variable */
521 
522  constraint_distribution(sc_proj2,list_of_systems,index_base,sc_info);
523 
524  /* Computation of constraints contraining symbolic constants */
525  sc_on_constants= sc_init_with_sc(sc_proj2);
526  for (pv1 = tile_indices; pv1!=NULL; pv1=pv1->succ)
527  vect_erase_var(&const_base2, vecteur_var(pv1));
528  for (pv1 = bank_indices; pv1!=NULL; pv1=pv1->succ)
529  vect_erase_var(&const_base2, vecteur_var(pv1));
530  for (pv1 = ppid; pv1!=NULL; pv1=pv1->succ)
531  vect_erase_var(&const_base2, vecteur_var(pv1));
532 
533  /* Elimination of constraints redundant in list_of_systems[i] with the
534  "symbolic constant system" */
535 
536  sc_minmax_of_variables(sc_image2,sc_on_constants,const_base2);
537  for (i = 1; sc_on_constants != NULL && i <=vect_size(image_base);i++) {
538  list_of_systems[i] = elim_redund_sc_with_sc(list_of_systems[i],
539  sc_on_constants,
540  index_base,
541  dim_h2);
542  ifdebug(8) {
543  pips_debug(8,"Constraints on the %d-th var.:\n",i);
544  sc_fprint(stderr, list_of_systems[i], (get_variable_name_t) entity_local_name);
545  }
546  }
547 
548  var_id = (bank_code) ? vect_dup(ppid) :
549  vect_new(vecteur_var(bank_indices), VALUE_ONE);
550  stat = bound_generation(module,bank_code,receive_code,
551  private_entity,
552  loop_body_offsets,var_id,
553  list_of_systems,index_base,n,sc_info);
554 
555  ifdebug(4) {
556  /* if you get through this pp, it core dumps much later on:-) */
557  pips_debug(3, "returning:\n");
559  }
560  debug(3,"movement_computation","end\n");
561  debug_off();
562 
563  return (stat);
564 }
Pvecteur vect_rename(Pvecteur v, Pbase b, char *(*variable_name)(Variable))
Pvecteur vect_rename(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its coo...
Definition: base.c:247
void constraint_distribution(Psysteme sc, Psysteme *bound_systems, Pbase index_base, int sc_info[][4])
Distribution of the constraints of the system sc into several systems.
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
void update_basis(Pbase scbase, Pbase *index_base, Pbase *const_base, Pbase *image_base, Pbase bank_indices, Pbase tile_indices, Pbase *lindex, Pbase *lvar_coeff_nunit, Pbase *lvar_coeff_unit, Pbase *loop_body_offsets, Pbase *loop_body_indices, bool bank_code, Pbase ppid)
Update all the basis needed for data movement generation.
#define sys_debug(level, msg, sc)
build the base of the image domain.
Pbase variables_in_declaration_list(entity __attribute__((unused)) module, code ce)
Psysteme elim_redund_sc_with_sc(Psysteme sc1, Psysteme sc2, Pbase index_base, int dim)
Build the system of inequations of sc1 no-redundant with system sc2.
#define maxscinfosize
statement bound_generation(entity module, bool bank_code, bool receive_code, entity ent, Pbase loop_body_indices, Pbase var_id, Psysteme *lsystem, Pbase index_base, int n, int sc_info[][4])
Generation of the new loop nest characterizing the new domain.
#define assert(ex)
Definition: newgen_assert.h:41
code entity_code(entity e)
Definition: entity.c:1098
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new, get_variable_name_t variable_name)
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new): reecriture du systeme s r...
Definition: sc.c:224
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 build_integer_sc_nredund(volatile Psysteme ps, Pbase index_base, int tab_info[][4], int loop_level, int dim_h __attribute__((unused)), int n __attribute__((unused)))
Computation of a new system sc from the system ps, where each constraint of the system ps is added to...
void sc_minmax_of_variables(Psysteme ps1, Psysteme ps2, Pbase b)
This function uses sc_minmax_of_variable to compute the min and max of each variable belonging to bas...
Definition: sc_eval.c:212
void sc_integer_projection_information(Psysteme sc, Pbase index_base, int sc_info[][4], int dim_h, int n)
This function gives information about the variables and the constraints of the system.
bool var_with_unity_coeff_p(Psysteme sc, Variable var)
This function returns true: if all positive OR all negative coefficients of the variable var in the s...
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3)
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3): calcul d'un systeme de contraintes s...
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Pcontrainte contrainte_sort(Pcontrainte c, Pbase base, Pbase sort_base, bool inner_first, bool complex_first)
#define BASE_NULLE
MACROS SUR LES BASES.
#define VECTEUR_UNDEFINED_P(v)
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106

References assert, Ssysteme::base, base_dup(), BASE_NULLE, bound_generation(), build_integer_sc_nredund(), build_sc_nredund_1pass(), constraint_distribution(), contrainte_sort(), debug(), debug_off, debug_on, Ssysteme::dimension, elim_redund_sc_with_sc(), entity_code(), entity_local_name(), entity_undefined, ifdebug, Ssysteme::inegalites, malloc(), maxscinfosize, module, pips_debug, sc_dup(), sc_fprint(), sc_init_with_sc(), sc_integer_projection_information(), sc_intersection(), sc_minmax_of_variables(), sc_normalize(), sc_variables_rename(), space, statement_undefined, Svecteur::succ, sys_debug, update_basis(), VALUE_ONE, var_with_unity_coeff_p(), variables_in_declaration_list(), vect_chg_coeff(), vect_dup(), vect_erase_var(), vect_fprint(), vect_new(), vect_rename(), vect_size(), VECTEUR_NUL, VECTEUR_UNDEFINED_P, vecteur_var, and wp65_debug_print_text().

Referenced by make_load_blocks(), and make_store_blocks().

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

◆ print_fullname_base()

void print_fullname_base ( Pbase  sb)
Parameters
sbb

Definition at line 114 of file movement_computation.c.

115 {
116  Pvecteur pv;
117  for (pv = sb; pv !=NULL;
118  (void) fprintf(stderr,"%s_%s,",
119  entity_module_name((entity)(pv->var)),
120  entity_local_name((entity)(pv->var))),
121  pv=pv->succ);
122  (void) fprintf(stderr,"\n");
123 }
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
Definition: statement.c:4047

References entity_local_name(), entity_module_name(), fprintf(), Svecteur::succ, and Svecteur::var.

Referenced by update_basis().

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

◆ sc_add_new_variable_name()

Variable sc_add_new_variable_name ( entity  module,
Psysteme  ps 
)

sc_add_variable.c

sc_add_variable.c

Corinne Ancourt - juin 1990 This function adds a new variable to the system of constraints ps.

Parameters
moduleodule
pss

Definition at line 48 of file sc_add_variable.c.

51 {
52  static char name[ 64 ];
53  string name1;
54  int d;
55  entity ent1;
56  string full_name;
57  d = ps->dimension++;
58  name[0] = 'X';
59  (void) sprintf(&name[1],"%d",d);
60  name1 = strdup(name);
61 
64  name1,
65  NULL));
68  free(full_name);
69  }
70  ps->base = vect_add_variable (ps->base,(char *)ent1);
71 
72  return((char *) ent1);
73 
74 }
#define full_name(dir, name)
Definition: compile.c:414
entity make_scalar_integer_entity(const char *, const char *)
Create an integer variable of name "name" in module of name "module_name".
Definition: variable.c:1068

References Ssysteme::base, concatenate(), Ssysteme::dimension, entity_domain, entity_undefined, free(), full_name, gen_find_tabulated(), make_scalar_integer_entity(), module, module_local_name(), MODULE_SEP_STRING, strdup(), and vect_add_variable().

Referenced by build_sc_with_several_uniform_ref(), and sc_image_computation().

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

◆ sc_image_computation()

Psysteme sc_image_computation ( entity  module,
entity  entity_var,
Psysteme  sc_domain,
Psysteme  sc_array_function,
Pbase  index_base,
Pbase const_base,
entity  proc_id,
Pbase  bank_indices,
Pbase  tile_indices,
Pbase new_tile_indices,
int  pn,
int  bn,
int  ls,
int n,
int dim_h 
)

This function computes the system of constraints characterizing the image by the array function of the iteration domain.

Computation of the system depending on the machine

conversion des egalites en deux inegalites

pdate the base of constants in the system

initialisation du nombre de constantes symboliques du systeme

allocation et initialisation des matrices utiles

conversion du premier systeme relatif au domaine d'iteration et du deuxieme systeme relatif a la fonction d'acces aux elements du tableau

mise sous forme normale de matrice_hermite

calcul de la dimension reelle de la fonction d'acces

Computation of the new iteration domain

conversion de la matrice en systeme

Computation of the new matrix for array function

conversion from matrix to system

sc_transform_ineg_in_eg(sc_image);

Parameters
moduleodule
entity_varntity_var
sc_domainc_domain
sc_array_functionc_array_function
index_basendex_base
const_baseonst_base
proc_idroc_id
bank_indicesank_indices
tile_indicesile_indices
new_tile_indicesew_tile_indices
pnn
bnn
lss
nbank number and line size (depends on the machine)
dim_him_h

Definition at line 572 of file movement_computation.c.

588 {
589 
590  Psysteme sc_image = SC_UNDEFINED;
591  Psysteme sc_machine = SC_UNDEFINED;
592  Psysteme sc_domain2 = sc_dup(sc_domain);
594  Pbase new_index_base = BASE_NULLE;
595  Pvecteur pv = VECTEUR_NUL;
596  Pvecteur pvnew = VECTEUR_NUL;
597  Pvecteur pv1= VECTEUR_NUL;
598  Pvecteur pvi=VECTEUR_NUL;
599 
600  Pbase pbv, list_new_var=BASE_NULLE;
601  matrice A,B,F0,P,HERM,HERF,R;
602  matrice F = 0;
603  matrice Q = NULL;
604  int n1,mb,i;
605  Value det_p, det_q;
606  int n2 = 0;
607  int ma =0;
608  Variable new_var;
609 
610  debug_on("MOVEMENT_DEBUG_LEVEL");
611  debug(3,"sc_image_computation","begin\n");
612 
613  ifdebug(3) {
614  pips_debug(3,"ITERATION DOMAIN:\n");
615  sc_fprint(stderr, sc_domain2, (get_variable_name_t) entity_local_name);
616  pips_debug(3,"ARRAY FUNCTION :\n");
617  sc_fprint(stderr, sc_array_function, (get_variable_name_t) entity_local_name);
618  }
619  if (!sc_faisabilite(sc_domain2))
620  (void) fprintf(stderr,"systeme non faisable en reels \n");
621  else {
622 
623  /* Computation of the system depending on the machine */
624  sc_machine = build_sc_machine(pn,bn,ls,sc_array_function,proc_id,
625  bank_indices,entity_var);
626  sc_domain2 = sc_append(sc_domain2,sc_machine);
627 
628  /* conversion des egalites en deux inegalites */
629  sc_transform_eg_in_ineg(sc_domain2);
630 
631  /*update the base of constants in the system */
632 
633  pv1 =vect_dup(sc_domain2->base);
634  for (pv = index_base;
635  !VECTEUR_NUL_P(pv);
636  vect_chg_coeff(&pv1,vecteur_var(pv),0),pv=pv->succ);
637  *const_base = pv1;
638  ifdebug(8) {
639  pips_debug(8,"\n constant basis - sc_image_computation:");
640  base_fprint(stderr, *const_base,
642  }
643 
644  /* initialisation du nombre de constantes symboliques du systeme */
645 
646  for (pv1 = index_base, ma=0;
647  !VECTEUR_NUL_P(pv1);
648  ma ++, pv1 = pv1->succ);
649  for (pv1 = *const_base, mb=1;
650  !VECTEUR_NUL_P(pv1);
651  mb ++, pv1 = pv1->succ);
652 
653  sc_image = sc_new();
654  n1 = sc_domain2->nb_ineq;
655  n2 = sc_array_function->nb_ineq;
656 
657  /* allocation et initialisation des matrices utiles */
658  A = matrice_new(n1,ma);
659  B = matrice_new(n1,mb);
660  F = matrice_new(n2,ma);
661  F0 = matrice_new(n2,mb);
662  R = matrice_new(n1,ma);
663  P = matrice_new(n2,n2);
664  Q = matrice_new(ma,ma);
665  HERM = matrice_new(n2,ma);
666  HERF= matrice_new(n2,ma);
667 
668  matrice_nulle(R,n1,ma);
669  matrice_nulle(HERF,n2,ma);
670  matrice_identite(P,n2,0);
671 
672  *n= ma;
673 
674  /* conversion du premier systeme relatif au domaine d'iteration
675  et du deuxieme systeme relatif a la fonction d'acces
676  aux elements du tableau */
677  loop_sc_to_matrices(sc_domain2,index_base,*const_base,A,B,n1,ma,mb);
678 
679  loop_sc_to_matrices(sc_array_function,index_base,
680  *const_base,F,F0,n2,ma,mb);
681 
682  /* mise sous forme normale de matrice_hermite */
683  matrice_hermite(F,n2,ma,P,HERM,Q,&det_p,&det_q);
684  ifdebug(8) {
685  sc_fprint(stderr, sc_array_function, (get_variable_name_t) entity_local_name);
686  (void) fprintf(stderr," matrice F\n");
687  matrice_fprint(stderr,F,n2,ma);
688  }
689 
690  ifdebug(8) {
691  (void) fprintf(stderr," matrice P\n");
692  matrice_fprint(stderr,P,n2,n2);
693  (void) fprintf(stderr," matrice Q\n");
694  matrice_fprint(stderr,Q,ma,ma);
695  }
696 
697  /* calcul de la dimension reelle de la fonction d'acces */
698  *dim_h = dim_H(HERM,n2,ma);
699 
700  /** Computation of the new iteration domain **/
701  matrice_multiply(A,Q,R,n1,ma,ma);
702  ifdebug(8) {
703  (void) fprintf(stderr," matrix of new iteration domain \n");
704  matrice_fprint(stderr,R,n1,ma);
705  }
706  /* conversion de la matrice en systeme */
707  for (i = 1; i<= ma;i++) {
708  new_var = sc_add_new_variable_name(module,sc_image);
709  if (i==1) {
710  new_index_base= vect_new(new_var,VALUE_ONE);
711  pvi = new_index_base;
712  }
713  else { pvi->succ = vect_new(new_var,VALUE_ONE);
714  pvi=pvi->succ;
715  }
716  }
717  matrices_to_loop_sc(sc_image,new_index_base,
718  *const_base,R,B,n1,ma,mb);
719  list_new_var = new_index_base;
720  for (i = 1,pc=sc_array_function->inegalites,pbv = list_new_var;
721  i<= ma && !CONTRAINTE_UNDEFINED_P(pc) && !VECTEUR_NUL_P(pbv);
722  i++,pc =pc->succ,pbv=pbv->succ) {
723  if (vect_size(pc->vecteur) == 1 && pc->vecteur->var == TCST) {
724  pvnew = vect_make(NULL,
725  pbv->var,VALUE_ONE,
726  TCST,value_uminus(pc->vecteur->val));
727  sc_add_inegalite(sc_image,contrainte_make(pvnew));
728  pvnew = vect_make(NULL,
729  pbv->var,VALUE_MONE,
730  TCST,pc->vecteur->val);
731  sc_add_inegalite(sc_image,contrainte_make(pvnew));
732  }
733  }
734  ifdebug(3) {
735  pips_debug(3,"NEW ITERATION DOMAIN:\n");
736  sc_fprint(stderr, sc_image, (get_variable_name_t) entity_local_name);
737  }
738 
739  /** Computation of the new matrix for array function **/
740  matrice_multiply(P,HERM,HERF,n2,n2,ma);
741  ifdebug(3) {
742  pips_debug(3," New Matrix for Array Function \n");
743  matrice_fprint(stderr,HERF,n2,ma);
744  matrice_fprint(stderr,F0,n2,mb);
745  }
746  /* conversion from matrix to system */
747  matrices_to_loop_sc(sc_array_function,
748  new_index_base,*const_base,
749  HERF,
750  F0,
751  n2,
752  ma,mb);
753  ifdebug(3) {
754  pips_debug(3,"New Array Function :\n");
755  sc_fprint(stderr, sc_array_function, (get_variable_name_t) entity_local_name);
756  }
757  }
758 
759  /* sc_transform_ineg_in_eg(sc_image);*/
760  *new_tile_indices = BASE_NULLE;
761  sort_tile_indices(tile_indices,new_tile_indices,F,n2);
762 
763 
764  ifdebug(3) {
765  pips_debug(3,"New Iteration Domain :\n");
766  sc_fprint(stderr, sc_image, (get_variable_name_t) entity_local_name);
767  }
768  debug(3,"sc_image_computation","end\n");
769  debug_off();
770 
771  return(sc_image);
772 }
Psysteme build_sc_machine(int pn, int bn, int ls, Psysteme sc_array_function, entity proc_id, Pbase bank_indices, entity entity_var)
PACKAGE MOVEMENTS.
#define A(i, j)
comp_matrice.c
Definition: comp_matrice.c:63
#define CONTRAINTE_UNDEFINED
#define F
Definition: freia-utils.c:51
#define B(A)
Definition: iabrev.h:61
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
Definition: io.c:342
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77
int dim_H(matrice H, int n, int m)
Calcul de la dimension de la matrice de Hermite H.
Definition: hermite.c:197
void matrice_hermite(Value *MAT, int n, int m, Value *P, Value *H, Value *Q, Value *det_p, Value *det_q)
package matrice
Definition: hermite.c:78
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r)
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r): multiply rational matrix...
Definition: matrice.c:82
void matrice_nulle(matrice Z, int n, int m)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrice.c:311
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
void matrice_fprint(FILE *, matrice, int, int)
matrice_io.c
Definition: matrice_io.c:62
void sort_tile_indices(Pbase tile_indices, Pbase *new_tile_indices, matrice Q, int m)
Sort the tile indices base, such that the indices correspond to the tile indices of the array element...
Variable sc_add_new_variable_name(entity, Psysteme)
sc_add_variable.c
#define Q
Definition: pip__type.h:39
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
void sc_transform_eg_in_ineg(Psysteme sc)
Package sc.
void loop_sc_to_matrices(Psysteme, Pbase, Pbase, matrice, matrice, int, int, int)
Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie...
void matrices_to_loop_sc(Psysteme, Pbase, Pbase, matrice, matrice, int, int, int)
Definition: pip__tab.h:25
int nb_ineq
Definition: sc-local.h:73

References A, B, Ssysteme::base, base_fprint(), BASE_NULLE, build_sc_machine(), contrainte_make(), CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, dim_H(), entity_local_name(), F, fprintf(), ifdebug, Ssysteme::inegalites, loop_sc_to_matrices(), matrice_fprint(), matrice_hermite(), matrice_identite(), matrice_multiply(), matrice_new, matrice_nulle(), matrices_to_loop_sc(), module, Ssysteme::nb_ineq, pips_debug, Q, sc_add_inegalite(), sc_add_new_variable_name(), sc_append(), sc_dup(), sc_fprint(), sc_new(), sc_transform_eg_in_ineg(), sort_tile_indices(), Scontrainte::succ, Svecteur::succ, TCST, VALUE_MONE, VALUE_ONE, value_uminus, Svecteur::var, vect_chg_coeff(), vect_dup(), vect_make(), vect_new(), vect_size(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

Referenced by make_load_blocks(), and make_store_blocks().

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

◆ sort_tile_indices()

void sort_tile_indices ( Pbase  tile_indices,
Pbase new_tile_indices,
matrice  Q,
int  m 
)

Sort the tile indices base, such that the indices correspond to the tile indices of the array elements accessed by the local entity.

Example: If A[I,K] is referenced. the tile indices base sould be L_I,L_K...

Parameters
tile_indicesile_indices
new_tile_indicesew_tile_indices

Definition at line 236 of file movement_computation.c.

241 {
242  register int i,j;
243  Pvecteur pv,pv2;
245 
246  for (i=1;i<=m;i++) {
247  for (j=1,pv=tile_indices; pv!=NULL;j++,pv=pv->succ) {
248  if (ACCESS(Q,m,i,j) && vect_coeff(pv->var,pv3)==0 ) {
249  pv2 = vect_new(pv->var,ACCESS(Q,m,i,j));
250  if (*new_tile_indices ==BASE_NULLE)
251  *new_tile_indices =pv2 ;
252  else pv3->succ= pv2;
253  pv3 = pv2;
254  }
255  }
256  }
257 }
#define VECTEUR_UNDEFINED

References ACCESS, BASE_NULLE, Q, Svecteur::succ, vect_coeff(), vect_new(), and VECTEUR_UNDEFINED.

Referenced by sc_image_computation().

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

◆ test_bound_generation()

expression test_bound_generation ( Psysteme  sc_test,
Pbase  index_base 
)

This function generates the expressions of the guard if it exists.

All the expressions of the guards are computed from the combination of two constraints where the variable of higher_rank is eliminated.

generation of the left hand side of the guard

generation of the right hand side of the guard

generation of the inequality

Parameters
sc_testc_test
index_basendex_base

Definition at line 234 of file bound_generation.c.

237 {
238 
239  Pcontrainte ineq,right_ineq,left_ineq;
240  int rank;
241  Value coeff;
242  Variable var;
243  bool debut;
244  expression expr,ex1,ex2,ex3,ex4;
248 
249  cons * lex2;
252 
253  debug_on("MOVEMENT_DEBUG_LEVEL");
254  debug(8,"test_bound_generation","begin\n");
255 
256 
257  debut = true;
258  for (ineq = sc_test->inegalites;
259  !CONTRAINTE_UNDEFINED_P(ineq);
260  ineq=ineq->succ) {
261  rank = search_higher_rank(ineq->vecteur,index_base);
262  var = variable_of_rank(index_base,rank);
263 
264  if (value_pos_p(coeff= vect_coeff(var,ineq->vecteur))) {
265  right_ineq = contrainte_dup(ineq);
266  left_ineq = contrainte_dup(ineq->succ);
267  }
268  else {
269  right_ineq = contrainte_dup(ineq->succ);
270  left_ineq= contrainte_dup(ineq);
271  }
272 
273  /* generation of the left hand side of the guard */
274  if (value_notmone_p(coeff= vect_coeff(var,left_ineq->vecteur)))
275  vect_add_elem(&(left_ineq->vecteur),TCST,
277 
278  vect_chg_coeff(&(left_ineq->vecteur),var,VALUE_ZERO);
279  ex1 = make_vecteur_expression(left_ineq->vecteur);
280  if (value_notmone_p(coeff)) {
281  ex2 = int_to_expression(
282  VALUE_TO_INT(value_abs(coeff)));
283  lex2 = CONS(EXPRESSION,ex2,NIL);
284  exl = make_div_expression(ex1,lex2);
285  vect_add_elem(&(left_ineq->vecteur),TCST,
286  value_plus(coeff,VALUE_ONE));
287  }
288 
289  /* generation of the right hand side of the guard */
290 
291  coeff= vect_coeff(var,right_ineq->vecteur);
292  vect_chg_sgn(right_ineq->vecteur);
293  vect_chg_coeff(&(right_ineq->vecteur),var,VALUE_ZERO);
294  ex3= make_vecteur_expression(right_ineq->vecteur);
295  vect_chg_sgn(right_ineq->vecteur);
296 
297  if (value_notone_p(coeff)) {
298  ex4 = int_to_expression(
299  VALUE_TO_INT(value_abs(coeff)));
300  lex2 =CONS(EXPRESSION,ex4,NIL);
301  exr = make_div_expression(ex3,lex2);
302  }
303  lex2 = CONS(EXPRESSION,exr,NIL);
304 
305  /* generation of the inequality */
306  expr = make_op_expression(inf,CONS(EXPRESSION,exl,lex2));
307 
308  if (debut) lexpr =expr;
309  else {
310  lex2 = CONS(EXPRESSION,expr,NIL);
311  lexpr=make_op_expression(an,CONS(EXPRESSION,lexpr,lex2));
312  }
313  ineq = ineq->succ;
314  debut = false;
315  }
316 
317  debug(8,"test_bound_generation","end\n");
318  debug_off();
319  return(lexpr);
320 }
#define value_pos_p(val)
#define value_notone_p(val)
#define AND_OPERATOR_NAME
FI: intrinsics are defined at a third place after bootstrap and effects! I guess the name should be d...
#define LESS_OR_EQUAL_OPERATOR_NAME
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151

References AND_OPERATOR_NAME, CONS, contrainte_dup(), CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, EXPRESSION, expression_undefined, Ssysteme::inegalites, int_to_expression(), LESS_OR_EQUAL_OPERATOR_NAME, local_name_to_top_level_entity(), make_div_expression(), make_op_expression(), make_vecteur_expression(), NIL, rank, search_higher_rank(), Scontrainte::succ, TCST, value_abs, value_notmone_p, value_notone_p, VALUE_ONE, value_plus, value_pos_p, VALUE_TO_INT, value_uminus, VALUE_ZERO, variable_of_rank(), vect_add_elem(), vect_chg_coeff(), vect_chg_sgn(), vect_coeff(), and Scontrainte::vecteur.

Referenced by bound_generation().

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

◆ update_basis()

void update_basis ( Pbase  scbase,
Pbase index_base,
Pbase const_base,
Pbase image_base,
Pbase  bank_indices,
Pbase  tile_indices,
Pbase lindex,
Pbase lvar_coeff_nunit,
Pbase lvar_coeff_unit,
Pbase loop_body_offsets,
Pbase loop_body_indices,
bool  bank_code,
Pbase  ppid 
)

Update all the basis needed for data movement generation.

-loop_body_offsets: indices such as O or LI or LJ used to describe the range of contiguous values accessed on line (of tile or bank).

-loop_body_indices: list of the loop indices that are not parameters of the tiling transformation and are situated in the loop body of the tile

Parameters
scbasecbase
index_basendex_base
const_baseonst_base
image_basemage_base
bank_indicesank_indices
tile_indicesile_indices
lindexindex
lvar_coeff_nunitvar_coeff_nunit
lvar_coeff_unitvar_coeff_unit
loop_body_offsetsoop_body_offsets
loop_body_indicesoop_body_indices
bank_codeank_code
ppidpid

Definition at line 136 of file movement_computation.c.

150 {
151 
152  Pvecteur pv,pv1;
153 
154  debug(8,"update_basis","begin\n");
155  ifdebug(8) {
156  (void) fprintf(stderr,"BASIS PRINTING: \n");
157  (void) fprintf(stderr," sc_base :");
158  print_fullname_base(scbase);
159  (void) fprintf(stderr," const_base :");
160  print_fullname_base(*const_base);
161  (void) fprintf(stderr," bank_indices ");
162  print_fullname_base(bank_indices);
163  (void) fprintf(stderr," index_base");
164  print_fullname_base(*index_base);
165  (void) fprintf(stderr," tile_indices");
166  print_fullname_base(tile_indices);
167  (void) fprintf(stderr," loop_body_indices");
168  print_fullname_base(*loop_body_indices); }
169 
170  for (pv = bank_indices; !VECTEUR_NUL_P(pv); pv = pv->succ)
171  vect_chg_coeff(const_base,pv->var, VALUE_ZERO);
172 
173  vect_chg_coeff(const_base,ppid->var, VALUE_ZERO);
174 
175  if (bank_code)
176  vect_chg_coeff(const_base,vecteur_var(bank_indices), VALUE_ONE);
177  else
178  vect_chg_coeff(const_base,vecteur_var(ppid), VALUE_ONE);
179 
180  for (pv = tile_indices; !VECTEUR_NUL_P(pv); pv = pv->succ)
181  vect_chg_coeff(const_base,pv->var, VALUE_ZERO);
182 
183  for (pv = *loop_body_indices; !VECTEUR_NUL_P(pv); pv = pv->succ)
184  vect_erase_var(const_base,pv->var);
185 
186  *index_base = vect_dup(scbase);
187  *lindex = vect_dup(scbase);
188  *lvar_coeff_nunit = base_dup(scbase);
189 
190  for (pv = *const_base; !BASE_NULLE_P(pv);
191  vect_erase_var(lvar_coeff_nunit, vecteur_var(pv)),
192  vect_erase_var(index_base, vecteur_var(pv)),
193  vect_erase_var(lindex, vecteur_var(pv)),
194  pv= pv->succ);
195 
196  *image_base = build_image_base(bank_code,ppid,bank_indices,tile_indices);
197 
198  for (pv1 = *image_base;
199  !BASE_NULLE_P(pv1);
200  vect_erase_var(lvar_coeff_nunit,vecteur_var(pv1)),
201  vect_erase_var(index_base,vecteur_var(pv1)),
202  vect_erase_var(lindex,vecteur_var(pv1)),
203  pv1=pv1->succ);
204 
205  *lvar_coeff_unit = base_dup(*lvar_coeff_nunit);
206  *index_base = vect_add(vect_dup(*index_base),vect_dup(*image_base));
207  *lindex = vect_add(*image_base,vect_dup(*lindex));
208  *lindex = vect_add(vect_dup(*lindex),vect_dup(*const_base));
209 
210  if (bank_code)
211  *loop_body_offsets = vect_dup(bank_indices->succ);
212  else
213  *loop_body_offsets = base_dup(tile_indices);
214  ifdebug(8) {
215  (void) fprintf(stderr,"New BASIS:");
216  print_fullname_base(*image_base);
217  (void) fprintf(stderr," base lindex:");
218  print_fullname_base(*lindex);
219  (void) fprintf(stderr," base index:");
220  print_fullname_base(*index_base);
221  (void) fprintf(stderr," lvar_coeff_nunit:");
222  print_fullname_base(*lvar_coeff_nunit);
223  (void) fprintf(stderr," lvar_coeff_unit:");
224  print_fullname_base(*lvar_coeff_unit);
225  }
226  debug(8,"update_basis","end\n");
227 }
void print_fullname_base(Pbase sb)
Pbase build_image_base(bool bank_code, Pbase proc_id, Pbase bank_indices, Pbase tile_indices)
cproto-generated files
#define BASE_NULLE_P(b)

References base_dup(), BASE_NULLE_P, build_image_base(), debug(), fprintf(), ifdebug, print_fullname_base(), Svecteur::succ, VALUE_ONE, VALUE_ZERO, Svecteur::var, vect_add(), vect_chg_coeff(), vect_dup(), vect_erase_var(), VECTEUR_NUL_P, and vecteur_var.

Referenced by movement_computation().

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

◆ upper_bound_generation()

expression upper_bound_generation ( Psysteme  sc_pos,
Pbase  index_base,
int  number_of_upper_bounds,
int  loop_rank 
)

This fonction generates the upper bounds of the "loop_rank"-th loop.

this condition is true if the constraint constrains directly the variable

In that case the bound expression results from the combination of two constraints. The variable of rank "higher_rank" will be eliminated from these two constraints in order to give only one bound for the "loop_rank" index.

Parameters
sc_posc_pos
index_basendex_base
number_of_upper_boundsumber_of_upper_bounds
loop_rankoop_rank

Definition at line 145 of file bound_generation.c.

149 {
150  Pcontrainte ineq;
151  Pvecteur pv2=VECTEUR_NUL;
152  int higher_rank, nub = 0;
153  Value coeff;
154  Variable var = variable_of_rank(index_base,loop_rank);
155  expression expr, ex2, ex1, upper = expression_undefined;
156  cons * lex2,* lexpr = NIL;
158  bool reductible = false;
159 
160  debug_on("MOVEMENT_DEBUG_LEVEL");
161  debug(8,"upper_bound_generation","begin\n");
162 
163 
164  if (number_of_upper_bounds) {
165  for (ineq = sc_pos->inegalites;
166  !CONTRAINTE_UNDEFINED_P(ineq);
167  ineq=ineq->succ) {
168  Variable var2;
169  Value coeff2,coeff3;
170  reductible = false;
171  higher_rank=search_higher_rank(ineq->vecteur,index_base);
172  if (higher_rank > loop_rank ) {
173  var2 = variable_of_rank(index_base,higher_rank);
174  coeff2 = vect_coeff(var2,ineq->vecteur);
175  coeff3 = vect_coeff(var2,(ineq->succ)->vecteur);
176  if (value_one_p(value_abs(coeff2)) ||
177  value_one_p(value_abs(coeff3))) {
178  reductible = true;
179  pv2 = vect_cl2(value_abs(coeff2),(ineq->succ)->vecteur,
180  value_abs(coeff3),ineq->vecteur);
181 
182  ineq= ineq->succ;
183  }
184  }
185  else pv2 = vect_dup(ineq->vecteur);
186 
187  if (higher_rank <=loop_rank || reductible) {
188  /* this condition is true if the constraint constrains
189  directly the variable */
190  coeff= vect_coeff(var,pv2);
191  vect_chg_sgn(pv2);
192  vect_chg_coeff(&pv2,var,VALUE_ZERO);
193  expr = ex1 =make_vecteur_expression(pv2);
194  vect_chg_sgn(pv2);
195 
196  if (value_notone_p(coeff)) {
197  ex2 = int_to_expression(
198  VALUE_TO_INT(value_abs(coeff)));
199  lex2 = CONS(EXPRESSION,ex2,NIL);
200  expr= make_div_expression(ex1,lex2);
201  }
202  }
203  else {
204  /* In that case the bound expression results from
205  the combination of two constraints. The variable of
206  rank "higher_rank" will be eliminated from these two
207  constraints in order to give only one bound for
208  the "loop_rank" index. */
209  expr = complex_bound_computation(sc_pos,index_base,
210  ineq,ineq->succ,
211  higher_rank);
212  ineq = ineq->succ;
213  }
214  lexpr = CONS(EXPRESSION, expr,lexpr);
215  nub ++;
216  }
217  if (nub > 1)
218  upper = make_op_expression(min,lexpr);
219  else upper = EXPRESSION(CAR(lexpr));
220  }
221  debug(8,"upper_bound_generation","end\n");
222  debug_off();
223  return (upper);
224 
225 }

References CAR, complex_bound_computation(), CONS, CONTRAINTE_UNDEFINED_P, debug(), debug_off, debug_on, EXPRESSION, expression_undefined, Ssysteme::inegalites, int_to_expression(), local_name_to_top_level_entity(), make_div_expression(), make_op_expression(), make_vecteur_expression(), min, NIL, search_higher_rank(), Scontrainte::succ, value_abs, value_notone_p, value_one_p, VALUE_TO_INT, VALUE_ZERO, variable_of_rank(), vect_chg_coeff(), vect_chg_sgn(), vect_cl2(), vect_coeff(), vect_dup(), Scontrainte::vecteur, and VECTEUR_NUL.

Referenced by bound_generation(), and make_movements_loop_body_wp65().

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

◆ variable_in_declaration_module_p()

bool variable_in_declaration_module_p ( entity  m,
entity  v 
)

Definition at line 74 of file make_loop_body.c.

77 {
78  value val = entity_initial(m);
79  code c = value_code(val);
80  cons *d, *cp1;
81  d = code_declarations(c);
82 
83  if (d == NIL) return(false) ;
84  for (cp1 = d ; !ENDP(cp1) ; cp1 = CDR( cp1 )) {
85  if (strcmp(entity_local_name(ENTITY(CAR(cp1))),
86  entity_local_name(v)) == 0)
87  return(true);
88  }
89  return (false);
90 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define code_declarations(x)
Definition: ri.h:784
#define value_code(x)
Definition: ri.h:3067
#define entity_initial(x)
Definition: ri.h:2796

References CAR, CDR, code_declarations, ENDP, ENTITY, entity_initial, entity_local_name(), NIL, and value_code.

+ Here is the call graph for this function:

◆ variables_in_declaration_list()

Pbase variables_in_declaration_list ( entity  ,
code   
)

◆ wp65_debug_print_module()

void wp65_debug_print_module ( entity  m,
statement  s 
)

Definition at line 61 of file make_loop_body.c.

62 {
63  debug_on("PRETTYPRINT_DEBUG_LEVEL");
64  text t = text_module(m, s);
65  print_text(stderr, t);
66  free_text(t);
67  debug_off();
68 }
void free_text(text p)
Definition: text.c:74
text text_module(entity, statement)

References debug_off, debug_on, free_text(), print_text(), and text_module().

Referenced by module_to_wp65_modules().

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

◆ wp65_debug_print_text()

void wp65_debug_print_text ( entity  m,
statement  s 
)

make_loop_body.c

make_loop_body.c

Definition at line 53 of file make_loop_body.c.

54 {
55  debug(1, "For module %s:\n", entity_name(m));
56  debug_on("PRETTYPRINT_DEBUG_LEVEL");
57  print_statement(s);
58  debug_off();
59 }
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define entity_name(x)
Definition: ri.h:2790

References debug(), debug_off, debug_on, entity_name, and print_statement().

Referenced by bound_generation(), eval_variable_in_statement(), loop_nest_to_wp65_code(), make_all_movement_blocks(), make_movement_scalar_wp65(), make_scanning_over_one_tile(), make_scanning_over_tiles(), movement_computation(), reference_conversion_statement(), and translate_unary_into_binary_ref().

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