PIPS
build_sc_tile.c File Reference
#include <stdio.h>
#include <limits.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "constants.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
#include "matrice.h"
#include "misc.h"
#include "tiling.h"
+ Include dependency graph for build_sc_tile.c:

Go to the source code of this file.

Functions

Pvecteur make_loop_indice_equation (Pbase loop_indices, tiling tile, Pvecteur tile_delay, Pvecteur tile_indices, Pvecteur tile_local_indices, int rank)
 PACKAGE MOVEMENTS. More...
 
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 More...
 

Function Documentation

◆ 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_ZERO
#define value_minus(v1, v2)
#define value_maximum(ref, val)
#define value_notzero_p(val)
#define VALUE_CONST(val)
#define value_uminus(val)
unary operators on values
#define VALUE_MONE
#define value_ne(v1, v2)
int Value
#define VALUE_ONE
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_minimum(ref, val)
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 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
#define debug_on(env)
Definition: misc-local.h:157
#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
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
void sc_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
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 ...
#define ifdebug(n)
Definition: sg.c:47
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
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
#define tiling_origin(x)
Definition: tiling.h:70
#define tiling_tile(x)
Definition: tiling.h:68
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define vecteur_var(v)
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62
struct Svecteur * Pvecteur
#define VECTEUR_NUL_P(v)
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
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References ACCESS, 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:

◆ 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 
)

PACKAGE MOVEMENTS.

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
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
static entity rank
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: