PIPS
tiling_sequence.c File Reference
#include <stdio.h>
#include "genC.h"
#include "database.h"
#include "resources.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "pipsdbm.h"
#include "transformations.h"
#include "locality.h"
+ Include dependency graph for tiling_sequence.c:

Go to the source code of this file.

Data Structures

struct  INFO_LOOP
 La structure d'une boucle : son index et ces deux bornes. More...
 
struct  NID
 La structure d'un nid. More...
 

Macros

#define DEFAULT_INT_PREFIX   "I_"
 
#define DEFAULT_FLOAT_PREFIX   "F_"
 
#define DEFAULT_LOGICAL_PREFIX   "L_"
 
#define DEFAULT_COMPLEX_PREFIX   "C_"
 
#define DEFAULT_STRING_PREFIX   "S_"
 
#define depth_max   40 /**La profondeur des differents nids */
 
#define st_max   40 /**Le nombre maximum de stencils q'un nid peut contenir */
 
#define nid_nbr   6 /**nombre de nid de la sequence */
 

Typedefs

typedef struct INFO_LOOP info_loop
 La structure d'une boucle : son index et ces deux bornes. More...
 
typedef struct NID nid
 La structure d'un nid. More...
 

Enumerations

enum  contenu_t {
  is_unknown , is_a_perf_nes_loop , is_a_no_perf_nes_loop , is_a_no_perf_nes_loop_t ,
  is_a_call , is_a_continue , is_a_while , is_a_test ,
  is_a_stencil , is_a_continue , is_a_no_stencil
}
 pour marquer si la sequence repond a nos hypotheses More...
 

Functions

static entity internal_make_new_array_variable (int i, int j, entity module, basic b, list lis)
 le tableau en entree More...
 
static bool loop_flt (loop l)
 
static void loop_rwt (loop l, context_p context)
 
static bool stmt_flt (statement s, context_p context)
 
static void stmt_rwt (statement s, context_p context)
 
static bool seq_flt ()
 
static void seq_rwt (sequence sq, context_p context)
 
static bool uns_flt ()
 
static void uns_rwt (context_p context)
 
static bool test_flt ()
 
static void test_rwt (context_p context)
 
static bool call_flt ()
 
static void call_rwt (call ca, context_p context)
 
static void wl_rwt (context_p context)
 
static bool lexi_sup (Pmatrix a, Pmatrix b)
 Cette fonction retourne true si le vecteur 'a' est lexicographiquement superieur au vecteur 'b'. More...
 
static void trier (Pmatrix *st, int length)
 Cette fonction trie un tableau de stencil d'un nid donne. More...
 
static void compute_delay_merged_nest ()
 Cette fonction calcule les delais qu'on doit ajouter aux differents nids. More...
 
static void compute_delay_tiled_nest ()
 
static void compute_bound_merged_nest ()
 Cette fonction calcule les bornes du nid fusionne. More...
 
static void compute_bound_tiled_nest ()
 
static statement fusion ()
 cette fonction donne le code fusionne More...
 
static void cons_coef (Pmatrix p, int nid)
 N construit la coifficients des fonctions d'acces. More...
 
static Pvecteur buffer_acces (int nid)
 On construit la foction d'acces
More...
 
static statement fusion_buffer ()
 Cette fonction donne le code fusionne avec allocation des tampons. More...
 
static entity make_tile_index_entity_n (entity old_index, char *su)
 
static void derive_new_basis_deux (Pbase base_oldindex, Pbase *base_newindex, entity(*new_entity)(entity, char *))
 
static void derive_new_basis_une (Pbase base_oldindex, Pbase *base_newindex, entity(*new_entity)(entity, char *))
 
statement permutation (statement s, Pmatrix P)
 
statement permutation2 (statement s, Pmatrix P)
 
statement Hierarchical_tiling ()
 
int position_one_element (Pmatrix P, int i)
 
statement Tiling_buffer_allocation ()
 
static bool array_overflow ()
 
static void unroll_recursive (statement s, int n)
 
statement Tiling2_buffer ()
 
bool tiling_sequence (string module)
 

Variables

static Pvecteurtiling_indice
 
static int k1 =0
 
static int k2 =0
 
static nid sequen [nid_nbr]
 k1 represente le nombre de nid et k2 leur profondeur More...
 
static int depth
 la sequence de nids More...
 
static info_loopmerged_nest
 la pronfondeur des nids More...
 
static info_looptiled_nest
 
loop loop1
 le nid fusionne More...
 
entity first_array
 une copie de l'un des nids de la sequence More...
 
static bool first_turn =false
 Compteurs des suffixes de nouvelles references. More...
 
static bool overflow =false
 

Macro Definition Documentation

◆ DEFAULT_COMPLEX_PREFIX

#define DEFAULT_COMPLEX_PREFIX   "C_"

Definition at line 41 of file tiling_sequence.c.

◆ DEFAULT_FLOAT_PREFIX

#define DEFAULT_FLOAT_PREFIX   "F_"

Definition at line 39 of file tiling_sequence.c.

◆ DEFAULT_INT_PREFIX

#define DEFAULT_INT_PREFIX   "I_"

Definition at line 38 of file tiling_sequence.c.

◆ DEFAULT_LOGICAL_PREFIX

#define DEFAULT_LOGICAL_PREFIX   "L_"

Definition at line 40 of file tiling_sequence.c.

◆ DEFAULT_STRING_PREFIX

#define DEFAULT_STRING_PREFIX   "S_"

Definition at line 42 of file tiling_sequence.c.

◆ depth_max

#define depth_max   40 /**La profondeur des differents nids */

Definition at line 43 of file tiling_sequence.c.

◆ nid_nbr

#define nid_nbr   6 /**nombre de nid de la sequence */

Definition at line 45 of file tiling_sequence.c.

◆ st_max

#define st_max   40 /**Le nombre maximum de stencils q'un nid peut contenir */

Definition at line 44 of file tiling_sequence.c.

Typedef Documentation

◆ info_loop

typedef struct INFO_LOOP info_loop

La structure d'une boucle : son index et ces deux bornes.

◆ nid

typedef struct NID nid

La structure d'un nid.

Enumeration Type Documentation

◆ contenu_t

enum contenu_t

pour marquer si la sequence repond a nos hypotheses

Enumerator
is_unknown 
is_a_perf_nes_loop 
is_a_no_perf_nes_loop 
is_a_no_perf_nes_loop_t 
is_a_call 
is_a_continue 
is_a_while 
is_a_test 
is_a_stencil 
is_a_continue 
is_a_no_stencil 

Definition at line 116 of file tiling_sequence.c.

contenu_t
pour marquer si la sequence repond a nos hypotheses
@ is_a_stencil
@ is_a_no_stencil
@ is_a_continue

Function Documentation

◆ array_overflow()

static bool array_overflow ( )
static

Definition at line 2173 of file tiling_sequence.c.

2174 { int i,j,k;
2175 
2176  for(i=0;i<=k1-1;i++)
2177  {
2178  trier (sequen[i].st,sequen[i].nbr_stencil);
2179  if(i==0)
2180  {
2181  int m=0;
2182  list lis;
2183  expression lower, upper;
2184  normalized norm1,norm2;
2185  Pvecteur pv1,pv2;
2186  Value v1,v2;
2188 
2189  MAP(DIMENSION,dim,{
2190  lower= dimension_lower(dim);
2191  upper=dimension_upper(dim);
2193  norm1=expression_normalized(lower);
2194  pv1= normalized_linear(norm1);
2195  v1=vect_coeff(TCST,pv1);
2196 
2197 
2198 
2200  norm2=expression_normalized(upper);
2201  pv2= normalized_linear(norm2);
2202  v2=vect_coeff(TCST,pv2);
2203 
2204  for(j=0;j<=sequen[i].nbr_stencil-1;j++)
2205  {
2206  if (value_plus(MATRIX_ELEM(sequen[i].st[j],depth-m,1), sequen[i].nd[depth-m-1].lower)
2207  < v1 )
2208  {
2209  overflow=true ;
2210  printf(" Debordement dans le tableau: %s\n",entity_name(first_array));
2211 
2212 
2213  };
2214  if (value_plus(MATRIX_ELEM(sequen[i].st[j],depth-m,1), sequen[i].nd[depth-m-1].upper)>
2215  v2 )
2216  {
2217 
2218  overflow=true ;
2219  printf(" Debordement dans le tableau: %s\n",entity_name(first_array));
2220  };
2221  }
2222  m++;
2223  },lis) ;
2224  }
2225  else
2226  {
2227  for(j=0;j<=sequen[i].nbr_stencil-1;j++)
2228  for(k=0;k<=depth-1;k++)
2229  {
2230  if (value_plus(MATRIX_ELEM(sequen[i].st[j],k+1,1), sequen[i].nd[k].lower)
2231  <sequen[i-1].nd[k].lower )
2232  {
2233  overflow=true ;
2234  printf(" Debordement dans le domaine du tableau: %s\n",entity_name(sequen[i-1].tableau));
2235  };
2236  if (value_plus(MATRIX_ELEM(sequen[i].st[j],k+1,1), sequen[i].nd[k].upper)>
2237  sequen[i-1].nd[k].upper )
2238  {
2239  overflow=true ;
2240  printf(" Debordement dans le domaine du tableau: %s\n",entity_name(sequen[i-1].tableau));
2241  };
2242 
2243  };
2244  };
2245  };
2246 
2247  return overflow;
2248 }
int Value
#define value_plus(v1, v2)
binary operators on values
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
#define MATRIX_ELEM(matrix, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrix-local.h:80
#define true
Definition: newgen_types.h:81
void normalize_all_expressions_of(void *obj)
Definition: normalize.c:668
#define dimension_lower(x)
Definition: ri.h:980
#define type_variable(x)
Definition: ri.h:2949
#define entity_name(x)
Definition: ri.h:2790
#define expression_normalized(x)
Definition: ri.h:1249
#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
int printf()
info_loop * nd
les stencils
int nbr_stencil
les boucles
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
entity first_array
une copie de l'un des nids de la sequence
static bool overflow
static nid sequen[nid_nbr]
k1 represente le nombre de nid et k2 leur profondeur
static int depth
la sequence de nids
static int k1
static void trier(Pmatrix *st, int length)
Cette fonction trie un tableau de stencil d'un nid donne.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
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 depth, DIMENSION, dimension_lower, dimension_upper, entity_name, entity_type, expression_normalized, first_array, k1, INFO_LOOP::lower, MAP, MATRIX_ELEM, NID::nbr_stencil, NID::nd, normalize_all_expressions_of(), normalized_linear, overflow, printf(), sequen, TCST, trier(), true, type_variable, INFO_LOOP::upper, value_plus, variable_dimensions, and vect_coeff().

Referenced by tiling_sequence().

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

◆ buffer_acces()

static Pvecteur buffer_acces ( int  nid)
static

On construit la foction d'acces

-> -> ->
si par exemple f( i )= (N, 1)^t( i- (1,1)^t) alors pv= f( i )

Definition at line 657 of file tiling_sequence.c.

658 {
659  Pvecteur pv=NULL,tmp;
660  int j;
661  for(j=0;j<=depth-1;j++)
662  {
663  if(j==0)
664  pv=vect_make(VECTEUR_NUL,sequen[nid].nd[j].index,MATRIX_ELEM(sequen[nid].coef,1,j+1),
666  value_plus( sequen[nid].nd[j].lower,
667  MATRIX_ELEM( sequen[nid].delai,j+1,1 ) ))));
668  else
669  {
670  tmp =pv;
671  pv = vect_make(tmp,sequen[nid].nd[j].index,MATRIX_ELEM(sequen[nid].coef,1,j+1),
673  value_plus(sequen[nid].nd[j].lower,
674  MATRIX_ELEM( sequen[nid].delai,j+1,1 ) ))));
675  }
676  };
677 
678  return pv;
679 }
#define value_uminus(val)
unary operators on values
#define value_direct_multiply(v1, v2)
La structure d'un nid.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
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 depth, INFO_LOOP::index, INFO_LOOP::lower, MATRIX_ELEM, sequen, TCST, value_direct_multiply, value_plus, value_uminus, vect_make(), and VECTEUR_NUL.

Referenced by fusion_buffer().

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

◆ call_flt()

static bool call_flt ( )
static

Definition at line 251 of file tiling_sequence.c.

252 {
253  return true ;
254 }

References true.

Referenced by tiling_sequence().

+ Here is the caller graph for this function:

◆ call_rwt()

static void call_rwt ( call  ca,
context_p  context 
)
static

Definition at line 256 of file tiling_sequence.c.

257 {
258  contenu_t contenu=is_a_stencil;
259  if ((strcmp(entity_name(call_function(ca)),"TOP-LEVEL:CONTINUE" )==0)||
260  (strcmp(entity_name(call_function(ca)),"TOP-LEVEL:RETURN" ) ==0))
261  {
262  contenu=is_a_continue;
263  }
264  else
265  {
266  if (strcmp(entity_name(call_function(ca)),"TOP-LEVEL:=")==0)
267  {
268  list lis;
269  expression gauche=NULL, droite=NULL;
270  syntax stg,std;
272  Pvecteur pv;
273  int i=0,j=0;
274  lis =call_arguments(ca);
275  MAP(EXPRESSION,exp,{
276  if (i==0) gauche=exp;
277  if (i==1) droite=exp;
278  i++;
279  },lis) ;
280  stg= expression_syntax(gauche);
281  std= expression_syntax(droite);
282  if ((syntax_reference_p(stg))&&(syntax_call_p(std))&&(i==2))
283  {
284  reference ref;
285  list lis,lis2;
286  Variable vt=NULL;
287  Pvecteur pvt;
288  Value v1;
289  ref =syntax_reference(stg);
290  lis =reference_indices(ref);
291  i=1;
293  MAP(EXPRESSION,exp,{
294  if (k2-i >=0) {
295  vt=sequen[k1].nd[k2-i].index;
296  }
297  else{
298  contenu=is_a_no_stencil;
299  }
302  pv= normalized_linear(norm);
303  pvt = vect_make(VECTEUR_NUL, vt, VALUE_ONE,
304  TCST,VALUE_ZERO);
305  if (!vect_equal(pvt, pv))
306  {
307  contenu=is_a_no_stencil;
308  } ;
309  i++;
310  },lis) ;
311  if (i-1!=k2)
312  {
313  contenu=is_a_no_stencil;
314  };
315  lis =call_arguments( syntax_call(std));
316  j=0;
317  MAP(EXPRESSION,exp,{
319  if(k1==0)
321  if(k1>0)
322  {
324  contenu=is_a_no_stencil;
325  };
326  lis2 =reference_indices(ref);
327  i=1;
328  sequen[k1].st[j]=matrix_new(k2,1);
329  MAP(EXPRESSION,exp2,{
330  if (k2-i >=0)
331  vt=sequen[k1].nd[k2-i].index;
332  else
333  contenu=is_a_no_stencil;
336  pv= normalized_linear(norm);
337  v1=vect_coeff(TCST,pv);
338  MATRIX_ELEM(sequen[k1].st[j],k2-i+1,1)=v1;
339  pvt = vect_make(VECTEUR_NUL, vt, VALUE_ONE,
340  TCST,v1);
341  if (!vect_equal(pvt, pv)){
342  contenu=is_a_no_stencil;
343  };
344  i++;
345  },lis2) ;
346  if (i-1!=k2){
347  contenu=is_a_no_stencil; };
348  j++;
349  },lis) ;
350  sequen[k1].nbr_stencil=j;
351  }
352  else
353  {
354  contenu=is_a_no_stencil;
355  };
356  }
357  else
358  {
359  contenu=is_a_no_stencil;
360  }
361  }
362  hash_put(context->contenu,stack_head(context->statement_stack), (void *)contenu );
363  hash_put(context->depth,stack_head(context->statement_stack), ( void *) 0);
364  sequen[k1].s= copy_statement( stack_head(context->statement_stack));
365 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
#define VALUE_ZERO
#define VALUE_ONE
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278
Pmatrix matrix_new(int m, int n)
package matrix
Definition: alloc.c:41
void * stack_head(const stack)
returns the item on top of stack s
Definition: stack.c:420
static void norm(struct rproblem *RR)
cette procedure normalise la fonction cout, calcule les valeurs des seconds membres resultant d'une n...
Definition: r1.c:271
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
#define syntax_reference_p(x)
Definition: ri.h:2728
#define syntax_reference(x)
Definition: ri.h:2730
#define call_function(x)
Definition: ri.h:709
#define reference_variable(x)
Definition: ri.h:2326
#define syntax_call_p(x)
Definition: ri.h:2734
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define reference_indices(x)
Definition: ri.h:2328
#define syntax_call(x)
Definition: ri.h:2736
#define call_arguments(x)
Definition: ri.h:711
#define expression_syntax(x)
Definition: ri.h:1247
contenu_t
Definition: stats.c:45
Variable index
entity tableau
Pmatrix * st
le tableau en ecriture
statement s
le delai qu'on doit ajouter a ce nid
Definition: delay.c:253
static int k2
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
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 call_arguments, call_function, copy_statement(), entity_name, exp, EXPRESSION, expression_normalized, expression_reference(), expression_syntax, first_array, hash_put(), INFO_LOOP::index, is_a_continue, is_a_no_stencil, is_a_stencil, k1, k2, MAP, MATRIX_ELEM, matrix_new(), NID::nbr_stencil, NID::nd, norm(), normalize_all_expressions_of(), normalized_linear, ref, reference_indices, reference_variable, NID::s, sequen, NID::st, stack_head(), syntax_call, syntax_call_p, syntax_reference, syntax_reference_p, NID::tableau, TCST, VALUE_ONE, VALUE_ZERO, vect_coeff(), vect_equal(), vect_make(), and VECTEUR_NUL.

Referenced by tiling_sequence().

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

◆ compute_bound_merged_nest()

static void compute_bound_merged_nest ( )
static

Cette fonction calcule les bornes du nid fusionne.

Definition at line 461 of file tiling_sequence.c.

462 {
463  int i,j;
464  merged_nest= (struct INFO_LOOP *)malloc(depth *sizeof(struct INFO_LOOP));
465  for(j=0;j<=depth-1;j++)
466  {
467  merged_nest[j].lower =sequen[0].nd[j].lower+MATRIX_ELEM( sequen[0].delai,j+1,1);
468  merged_nest[j].upper=sequen[0].nd[j].upper+MATRIX_ELEM( sequen[0].delai,j+1,1);
469  for (i=1;i<=k1-1;i++)
470  {
471  if( merged_nest[j].lower > sequen[i].nd[j].lower+MATRIX_ELEM( sequen[i].delai,j+1,1))
472  merged_nest[j].lower =sequen[i].nd[j].lower+MATRIX_ELEM( sequen[i].delai,j+1,1 );
473  if( merged_nest[j].upper <sequen[i].nd[j].upper+MATRIX_ELEM( sequen[i].delai,j+1,1))
474  merged_nest[j].upper=sequen[i].nd[j].upper+MATRIX_ELEM( sequen[i].delai,j+1,1);
475  };
476  }
477 }
void * malloc(YYSIZE_T)
La structure d'une boucle : son index et ces deux bornes.
static info_loop * merged_nest
la pronfondeur des nids

References depth, k1, INFO_LOOP::lower, malloc(), MATRIX_ELEM, merged_nest, NID::nd, sequen, and INFO_LOOP::upper.

Referenced by fusion(), and fusion_buffer().

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

◆ compute_bound_tiled_nest()

static void compute_bound_tiled_nest ( )
static

Definition at line 478 of file tiling_sequence.c.

479 {
480  int i,j;
481 
482  tiled_nest= (struct INFO_LOOP *)malloc(depth *sizeof(struct INFO_LOOP));
483  for(j=0;j<=depth-1;j++)
484  {
485  Value val;
486  tiled_nest[j].lower =sequen[0].nd[j].lower+MATRIX_ELEM( sequen[0].delai,j+1,1);
487  tiled_nest[j].upper=sequen[0].nd[j].upper+MATRIX_ELEM( sequen[0].delai,j+1,1);
488  for (i=1;i<=k1-1;i++)
489  {
490  if( tiled_nest[j].lower > sequen[i].nd[j].lower+MATRIX_ELEM( sequen[i].delai,j+1,1))
491  tiled_nest[j].lower =sequen[i].nd[j].lower+MATRIX_ELEM( sequen[i].delai,j+1,1 );
492  if( tiled_nest[j].upper <sequen[i].nd[j].upper+MATRIX_ELEM( sequen[i].delai,j+1,1))
493  tiled_nest[j].upper=sequen[i].nd[j].upper+MATRIX_ELEM( sequen[i].delai,j+1,1);
494  };
495  val =value_uminus(tiled_nest[j].lower);
498  for (i=0;i<=k1-1;i++)
499  MATRIX_ELEM(sequen[i].delai,j+1,1)=value_plus( MATRIX_ELEM(sequen[i].delai,j+1,1),val);
500 
501 
502  }
503 
504 }
static info_loop * tiled_nest

References depth, k1, INFO_LOOP::lower, malloc(), MATRIX_ELEM, NID::nd, sequen, tiled_nest, INFO_LOOP::upper, value_plus, and value_uminus.

Referenced by Hierarchical_tiling(), Tiling2_buffer(), and Tiling_buffer_allocation().

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

◆ compute_delay_merged_nest()

static void compute_delay_merged_nest ( )
static

Cette fonction calcule les delais qu'on doit ajouter aux differents nids.

le delaie du dernier est le vecteur nul

k=d{k+1} - plus grand vecteur stencil du nid k+1

Definition at line 414 of file tiling_sequence.c.

415 {
416  int i;
417  for (i=k1-1;i>=0;i--)
418  {
419  sequen [i].delai=matrix_new(depth,1);
420  if (i==k1-1) matrix_nulle(sequen [i].delai); /* le delaie du dernier est le vecteur nul */
421  else
422  matrix_substract(sequen [i].delai, sequen [i+1].delai,
423  sequen[i+1].st[sequen[i+1].nbr_stencil-1]);
424  /*d_k=d_{k+1} - plus grand vecteur stencil du nid k+1*/
425  }
426 }
void matrix_nulle(Pmatrix Z)
void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrix.c:293
void matrix_substract(Pmatrix a, Pmatrix b, Pmatrix c)
void matrix_substract(Pmatrix a, Pmatrix b, Pmatrix c): substract rational matrix c from rational mat...
Definition: matrix.c:435
Pmatrix delai
nombre de stencils

References NID::delai, depth, k1, matrix_new(), matrix_nulle(), matrix_substract(), and sequen.

Referenced by fusion(), and fusion_buffer().

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

◆ compute_delay_tiled_nest()

static void compute_delay_tiled_nest ( )
static

le delaie du dernier est le vecteur nul

k=d{k+1} - plus grand vecteur stencil du nid k+1

Definition at line 428 of file tiling_sequence.c.

429 {
430  int i,j,k;
431  Pmatrix max_st=matrix_new(depth,1);
432 
433  for (i=k1-1;i>=0;i--)
434  {
435  sequen [i].delai=matrix_new(depth,1);
436  if (i==k1-1) matrix_nulle(sequen [i].delai); /* le delaie du dernier est le vecteur nul */
437  else
438  {
439  for(k=0;k<=depth-1;k++)
440  {
441  Value val;
442  val=MATRIX_ELEM(sequen[i+1].st[0],k+1,1);
443  for (j=1;j<=sequen[i+1].nbr_stencil-1;j++)
444  {
445  if ( MATRIX_ELEM(sequen[i+1].st[j],k+1,1)>val)
446  val=MATRIX_ELEM(sequen[i+1].st[j],k+1,1);
447 
448  };
449  MATRIX_ELEM(max_st,k+1,1)=val;
450  };
451  matrix_substract(sequen [i].delai, sequen [i+1].delai, max_st);
452  }
453 
454  /*d_k=d_{k+1} - plus grand vecteur stencil du nid k+1*/
455  }
456 
457 }
package matrice
Definition: matrix-local.h:63

References NID::delai, depth, k1, MATRIX_ELEM, matrix_new(), matrix_nulle(), matrix_substract(), NID::nbr_stencil, and sequen.

Referenced by Hierarchical_tiling(), Tiling2_buffer(), and Tiling_buffer_allocation().

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

◆ cons_coef()

static void cons_coef ( Pmatrix  p,
int  nid 
)
static

N construit la coifficients des fonctions d'acces.

-> ->
si par exemple f( i )= (N, 1)^t( i- (1,1)^t) alors p= (N, 1)^t

Definition at line 638 of file tiling_sequence.c.

639 {
640  int i;
641  Value temp;
642  for(i=depth;i>=1 ;i--)
643  {
644  if (i==depth) MATRIX_ELEM(p,1,i)=1;
645  else
646  {
647  temp= value_minus(sequen[nid].nd[i].upper,sequen[nid].nd[i].lower);
648  temp=value_plus(temp,VALUE_ONE);
649  MATRIX_ELEM(p,1,i)= value_direct_multiply( MATRIX_ELEM(p,1,i+1),temp );
650  }
651  }
652 }
#define value_minus(v1, v2)

References depth, INFO_LOOP::lower, MATRIX_ELEM, sequen, INFO_LOOP::upper, value_direct_multiply, value_minus, VALUE_ONE, and value_plus.

Referenced by fusion_buffer().

+ Here is the caller graph for this function:

◆ derive_new_basis_deux()

static void derive_new_basis_deux ( Pbase  base_oldindex,
Pbase base_newindex,
entity(*)(entity, char *)  new_entity 
)
static

Definition at line 916 of file tiling_sequence.c.

917 {
918  Pbase pb;
919  entity new_name;
920  char *a;
921  for (pb=base_oldindex; pb!=NULL; pb=pb->succ)
922  {
923  a="1";
924  new_name = new_entity((entity) pb->var,a);
925  base_add_dimension(base_newindex, (Variable) new_name);
926  a="2";
927  new_name = new_entity((entity) pb->var,a);
928  base_add_dimension(base_newindex, (Variable) new_name);
929  a="3";
930  new_name = new_entity((entity) pb->var,a);
931  printf("%s \n",entity_name(new_name));
932  base_add_dimension(base_newindex, (Variable) new_name);
933 
934  }
935  /* *base_newindex = base_reversal(*base_newindex); */
936 }
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
#define base_add_dimension(b, v)

References base_add_dimension, entity_name, printf(), Svecteur::succ, and Svecteur::var.

Referenced by Hierarchical_tiling(), and Tiling2_buffer().

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

◆ derive_new_basis_une()

static void derive_new_basis_une ( Pbase  base_oldindex,
Pbase base_newindex,
entity(*)(entity, char *)  new_entity 
)
static

Definition at line 937 of file tiling_sequence.c.

938 {
939  Pbase pb;
940  entity new_name;
941  char *a;
942  for (pb=base_oldindex; pb!=NULL; pb=pb->succ)
943  {
944  a="1";
945  new_name = new_entity((entity) pb->var,a);
946  base_add_dimension(base_newindex, (Variable) new_name);
947  a="2";
948  new_name = new_entity((entity) pb->var,a);
949  base_add_dimension(base_newindex, (Variable) new_name);
950 
951 
952  }
953  /* *base_newindex = base_reversal(*base_newindex); */
954 }

References base_add_dimension, Svecteur::succ, and Svecteur::var.

Referenced by Tiling_buffer_allocation().

+ Here is the caller graph for this function:

◆ fusion()

static statement fusion ( )
static

cette fonction donne le code fusionne

calculer les delais des differents nis

calculer les bornes du nid fusionne

on construit la liste des instructions qui vont former le corps du nid fusionne

Definition at line 509 of file tiling_sequence.c.

510 {
511  int i,j;
512  list lis=NULL;
513  instruction ins;
514  sequence seq=NULL;
515  statement s;
516  loop ls=NULL;
517  /* calculer les delais des differents nis */
519  /* calculer les bornes du nid fusionne */
521  /* on construit la liste des instructions qui vont former le corps du nid fusionne */
522  for (i=k1-1;i>=0;i--)
523  {
524  expression e1,e2,e,gauche=NULL,droite=NULL,delai_plus;
525  test t;
526  call c;
527  int m;
528  Pvecteur pv;
529  e1=ge_expression(entity_to_expression ((entity)sequen[i].nd[0].index),
530  Value_to_expression( value_plus(sequen[i].nd[0].lower,
531  MATRIX_ELEM( sequen[i].delai,1,1))));
532  e2=le_expression(entity_to_expression ((entity)sequen[i].nd[0].index),
533  Value_to_expression( value_plus(sequen[i].nd[0].upper,
534  MATRIX_ELEM( sequen[i].delai,1,1))));
535  if (value_eq( value_plus(sequen[i].nd[0].lower,
536  MATRIX_ELEM( sequen[i].delai,1,1)),merged_nest[0].lower))
537  {
538  if (value_eq( value_plus(sequen[i].nd[0].upper,
539  MATRIX_ELEM( sequen[i].delai,1,1)),merged_nest[0].upper))
540  e=NULL;
541  else
542  e=e2;
543  }
544  else
545  {
546  if (value_eq( value_plus(sequen[i].nd[0].upper,
547  MATRIX_ELEM( sequen[i].delai,1,1)),merged_nest[0].upper))
548  e=e1;
549  else
550  e=and_expression(e1,e2);
551  };
552  for(j=0;j<=depth-1;j++)
553  {
554  if (j>=1)
555  {
556  e1=ge_expression(entity_to_expression((entity)sequen[i].nd[j].index),
557  Value_to_expression(value_plus(sequen[i].nd[j].lower,
558  MATRIX_ELEM( sequen[i].delai,j+1,1))));
559  e2=le_expression(entity_to_expression ((entity)sequen[i].nd[j].index),
560  Value_to_expression( value_plus(sequen[i].nd[j].upper,
561  MATRIX_ELEM( sequen[i].delai,j+1,1))));
562  if (value_eq( value_plus(sequen[i].nd[j].lower,
563  MATRIX_ELEM( sequen[i].delai,j+1,1)),merged_nest[j].lower))
564  {
565  if (!value_eq( value_plus(sequen[i].nd[j].upper,
566  MATRIX_ELEM( sequen[i].delai,j+1,1)),merged_nest[j].upper))
567  {
568  if (e==NULL)
569  e=e2;
570  else
571  e=and_expression(e,e2);
572  };
573  }
574  else
575  {
576  if (value_eq( value_plus(sequen[i].nd[j].upper,
577  MATRIX_ELEM( sequen[i].delai,j+1,1)),merged_nest[j].upper))
578  {
579  if (e==NULL)
580  e=e1;
581  else
582  e=and_expression(e,e1);
583  }
584  else
585  {
586  e1=and_expression(e1,e2);
587  if(e==NULL)
588  e=e1;
589  else
590  e=and_expression(e,e1);
591  }
592  };
593  };
595  m=0;
596  MAP(EXPRESSION,exp,{
597  if (m==0) gauche=exp;
598  if (m==1) droite=exp;
599  m++;
600  },call_arguments(c)) ;
601  pv = vect_make(VECTEUR_NUL, sequen[i].nd[j].index, VALUE_ONE,
602  TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,j+1,1)));
603  delai_plus=Pvecteur_to_expression(pv);
604  replace_entity_by_expression(gauche,(entity) sequen[i].nd[j].index,delai_plus);
606  replace_entity_by_expression(exp,(entity) sequen[i].nd[j].index,delai_plus);
607  };
608  if (e==NULL)
609  s=sequen[i].s;
610  else
611  {
613  s=test_to_statement(t);
614  };
615  if(i==k1-1) lis=CONS(STATEMENT,s,NIL);
616  else lis=CONS(STATEMENT,s,lis);
617  };
618  seq= make_sequence(lis);
619  ins= make_instruction_sequence(seq);
620  s= instruction_to_statement(ins);
621  ls=loop1;
622  for(j=0;j<=depth-1;j++)
623  {
624  range range1;
625  range1=loop_range(ls);
626  range_lower(range1)=int_to_expression(merged_nest[j].lower);
627  range_upper(range1)= int_to_expression(merged_nest[j].upper);
629  else loop_body(ls)=s;
630  };
632  return s;
633 }
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
instruction make_instruction_sequence(sequence _field_)
Definition: ri.c:1169
sequence make_sequence(list a)
Definition: ri.c:2125
#define value_eq(v1, v2)
bool operators on values
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
void replace_entity_by_expression(void *s, entity ent, expression exp)
replace all reference to entity ent by expression exp in s.
Definition: replace.c:220
#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
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define loop_to_statement(l)
#define test_to_statement(t)
#define and_expression(e1, e2)
#define ge_expression(e1, e2)
#define le_expression(e1, e2)
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
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
expression Value_to_expression(Value v)
added interface for linear stuff.
Definition: expression.c:1251
#define loop_body(x)
Definition: ri.h:1644
#define range_upper(x)
Definition: ri.h:2290
#define instruction_loop(x)
Definition: ri.h:1520
#define range_lower(x)
Definition: ri.h:2288
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define loop_range(x)
Definition: ri.h:1642
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
static void compute_bound_merged_nest()
Cette fonction calcule les bornes du nid fusionne.
loop loop1
le nid fusionne
static void compute_delay_merged_nest()
Cette fonction calcule les delais qu'on doit ajouter aux differents nids.

References and_expression, call_arguments, compute_bound_merged_nest(), compute_delay_merged_nest(), CONS, depth, entity_to_expression(), exp, EXPRESSION, expression_syntax, FOREACH, ge_expression, INFO_LOOP::index, instruction_call, instruction_loop, instruction_to_statement(), int_to_expression(), k1, le_expression, loop1, loop_body, loop_range, loop_to_statement, INFO_LOOP::lower, make_block_statement(), make_instruction_sequence(), make_sequence(), make_test(), MAP, MATRIX_ELEM, merged_nest, NIL, Pvecteur_to_expression(), range_lower, range_upper, replace_entity_by_expression(), NID::s, sequen, STATEMENT, statement_instruction, syntax_call, TCST, test_to_statement, INFO_LOOP::upper, value_eq, VALUE_ONE, value_plus, Value_to_expression(), value_uminus, vect_make(), and VECTEUR_NUL.

Referenced by tiling_sequence().

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

◆ fusion_buffer()

static statement fusion_buffer ( )
static

Cette fonction donne le code fusionne avec allocation des tampons.

Definition at line 684 of file tiling_sequence.c.

685 {
686  call c;
687  int m;
688  int i;
689  int j;
690  list lis,lis3,lisi=NULL;
691 
692  entity name;
693 
694  reference ref=NULL;
695  Pmatrix temp1,temp2,temp3;
696  sequence seq;
697  instruction ins;
698  statement s;
699  loop ls;
702 
703 
704  temp1=matrix_new(1,1);
705  temp2=matrix_new(depth,1);
706  temp3=matrix_new(depth,1);
707  for(i=0;i<=k1-1;i++)
708  {
709  expression e1,e2,e,exp,gauche=NULL,droite=NULL;
710  test t;
711  statement s;
712  if (i < k1-1)
713  {
714  sequen[i].coef=matrix_new(1,depth);
715  cons_coef(sequen[i].coef,i);
716  matrix_substract(temp2,sequen[i+1].delai, sequen[i].delai);
717  matrix_substract(temp3, temp2,sequen[i+1].st[0]);
718  matrix_multiply(sequen[i].coef,temp3,temp1);
722  Value_to_expression( sequen[i].surface) );
723  lis=CONS(DIMENSION,
726  (sequen[i].surface,VALUE_ONE)),
727  NIL),
728  NIL);
730 
731  lis =CONS(EXPRESSION, exp, NIL);
732  ref=make_reference(name,lis);
733  sequen[i].ref=name;
734  }
735  e1=ge_expression(entity_to_expression ((entity)sequen[i].nd[0].index),
736  Value_to_expression( value_plus(sequen[i].nd[0].lower,MATRIX_ELEM( sequen[i].delai,1,1))));
737  e2=le_expression(entity_to_expression ((entity)sequen[i].nd[0].index),
738  Value_to_expression( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1))));
739 
740  if (value_eq( value_plus(sequen[i].nd[0].lower,MATRIX_ELEM( sequen[i].delai,1,1)),merged_nest[0].lower))
741  {
742  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),merged_nest[0].upper))
743  {
744  e=NULL;
745  }
746  else
747  {
748  e=e2;
749  }
750  }
751  else
752  {
753  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),merged_nest[0].upper))
754  {
755  e=e1;
756  }
757  else
758  {
759  e=and_expression(e1,e2);
760  }
761  };
762 
763  for(j=1;j<=depth-1;j++)
764  {
765  e1=ge_expression(entity_to_expression ((entity)sequen[i].nd[j].index),
766  Value_to_expression( sequen[i].nd[j].lower+MATRIX_ELEM( sequen[i].delai,j+1,1)));
767 
768  e2=le_expression(entity_to_expression ((entity)sequen[i].nd[j].index),
769  Value_to_expression( sequen[i].nd[j].upper+MATRIX_ELEM( sequen[i].delai,j+1,1)));
770  if (value_eq( value_plus(sequen[i].nd[j].lower,MATRIX_ELEM( sequen[i].delai,j+1,1)),merged_nest[j].lower))
771  {
772  if (!value_eq( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),merged_nest[j].upper))
773  {
774  if (e==NULL)
775  e=e2;
776  else
777  e=and_expression(e,e2);
778  };
779  }
780  else
781  {
782  if (value_eq( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),merged_nest[j].upper))
783  {
784  if (e==NULL)
785  e=e1;
786  else
787  e=and_expression(e,e1);
788  }
789  else
790  {
791  e1=and_expression(e1,e2);
792  if(e==NULL)
793  e=e1;
794  else
795  e=and_expression(e,e1);
796  }
797  };
798 
799 
800 
801  };
802  if(e==NULL)
803  s=sequen[i].s;
804  else
805  {
807  s=test_to_statement(t);
808  };
809 
810  if(i==0) lisi=CONS(STATEMENT,s,NIL);
811  else lisi= gen_nconc(lisi, CONS(STATEMENT,s,NIL));
813  m=0;
814  MAP(EXPRESSION,exp,{
815  if (m==0) gauche=exp;
816  if (m==1) droite=exp;
817  m++;
818  },call_arguments(c)) ;
819  if(i!=k1-1) syntax_reference(expression_syntax(gauche))=ref;
821  if(i==0)
822  {
823  for(j=0;j<=depth-1;j++)
824  {
825  Pvecteur pv;
826  expression delai_plus;
827  pv = vect_make(VECTEUR_NUL, sequen[i].nd[j].index, VALUE_ONE,
828  TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,j+1,1)));
829  delai_plus=Pvecteur_to_expression(pv);
830 
831 
833  replace_entity_by_expression(exp,(entity) sequen[i].nd[j].index,delai_plus);
834 
835  };
836 
837 
838  }
839  else
840  {
841  for(j=0;j<=sequen[i].nbr_stencil-1;j++)
842  {
843  Pvecteur pvt;
844  expression expt;
845  pvt=vect_dup(sequen[i-1].pv_acces) ;
846  matrix_multiply(sequen[i-1].coef,sequen[i].delai,temp1);
847  pvt=vect_make(pvt,TCST, value_uminus (MATRIX_ELEM(temp1,1,1)));
848  matrix_multiply(sequen[i-1].coef,sequen[i-1].delai,temp1);
849  pvt=vect_make(pvt,TCST, MATRIX_ELEM(temp1,1,1) );
850  matrix_multiply(sequen[i-1].coef,sequen[i].st[j],temp1);
851  pvt=vect_make(pvt,TCST,MATRIX_ELEM(temp1,1,1) );
853  Value_to_expression( sequen[i-1].surface) );
854  lis =CONS(EXPRESSION, exp, NIL);
855  ref=make_reference(sequen[i-1].ref,lis);
856  expt=EXPRESSION( CAR(lis3));
857  lis3=CDR(lis3);
859  };
860  };
861 
862  };
863  seq= make_sequence(lisi);
864  ins= make_instruction_sequence(seq);
865  s= instruction_to_statement(ins);
866  ls=loop1;
867  for(j=0;j<=depth-1;j++)
868  {
869  range range1;
870 
871  range1=loop_range(ls);
872  range_lower(range1)=
873  int_to_expression(merged_nest[j].lower);
874  range_upper(range1)=
875  int_to_expression(merged_nest[j].upper);
876 
878  else loop_body(ls)=s;
879 
880  };
881 
883 
884  return s;
885 
886 }
basic make_basic(enum basic_utype tag, void *val)
Definition: ri.c:155
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
dimension make_dimension(expression a1, expression a2, list a3)
Definition: ri.c:565
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
void matrix_multiply(const Pmatrix a, const Pmatrix b, Pmatrix c)
void matrix_multiply(Pmatrix a, Pmatrix b, Pmatrix c): multiply rational matrix a by rational matrix ...
Definition: matrix.c:95
#define binary_intrinsic_expression(name, e1, e2)
@ is_basic_int
Definition: ri.h:571
entity ref
Pmatrix coef
le volume memoire du tableau en ecriture de ce nid
Value surface
le corps de ce nid
Pvecteur pv_acces
le coefficient des fonctions d'acces
static Pvecteur buffer_acces(int nid)
On construit la foction d'acces
static entity internal_make_new_array_variable(int i, int j, entity module, basic b, list lis)
le tableau en entree
static void cons_coef(Pmatrix p, int nid)
N construit la coifficients des fonctions d'acces.
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

References and_expression, binary_intrinsic_expression, buffer_acces(), call_arguments, CAR, CDR, NID::coef, compute_bound_merged_nest(), compute_delay_merged_nest(), CONS, cons_coef(), depth, DIMENSION, entity_to_expression(), exp, EXPRESSION, expression_syntax, FOREACH, ge_expression, gen_nconc(), get_current_module_entity(), INFO_LOOP::index, instruction_call, instruction_loop, instruction_to_statement(), int_to_expression(), internal_make_new_array_variable(), is_basic_int, k1, le_expression, loop1, loop_body, loop_range, loop_to_statement, INFO_LOOP::lower, make_basic(), make_block_statement(), make_dimension(), make_instruction_sequence(), make_reference(), make_sequence(), make_test(), MAP, MATRIX_ELEM, matrix_multiply(), matrix_new(), matrix_substract(), merged_nest, NID::nbr_stencil, NIL, NID::pv_acces, Pvecteur_to_expression(), range_lower, range_upper, NID::ref, ref, replace_entity_by_expression(), NID::s, sequen, STATEMENT, statement_instruction, NID::surface, syntax_call, syntax_reference, TCST, test_to_statement, INFO_LOOP::upper, value_eq, value_minus, VALUE_ONE, value_plus, Value_to_expression(), value_uminus, vect_dup(), vect_make(), and VECTEUR_NUL.

Referenced by tiling_sequence().

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

◆ Hierarchical_tiling()

statement Hierarchical_tiling ( void  )

Definition at line 1021 of file tiling_sequence.c.

1022 {
1023  FILE *infp;
1024  char *name_file;
1025  Pmatrix A,P;
1026  int rw,cl,i,j;
1027  list lis=NULL;
1028  instruction ins;
1029  sequence seq=NULL;
1030  statement s,s1;
1031  loop ls=NULL;
1032  cons *lls=NULL;
1033  Pbase base_oldindex = NULL;
1034  Pbase base_newindex = NULL;
1035  Pbase pb;
1036  expression upper=NULL,lower=NULL;
1037  int plus;
1038  Value elem_mat1,elem_mat2;
1040  name_file = user_request("nom du fichier pour la matrice A ");
1041  infp = safe_fopen(name_file,"r");
1042  matrix_fscan(infp,&A,&rw,&cl);
1043  name_file = user_request("nom du fichier pour la matrice P ");
1044  infp = safe_fopen(name_file,"r");
1045  matrix_fscan(infp,&P,&cl,&cl);
1046  matrix_print(A);
1047  matrix_print(P);
1050  ls=loop1;
1051  for(j=0;j<=depth-1;j++)
1052  {
1053  range range1;
1054  range1=loop_range(ls);
1055  range_lower(range1)=int_to_expression(tiled_nest[j].lower);
1056  range_upper(range1)= int_to_expression(tiled_nest[j].upper);
1058  };
1061  lls = CONS(STATEMENT,s1,lls);
1063  }
1064  (void)loop_iteration_domaine_to_sc(lls, &base_oldindex);
1065 
1066  derive_new_basis_deux(base_oldindex, &base_newindex , make_tile_index_entity_n);
1067  tiling_indice= ( Pvecteur *)malloc(depth *sizeof( Pvecteur*));
1068  plus=depth*3-1;
1069  for (pb =base_newindex; pb!=NULL; pb=pb->succ) {
1070  loop tl;
1071  switch(plus%3)
1072  {
1073  case 2:
1074  {
1075  elem_mat1=MATRIX_ELEM(A,plus/3+1,plus);
1076  elem_mat2=MATRIX_ELEM(A,plus/3+1,plus+1);
1077  upper= int_to_expression(value_minus(elem_mat1,VALUE_ONE));
1078  lower= int_to_expression(0);
1080  };
1081  break;
1082  case 1:
1083  {
1084  elem_mat1=MATRIX_ELEM(A,plus/3+1,plus) ;
1085  elem_mat2=MATRIX_ELEM(A,plus/3+1,plus+1 ) ;
1086  upper= int_to_expression(value_minus(value_div(elem_mat1,elem_mat2),VALUE_ONE));
1087  lower= int_to_expression(0);
1088  tiling_indice[plus/3]=vect_make( tiling_indice[plus/3],pb->var , elem_mat2,TCST,VALUE_ZERO);
1089  };
1090  break;
1091  case 0:
1092  {
1093  elem_mat1=MATRIX_ELEM(A,plus/3+1,plus+1);
1094  upper= int_to_expression(value_div(tiled_nest[plus/3].upper,elem_mat1));
1095  lower= int_to_expression(0);
1096  tiling_indice[plus/3]=vect_make( tiling_indice[plus/3],pb->var ,elem_mat1,TCST,VALUE_ZERO);
1097  };
1098  default: break;
1099  }
1100  tl = make_loop((entity) vecteur_var(pb),
1102  int_to_expression(1)),
1103  s1,
1106  NIL);
1108  plus--;
1109  };
1110 
1111  printf(" azuuuul lalallalalal \n"); getchar();
1112 
1113  /******/
1114  for (i=k1-1;i>=0;i--)
1115  {
1116  expression e1,e2,e,gauche=NULL,droite=NULL,delai_plus;
1117  test t;
1118  call c;
1119  int m;
1120  Pvecteur pv;
1122  Value_to_expression( value_plus(sequen[i].nd[0].lower,
1123  MATRIX_ELEM( sequen[i].delai,1,1))));
1125  Value_to_expression( value_plus(sequen[i].nd[0].upper,
1126  MATRIX_ELEM( sequen[i].delai,1,1))));
1127  if (value_eq( value_plus(sequen[i].nd[0].lower,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].lower))
1128  {
1129  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].upper)&&
1130  value_eq(value_mod( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),
1131  MATRIX_ELEM(A,1,1)),VALUE_ZERO))
1132  e=NULL;
1133  else
1134  e=e2;
1135  }
1136  else
1137  {
1138  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].upper)&&
1139  value_eq(value_mod( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),
1140  MATRIX_ELEM(A,1,1)),VALUE_ZERO))
1141  e=e1;
1142 
1143  else
1144  e=and_expression(e1,e2);
1145 
1146  };
1147 
1148  for(j=0;j<=depth-1;j++)
1149  {
1150 
1151  if (j>=1)
1152  {
1153 
1154 
1156 
1157 
1159  Value_to_expression(value_plus(sequen[i].nd[j].lower,
1160  MATRIX_ELEM( sequen[i].delai,j+1,1))));
1161 
1163  Value_to_expression( value_plus(sequen[i].nd[j].upper,
1164  MATRIX_ELEM( sequen[i].delai,j+1,1))));
1165 
1166  if (value_eq( value_plus(sequen[i].nd[j].lower,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].lower))
1167  {
1168  if (! (value_eq(value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].upper)&&
1169  value_eq(value_mod( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),
1170  MATRIX_ELEM(A,j+1,3*j+1)),VALUE_ZERO)))
1171  {
1172  if (e==NULL)
1173  e=e2;
1174  else
1175  e=and_expression(e,e2);
1176  };
1177  }
1178  else
1179  {
1180  if (value_eq(value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].upper)&&
1181  value_eq(value_mod( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),
1182  MATRIX_ELEM(A,j+1,3*j+1)),VALUE_ZERO))
1183  {
1184  if (e==NULL)
1185  e=e1;
1186  else
1187  e=and_expression(e,e1);
1188  }
1189  else
1190  {
1191  e1=and_expression(e1,e2);
1192  if(e==NULL)
1193  e=e1;
1194  else
1195  e=and_expression(e,e1);
1196  }
1197  };
1198 
1199 
1200  };
1202  m=0;
1203  MAP(EXPRESSION,exp,{
1204  if (m==0) gauche=exp;
1205  if (m==1) droite=exp;
1206  m++;
1207  },call_arguments(c)) ;
1208  pv = vect_make(tiling_indice[j],TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,j+1,1)));
1209  delai_plus=Pvecteur_to_expression(pv);
1210  replace_entity_by_expression(gauche,(entity) sequen[i].nd[j].index,delai_plus);
1212  replace_entity_by_expression(exp,(entity) sequen[i].nd[j].index,delai_plus);
1213  };
1215  s=test_to_statement(t);
1216  if(i==k1-1) lis=CONS(STATEMENT,s,NIL);
1217  else lis=CONS(STATEMENT,s,lis);
1218  };
1219  seq= make_sequence(lis);
1220  ins= make_instruction_sequence(seq);
1221  s= instruction_to_statement(ins);
1223  for(j=0;j<=3*depth-1;j++)
1225  else loop_body(ls)=s;
1226  s1=permutation(s1,P);
1227  return s1;
1228 }
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
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
#define value_mod(v1, v2)
#define value_div(v1, v2)
#define A(i, j)
comp_matrice.c
Definition: comp_matrice.c:63
Psysteme loop_iteration_domaine_to_sc(list, Pbase *)
loop_iteration_domaine_to_sc.c
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
void matrix_print(Pmatrix)
void matrix_print(matrice a): print an (nxm) rational matrix
Definition: matrix_io.c:70
void matrix_fscan(FILE *, Pmatrix *, int *, int *)
void matrix_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCII...
Definition: matrix_io.c:93
string user_request(const char *,...)
#define UU
Definition: newgen_types.h:98
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
entity entity_empty_label(void)
Definition: entity.c:1105
#define instruction_loop_p(x)
Definition: ri.h:1518
@ is_instruction_loop
Definition: ri.h:1471
@ is_execution_sequential
Definition: ri.h:1189
s1
Definition: set.c:247
Definition: pip__tab.h:25
static entity make_tile_index_entity_n(entity old_index, char *su)
statement permutation(statement s, Pmatrix P)
static Pvecteur * tiling_indice
static void compute_bound_tiled_nest()
static void compute_delay_tiled_nest()
static void derive_new_basis_deux(Pbase base_oldindex, Pbase *base_newindex, entity(*new_entity)(entity, char *))
#define vecteur_var(v)

References A, and_expression, call_arguments, compute_bound_tiled_nest(), compute_delay_tiled_nest(), CONS, copy_expression(), depth, derive_new_basis_deux(), entity_empty_label(), exp, EXPRESSION, expression_syntax, FOREACH, ge_expression, INFO_LOOP::index, instruction_call, instruction_loop, instruction_loop_p, instruction_to_statement(), int_to_expression(), is_execution_sequential, is_instruction_loop, k1, le_expression, loop1, loop_body, loop_iteration_domaine_to_sc(), loop_range, loop_to_statement, INFO_LOOP::lower, make_block_statement(), make_execution(), make_instruction(), make_instruction_sequence(), make_loop(), make_range(), make_sequence(), make_test(), make_tile_index_entity_n(), malloc(), MAP, MATRIX_ELEM, matrix_fscan(), matrix_print(), NIL, permutation(), print_expression(), printf(), Pvecteur_to_expression(), range_lower, range_upper, replace_entity_by_expression(), s1, safe_fopen(), sequen, STATEMENT, statement_instruction, Svecteur::succ, syntax_call, TCST, test_to_statement, tiled_nest, tiling_indice, INFO_LOOP::upper, user_request(), UU, value_div, value_eq, value_minus, value_mod, VALUE_ONE, value_plus, Value_to_expression(), value_uminus, VALUE_ZERO, Svecteur::var, vect_make(), VECTEUR_NUL, and vecteur_var.

Referenced by tiling_sequence().

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

◆ internal_make_new_array_variable()

static entity internal_make_new_array_variable ( int  i,
int  j,
entity  module,
basic  b,
list  lis 
)
static

le tableau en entree

J'ai ameliore la fonction make_new_scalar_variable afin de l'etendre a des tableau

Definition at line 87 of file tiling_sequence.c.

89 {
90  char *buffer;
91  if(j==-1)
92  asprintf(&buffer,"%s%d", "B",i);
93  else
94  asprintf(&buffer,"%s%d_%d", "B",i,j);
96  free(buffer);
97  return e;
98 }
void free(void *)
#define asprintf
Definition: misc-local.h:225
static char * module
Definition: pips.c:74
entity make_new_array_variable_with_prefix(const char *, entity, basic, list)
J'ai ameliore la fonction make_new_scalar_variable_with_prefix
Definition: variable.c:785
static string buffer
Definition: string.c:113

References asprintf, buffer, free(), make_new_array_variable_with_prefix(), and module.

Referenced by fusion_buffer(), and Tiling_buffer_allocation().

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

◆ lexi_sup()

static bool lexi_sup ( Pmatrix  a,
Pmatrix  b 
)
static

Cette fonction retourne true si le vecteur 'a' est lexicographiquement superieur au vecteur 'b'.

Definition at line 377 of file tiling_sequence.c.

378 {
379  int i;
380  for (i=1;i<=depth;i++)
381  {
382  if (MATRIX_ELEM(a,i,1) >MATRIX_ELEM(b,i,1))
383  return true;
384  if (MATRIX_ELEM(a,i,1) < MATRIX_ELEM(b,i,1))
385  return false;
386  }
387  return false;
388 }

References depth, and MATRIX_ELEM.

Referenced by trier().

+ Here is the caller graph for this function:

◆ loop_flt()

static bool loop_flt ( loop  l)
static

la premiere boucle d'un nid donne

allouer de la memoire pour les differentes boucles de ce nid

allouer de la memoire pour les differents stencils de ce nid

la borne inferieure

la borne superiere

stocker l'index de la boucle l

stocker sa borne inferieure

stocker sa borne superieure

incrementer le compteur des profondeur des nids

Definition at line 119 of file tiling_sequence.c.

120 {
121  range range1;
122  expression lower, upper;
123  normalized norm1, norm2;
124  Variable index;
125  Pvecteur pv1,pv2;
126  if( ! first_turn ) /* la premiere boucle d'un nid donne */
127  {
128  loop1=copy_loop(l);
129  first_turn = true;
130  /* allouer de la memoire pour les differentes boucles de ce nid */
131  sequen[k1].nd= (struct INFO_LOOP *)malloc(depth_max *sizeof(struct INFO_LOOP));
132  /* allouer de la memoire pour les differents stencils de ce nid */
133  sequen[k1].st= ( Pmatrix *)malloc(st_max *sizeof(Pmatrix));
134  };
135  index =(Variable) loop_index(l);
136  range1=loop_range(l);
137  lower=range_lower(range1); /* la borne inferieure */
138  upper=range_upper(range1); /* la borne superiere */
143  pips_assert("normalized are linear", normalized_linear_p(norm1)&& normalized_linear_p(norm2));
144  pv1= normalized_linear(norm1);
145  pv2= normalized_linear(norm2);
146  sequen[k1].nd[k2].index=index; /* stocker l'index de la boucle l */
147  sequen[k1].nd[k2].lower=vect_coeff(TCST,pv1); /* stocker sa borne inferieure */
148  sequen[k1].nd[k2].upper=vect_coeff(TCST,pv2); /* stocker sa borne superieure */
149  k2++; /* incrementer le compteur des profondeur des nids */
150  return true;
151 }
loop copy_loop(loop p)
LOOP.
Definition: ri.c:1265
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define normalized_linear_p(x)
Definition: ri.h:1779
#define loop_index(x)
Definition: ri.h:1640
#define depth_max
#define st_max
static bool first_turn
Compteurs des suffixes de nouvelles references.

References copy_loop(), depth_max, expression_normalized, first_turn, INFO_LOOP::index, k1, k2, loop1, loop_index, loop_range, INFO_LOOP::lower, malloc(), NID::nd, normalize_all_expressions_of(), normalized_linear, normalized_linear_p, pips_assert, range_lower, range_upper, sequen, NID::st, st_max, TCST, INFO_LOOP::upper, and vect_coeff().

Referenced by tiling_sequence().

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

◆ loop_rwt()

static void loop_rwt ( loop  l,
context_p  context 
)
static

recuperer le coprs de le boucle l

Definition at line 153 of file tiling_sequence.c.

154 {
155  contenu_t contenu;
156  intptr_t depth;
157  statement s = loop_body(l); /* recuperer le coprs de le boucle l */
158  contenu = (contenu_t) hash_get(context->contenu, s);
159  depth= (intptr_t) hash_get(context->depth, s);
160  depth++;
161  hash_put(context->depth,stack_head(context->statement_stack), ( void *) depth);
162  hash_put(context->contenu,stack_head(context->statement_stack), (void *) contenu );
163  if (first_turn)
164  {
165  first_turn=false;
166  k2=0;
167  k1++;
168  }
169 }
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
#define intptr_t
Definition: stdint.in.h:294

References depth, first_turn, hash_get(), hash_put(), intptr_t, k1, k2, loop_body, and stack_head().

Referenced by tiling_sequence().

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

◆ make_tile_index_entity_n()

static entity make_tile_index_entity_n ( entity  old_index,
char *  su 
)
static

Should be AddVariableToCommon(DynamicArea) or something similar!

Definition at line 891 of file tiling_sequence.c.

892 {
893  entity new_index;
894  string old_name;
895  char *new_name = (char*) malloc(33);
896 
897  old_name = entity_name(old_index);
898  for (sprintf(new_name, "%s%s", old_name, su);
900 
901  old_name = new_name) {
902  sprintf(new_name, "%s%s", old_name, su);
903  pips_assert("Variable name cannot be longer than 32 characters",
904  strlen(new_name)<33);
905  }
906 
907  new_index = make_entity(new_name,
908  copy_type(entity_type(old_index)),
909  /* Should be AddVariableToCommon(DynamicArea) or
910  something similar! */
911  copy_storage(entity_storage(old_index)),
912  copy_value(entity_initial(old_index)));
913 
914  return(new_index);
915 }
type copy_type(type p)
TYPE.
Definition: ri.c:2655
value copy_value(value p)
VALUE.
Definition: ri.c:2784
storage copy_storage(storage p)
STORAGE.
Definition: ri.c:2228
static const char * old_name(entity module, entity obj)
old name of obj while in module now.
Definition: compile.c:354
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
#define entity_storage(x)
Definition: ri.h:2794
#define entity_undefined
Definition: ri.h:2761
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define entity_initial(x)
Definition: ri.h:2796

References copy_storage(), copy_type(), copy_value(), entity_domain, entity_initial, entity_name, entity_storage, entity_type, entity_undefined, gen_find_tabulated(), make_entity, malloc(), old_name(), and pips_assert.

Referenced by Hierarchical_tiling(), Tiling2_buffer(), and Tiling_buffer_allocation().

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

◆ permutation()

statement permutation ( statement  s,
Pmatrix  P 
)

Definition at line 957 of file tiling_sequence.c.

960 {
961  statement scopy;
962  int i,j;
963  loop ls1,ls2;
964  bool found=false;
965  scopy=copy_statement(s);
967  for(i=1;i<=3*depth;i++)
968  {
969  j=1;
970  found=false;
972  while ((j<=3*depth)&& !found)
973  {
974  if (value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
975  {
976  found =true;
977  loop_index(ls1)=loop_index(ls2);
978  loop_range(ls1)=loop_range(ls2);
979  };
981  j++;
982  };
984  }
985 
986  return scopy;
987 }

References copy_statement(), depth, instruction_loop, loop_body, loop_index, loop_range, MATRIX_ELEM, statement_instruction, value_eq, and VALUE_ONE.

Referenced by Hierarchical_tiling(), and Tiling2_buffer().

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

◆ permutation2()

statement permutation2 ( statement  s,
Pmatrix  P 
)

Definition at line 989 of file tiling_sequence.c.

992 {
993  statement scopy;
994  int i,j;
995  loop ls1,ls2;
996  bool found=false;
997  scopy=copy_statement(s);
999  for(i=1;i<=2*depth;i++)
1000  {
1001  j=1;
1002  found=false;
1004  while ((j<=2*depth)&& !found)
1005  {
1006  if (value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
1007  {
1008  found =true;
1009  loop_index(ls1)=loop_index(ls2);
1010  loop_range(ls1)=loop_range(ls2);
1011  };
1013  j++;
1014  };
1016  }
1017 
1018  return scopy;
1019 }

References copy_statement(), depth, instruction_loop, loop_body, loop_index, loop_range, MATRIX_ELEM, statement_instruction, value_eq, and VALUE_ONE.

Referenced by Tiling_buffer_allocation().

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

◆ position_one_element()

int position_one_element ( Pmatrix  P,
int  i 
)

Definition at line 1232 of file tiling_sequence.c.

1233 {
1234  int j;
1235  for (j=1;j<=depth;j++)
1236  if(MATRIX_ELEM(P,i,j)==VALUE_ONE) return j;
1237  pips_internal_error("asking for a non existing element");
1238  return -1;
1239 }
#define pips_internal_error
Definition: misc-local.h:149

References depth, MATRIX_ELEM, pips_internal_error, and VALUE_ONE.

Referenced by Tiling_buffer_allocation().

+ Here is the caller graph for this function:

◆ seq_flt()

static bool seq_flt ( )
static

Definition at line 184 of file tiling_sequence.c.

185 {
186  return true;
187 }

Referenced by tiling_sequence().

+ Here is the caller graph for this function:

◆ seq_rwt()

static void seq_rwt ( sequence  sq,
context_p  context 
)
static

Definition at line 189 of file tiling_sequence.c.

190 {
191  contenu_t contenu;
192  intptr_t depth1=0, depth2=0;
193  intptr_t max=0;
194  int i=0;
195  list l= sequence_statements(sq);
196  contenu=is_a_stencil;
197  hash_put(context->contenu, stack_head(context->statement_stack), (void *) contenu);
198  MAP(STATEMENT, s,
199  {
200  contenu = (contenu_t) hash_get(context->contenu, s);
201  if (i==0) depth1 = (intptr_t ) hash_get(context->depth, s);
202  if (contenu ==is_a_stencil)
203  {
204  depth2= (intptr_t ) hash_get(context->depth, s);
205  if (depth1!=depth2)
206  {
207  contenu=is_a_no_stencil;
208  hash_put(context->contenu, stack_head(context->statement_stack),(void *) contenu);
209  };
210  depth1 = depth2;
211  }
212  else
213  {
214  if ( contenu !=is_a_continue)
215  {
216  contenu=is_a_no_stencil;
217  hash_put(context->contenu, stack_head(context->statement_stack),(void *) contenu);
218  };
219  };
220  if (depth2 > max) max=depth2;
221  i++;
222  };, l);
223  hash_put(context->depth,stack_head(context->statement_stack), (void *) max );
224 }
#define max(a, b)
#define sequence_statements(x)
Definition: ri.h:2360

References hash_get(), hash_put(), intptr_t, is_a_continue, is_a_no_stencil, is_a_stencil, MAP, max, sequence_statements, stack_head(), and STATEMENT.

Referenced by tiling_sequence().

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

◆ stmt_flt()

static bool stmt_flt ( statement  s,
context_p  context 
)
static

Definition at line 171 of file tiling_sequence.c.

172 {
173  stack_push(s, context->statement_stack);
174  return true;
175 }
void stack_push(void *, stack)
stack use
Definition: stack.c:373

References stack_push().

Referenced by tiling_sequence().

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

◆ stmt_rwt()

static void stmt_rwt ( statement  s,
context_p  context 
)
static

Definition at line 178 of file tiling_sequence.c.

179 {
180  pips_assert("true", s==s && context==context);
181  stack_pop(context->statement_stack);
182 }
void * stack_pop(stack)
POPs one item from stack s.
Definition: stack.c:399

References pips_assert, and stack_pop().

Referenced by tiling_sequence().

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

◆ test_flt()

static bool test_flt ( )
static

Definition at line 239 of file tiling_sequence.c.

240 {
241  return true;
242 }

Referenced by tiling_sequence().

+ Here is the caller graph for this function:

◆ test_rwt()

static void test_rwt ( context_p  context)
static

Definition at line 244 of file tiling_sequence.c.

245 {
246  contenu_t contenu;
247  contenu=is_a_no_stencil;
248  hash_put(context->contenu, stack_head(context->statement_stack), (void *)contenu );
249  hash_put(context->depth,stack_head(context->statement_stack), ( void *) 0);
250 }

References hash_put(), is_a_no_stencil, and stack_head().

Referenced by tiling_sequence().

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

◆ Tiling2_buffer()

statement Tiling2_buffer ( void  )

Definition at line 2265 of file tiling_sequence.c.

2266 {
2267  FILE *infp;
2268  char *name_file;
2269  Pmatrix A,A1,A2,P, P1,P2,P3;
2270  int rw,cl,i,j;
2271  list lis=NULL;
2272  instruction ins;
2273  sequence seq=NULL;
2274  statement s,s1,s2;
2275  loop ls=NULL;
2276  cons *lls=NULL;
2277  Pbase base_oldindex = NULL;
2278  Pbase base_newindex = NULL;
2279  Pbase pb;
2280  expression upper=NULL,lower=NULL;
2281  int plus;
2282  Value elem_mat1,elem_mat2;
2284  // void full_loop_unroll();
2285  name_file = user_request("nom du fichier pour la matrice A ");
2286  infp = safe_fopen(name_file,"r");
2287  matrix_fscan(infp,&A,&rw,&cl);
2288  name_file = user_request("nom du fichier pour la matrice P ");
2289  infp = safe_fopen(name_file,"r");
2290  matrix_fscan(infp,&P,&cl,&cl);
2291  matrix_print(A);
2292  matrix_print(P);
2293  P1=matrix_new(depth,depth);
2294  for(i=1;i<=depth;i++)
2295  for(j=1;j<=3*depth;j=j+3)
2296  {
2297  if ( value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
2298  MATRIX_ELEM(P1,i,j/3+1)=VALUE_ONE;
2299  else
2300  MATRIX_ELEM(P1,i,j/3+1)=VALUE_ZERO;
2301  };
2302 
2303  P2=matrix_new(depth,depth);
2304  for(i=depth+1;i<=2*depth;i++)
2305  for(j=2;j<=3*depth;j=j+3)
2306  {
2307  if (value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
2308  MATRIX_ELEM(P2,(i-1)%depth+1,j/3+1)=VALUE_ONE;
2309  else
2310  MATRIX_ELEM(P2,(i-1)%depth+1,j/3+1)=VALUE_ZERO;
2311  };
2312 
2313  P3=matrix_new(depth,depth);
2314  for(i=2*depth+1;i<=3*depth;i++)
2315  for(j=3;j<=3*depth;j=j+3)
2316  {
2317  if (value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
2318  MATRIX_ELEM(P3,(i-1)%depth+1,j/3)=VALUE_ONE;
2319  else
2320  MATRIX_ELEM(P3,(i-1)%depth+1,j/3)=VALUE_ZERO;
2321  };
2322 
2323 
2324  A1=matrix_new(depth,1);
2325  for(i=0;i<=depth-1;i++)
2326  MATRIX_ELEM(A1,i+1,1)=MATRIX_ELEM(A,i+1,3*i+1);
2327 
2328  A2=matrix_new(depth,1);
2329  for(i=0;i<=depth-1;i++)
2330  MATRIX_ELEM(A2,i+1,1)=MATRIX_ELEM(A,i+1,3*i+2);
2331 
2332 
2333 
2334  matrix_print(P1);
2335  matrix_print(P2);
2336  matrix_print(P3);
2337  matrix_print(A1);
2338  matrix_print(A2);
2339 
2340  getchar();
2341  getchar();
2342 
2345  ls=loop1;
2346  for(j=0;j<=depth-1;j++)
2347  {
2348  range range1;
2349  range1=loop_range(ls);
2350  range_lower(range1)=int_to_expression(tiled_nest[j].lower);
2351  range_upper(range1)= int_to_expression(tiled_nest[j].upper);
2353  };
2356  lls = CONS(STATEMENT,s1,lls);
2358  }
2359  (void)loop_iteration_domaine_to_sc(lls, &base_oldindex);
2360 
2361  derive_new_basis_deux(base_oldindex, &base_newindex , make_tile_index_entity_n);
2362  tiling_indice= ( Pvecteur *)malloc(depth *sizeof( Pvecteur*));
2363  plus=depth*3-1;
2364  for (pb =base_newindex; pb!=NULL; pb=pb->succ) {
2365  loop tl;
2366  switch(plus%3)
2367  {
2368  case 2:
2369  {
2370  elem_mat1=MATRIX_ELEM(A,plus/3+1,plus);
2371  elem_mat2=MATRIX_ELEM(A,plus/3+1,plus+1);
2372  upper= int_to_expression(value_minus(elem_mat1,VALUE_ONE));
2373  lower= int_to_expression(0);
2375  };
2376  break;
2377  case 1:
2378  {
2379  elem_mat1=MATRIX_ELEM(A,plus/3+1,plus) ;
2380  elem_mat2=MATRIX_ELEM(A,plus/3+1,plus+1 ) ;
2381  upper= int_to_expression(value_minus(value_div(elem_mat1,elem_mat2),VALUE_ONE));
2382  lower= int_to_expression(0);
2383  tiling_indice[plus/3]=vect_make( tiling_indice[plus/3],pb->var , elem_mat2,TCST,VALUE_ZERO);
2384  };
2385  break;
2386  case 0:
2387  {
2388  elem_mat1=MATRIX_ELEM(A,plus/3+1,plus+1);
2389  upper= int_to_expression(value_div(tiled_nest[plus/3].upper,elem_mat1));
2390  lower= int_to_expression(0);
2391  tiling_indice[plus/3]=vect_make( tiling_indice[plus/3],pb->var ,elem_mat1,TCST,VALUE_ZERO);
2392  };
2393  default: break;
2394  }
2395  tl = make_loop((entity) vecteur_var(pb),
2397  int_to_expression(1)),
2398  s1,
2401  NIL);
2403  plus--;
2404  };
2405 
2406 
2407 
2408  /******/
2409  for (i=k1-1;i>=0;i--)
2410  {
2411  expression e1,e2,e,gauche=NULL,droite=NULL,delai_plus;
2412  test t;
2413  call c;
2414  int m;
2415  Pvecteur pv;
2417  Value_to_expression( value_plus(sequen[i].nd[0].lower,
2418  MATRIX_ELEM( sequen[i].delai,1,1))));
2420  Value_to_expression( value_plus(sequen[i].nd[0].upper,
2421  MATRIX_ELEM( sequen[i].delai,1,1))));
2422  if (value_eq( value_plus(sequen[i].nd[0].lower,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].lower))
2423  {
2424  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].upper)&&
2425  value_eq(value_mod( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),
2426  MATRIX_ELEM(A,1,1)),VALUE_ZERO))
2427  e=NULL;
2428  else
2429  e=e2;
2430  }
2431  else
2432  {
2433  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].upper)&&
2434  value_eq(value_mod( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),
2435  MATRIX_ELEM(A,1,1)),VALUE_ZERO))
2436  e=e1;
2437 
2438  else
2439  e=and_expression(e1,e2);
2440 
2441  };
2442  for(j=0;j<=depth-1;j++)
2443  {
2444  if (j>=1)
2445  {
2447  Value_to_expression(value_plus(sequen[i].nd[j].lower,
2448  MATRIX_ELEM( sequen[i].delai,j+1,1))));
2450  Value_to_expression( value_plus(sequen[i].nd[j].upper,
2451  MATRIX_ELEM( sequen[i].delai,j+1,1))));
2452  if (value_eq( value_plus(sequen[i].nd[j].lower,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].lower))
2453  {
2454  if (! (value_eq(value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].upper)&&
2455  value_eq(value_mod( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),
2456  MATRIX_ELEM(A,j+1,3*j+1)),VALUE_ZERO)))
2457  {
2458  if (e==NULL)
2459  e=e2;
2460  else
2461  e=and_expression(e,e2);
2462  };
2463  }
2464  else
2465  {
2466  if (value_eq(value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].upper)&&
2467  value_eq(value_mod( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),
2468  MATRIX_ELEM(A,j+1,3*j+1)),VALUE_ZERO))
2469  {
2470  if (e==NULL)
2471  e=e1;
2472  else
2473  e=and_expression(e,e1);
2474  }
2475  else
2476  {
2477  e1=and_expression(e1,e2);
2478  if(e==NULL)
2479  e=e1;
2480  else
2481  e=and_expression(e,e1);
2482  }
2483  };
2484  };
2486  m=0;
2487  MAP(EXPRESSION,exp,{
2488  if (m==0) gauche=exp;
2489  if (m==1) droite=exp;
2490  m++;
2491  },call_arguments(c)) ;
2492  pv = vect_make(tiling_indice[j],TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,j+1,1)));
2493  delai_plus=Pvecteur_to_expression(pv);
2494  replace_entity_by_expression(gauche,(entity) sequen[i].nd[j].index,delai_plus);
2496  replace_entity_by_expression(exp,(entity) sequen[i].nd[j].index,delai_plus);
2497  };
2499  s=test_to_statement(t);
2500  if(i==k1-1) lis=CONS(STATEMENT,s,NIL);
2501  else lis=CONS(STATEMENT,s,lis);
2502  };
2503  seq= make_sequence(lis);
2504  ins= make_instruction_sequence(seq);
2505  s= instruction_to_statement(ins);
2507  for(j=0;j<=3*depth-1;j++)
2509  else loop_body(ls)=s;
2510  s1=permutation(s1,P);
2511 
2512  i=1;
2513  s2=s1;
2514  while (i <=2*depth)
2515  {
2516  printf(" %d \n", i);
2518  i++;
2519  }
2520  print_statement(s2);
2521  printf(" tptpto \n");
2522  unroll_recursive(s2,depth);
2523 
2524 
2525  return s1;
2526 }
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
static void unroll_recursive(statement s, int n)

References A, and_expression, call_arguments, compute_bound_tiled_nest(), compute_delay_tiled_nest(), CONS, copy_expression(), depth, derive_new_basis_deux(), entity_empty_label(), exp, EXPRESSION, expression_syntax, FOREACH, ge_expression, INFO_LOOP::index, instruction_call, instruction_loop, instruction_loop_p, instruction_to_statement(), int_to_expression(), is_execution_sequential, is_instruction_loop, k1, le_expression, loop1, loop_body, loop_iteration_domaine_to_sc(), loop_range, loop_to_statement, INFO_LOOP::lower, make_block_statement(), make_execution(), make_instruction(), make_instruction_sequence(), make_loop(), make_range(), make_sequence(), make_test(), make_tile_index_entity_n(), malloc(), MAP, MATRIX_ELEM, matrix_fscan(), matrix_new(), matrix_print(), NIL, permutation(), print_statement(), printf(), Pvecteur_to_expression(), range_lower, range_upper, replace_entity_by_expression(), s1, safe_fopen(), sequen, STATEMENT, statement_instruction, Svecteur::succ, syntax_call, TCST, test_to_statement, tiled_nest, tiling_indice, unroll_recursive(), INFO_LOOP::upper, user_request(), UU, value_div, value_eq, value_minus, value_mod, VALUE_ONE, value_plus, Value_to_expression(), value_uminus, VALUE_ZERO, Svecteur::var, vect_make(), VECTEUR_NUL, and vecteur_var.

Referenced by tiling_sequence().

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

◆ Tiling_buffer_allocation()

statement Tiling_buffer_allocation ( void  )

gauche=NULL,droite=NULL

Definition at line 1242 of file tiling_sequence.c.

1243 {
1244  FILE *infp;
1245  char *name_file;
1246  Pmatrix A,P,ATE,ATEP,ATEPP,P1,P2,N[nid_nbr],NP[nid_nbr],G_PRO[nid_nbr], G_PROP[nid_nbr],G_PROPP[nid_nbr];
1247  int rw,cl,i,j,k,pos;
1248  list lis=NULL,lis1=NULL,lis2=NULL;
1249  instruction ins;
1250  sequence seq=NULL;
1251  statement s, s1, sequenp[nid_nbr],
1252  ps1 = statement_undefined, ps2 = statement_undefined /*,*pst1*/;
1253  loop ls=NULL;
1254  cons *lls=NULL;
1255  Pbase base_oldindex = NULL;
1256  Pbase base_newindex = NULL;
1257  Pbase pb;
1258  expression upper=NULL,lower=NULL,exp=NULL;
1259  int plus;
1260  Value elem_mat1,elem_mat2;
1261  entity *ref[nid_nbr],name;
1262  reference *buf_ref[nid_nbr];
1263  statement *scopy[nid_nbr];
1265  Variable *iter, *itert;
1266  name_file = user_request("nom du fichier pour la matrice A ");
1267  infp = safe_fopen(name_file,"r");
1268  matrix_fscan(infp,&A,&rw,&cl);
1269  name_file = user_request("nom du fichier pour la matrice P ");
1270  infp = safe_fopen(name_file,"r");
1271  matrix_fscan(infp,&P,&cl,&cl);
1274  P1=matrix_new(depth,depth);
1275 
1276  for(i=1;i<=depth;i++)
1277  for(j=1;j<=2*depth;j=j+2)
1278  {
1279  if ( value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
1280  MATRIX_ELEM(P1,i,j/2+1)=VALUE_ONE;
1281  else
1282  MATRIX_ELEM(P1,i,j/2+1)=VALUE_ZERO;
1283  };
1284 
1285 
1286  P2=matrix_new(depth,depth);
1287  for(i=depth+1;i<=2*depth;i++)
1288  for(j=2;j<=2*depth;j=j+2)
1289  {
1290  if (value_eq(MATRIX_ELEM(P,i,j),VALUE_ONE))
1291  MATRIX_ELEM(P2,(i-1)%depth+1,j/2)=VALUE_ONE;
1292  else
1293  MATRIX_ELEM(P2,(i-1)%depth+1,j/2)=VALUE_ZERO;
1294  };
1295 
1296  ATE=matrix_new(depth,1);
1297  for(i=0;i<=depth-1;i++)
1298  MATRIX_ELEM(ATE,i+1,1)=MATRIX_ELEM(A,i+1,2*i+1);
1299 
1300  ATEP=matrix_new(depth,1);
1301  matrix_multiply(P1,ATE,ATEP);
1302  ATEPP=matrix_new(depth,1);
1303  matrix_multiply(P2,ATE,ATEPP);
1304 
1305 
1306 
1307 
1310  lls = CONS(STATEMENT,s1,lls);
1312  }
1313 
1314  (void)loop_iteration_domaine_to_sc(lls, &base_oldindex);
1315  derive_new_basis_une(base_oldindex, &base_newindex , make_tile_index_entity_n);
1316 
1317  iter= ( Variable *)malloc(depth *sizeof( Variable));
1318  itert=( Variable *)malloc(depth *sizeof( Variable));
1319  i=2*depth-1;
1320  for (pb =base_newindex; pb!=NULL; pb=pb->succ) {
1321  if (i%2==1) iter[i/2]=(pb->var);
1322  else itert[i/2]=(pb->var);
1323  i--;
1324  };
1325 
1326 
1327  for(i=0;i<=k1-1;i++)
1328  {
1329  //statement s1;
1330  sequence seq;
1331  instruction ins;
1332 
1333  Pvecteur pv;
1334  Value con;
1336  test t;
1337  statement s;
1338  call c;
1339  int m;
1340 
1341  N[i]=matrix_new(depth,1);
1342  for (j=1;j<=depth;j++)
1343  MATRIX_ELEM(N[i],j,1)= value_plus(value_minus(sequen[i].nd[j-1].upper,sequen[i].nd[j-1].lower),VALUE_ONE);
1344  NP[i]=matrix_new(depth,1);
1345  matrix_multiply(P1,N[i],NP[i]);
1346 
1347  if (i<=k1-2)
1348  {
1349 
1350 
1351  lis2=NULL;
1352  G_PRO[i]=matrix_new(depth,1);
1353  for(j=1;j<=depth;j++)
1354  {
1355 
1356  Value temp;
1357 
1358  temp=value_minus(MATRIX_ELEM(sequen[i+1].delai,j,1),MATRIX_ELEM(sequen[i].delai,j,1));
1359  MATRIX_ELEM( G_PRO[i],j,1)=value_minus(temp, MATRIX_ELEM(sequen[i+1].st[0],j,1));
1360  for(k=1;k<=sequen[i].nbr_stencil-1;k++)
1361  {
1362  if (MATRIX_ELEM( G_PRO[i],j,1)< value_minus(temp, MATRIX_ELEM(sequen[i].st[k],j,1)))
1363  MATRIX_ELEM( G_PRO[i],j,1)=value_minus(temp, MATRIX_ELEM(sequen[i].st[k],j,1));
1364  };
1365  };
1366 
1367  G_PROP[i]=matrix_new(depth,1);
1368  matrix_multiply(P1,G_PRO[i],G_PROP[i]);
1369  G_PROPP[i]=matrix_new(depth,1);
1370  matrix_multiply(P2,G_PRO[i],G_PROPP[i]);
1371  ref[i]= ( entity *)malloc((depth+1) *sizeof( entity));
1372  buf_ref[i]=( reference *)malloc((depth+1) *sizeof( reference));
1373  scopy[i]=( statement *)malloc((depth+1) *sizeof( statement));
1374 
1375  for(j=1;j<=depth;j++)
1376  {
1377 
1378  lis= NULL;
1379  lis1=NULL;
1380 
1382  int_to_expression(1),
1383  NIL),
1384  lis);
1385  pos=position_one_element(P1,j);
1386  pv= vect_make(VECTEUR_NUL ,itert[pos-1], VALUE_ONE,TCST,VALUE_ZERO);
1388  lis1 =CONS(EXPRESSION, exp,lis1);
1389 
1390  for (k=1;k<=j-1;k++)
1391  {
1392 
1393  lis=CONS(DIMENSION,
1396  (MATRIX_ELEM(ATEP,k,1),VALUE_ONE)),
1397  NIL),
1398  lis);
1399  pos=position_one_element(P1,k);
1400  pv= vect_make(VECTEUR_NUL ,iter[pos-1], VALUE_ONE,TCST,VALUE_ZERO);
1402 
1403  lis1 =CONS(EXPRESSION, exp,lis1);
1404  }
1405 
1406  if (value_minus (MATRIX_ELEM(G_PROP[i],j,1),VALUE_ONE)==VALUE_MONE)
1407  {
1408 
1409  cavite=int_to_expression(0);
1410  }
1411 
1412  else
1413  {
1414 
1415  cavite =Value_to_expression(value_minus (MATRIX_ELEM(G_PROP[i],j,1),VALUE_ONE));
1416  };
1417  lis=CONS(DIMENSION,
1419  cavite,
1420  NIL),
1421  lis);
1422  pos=position_one_element(P1,k);
1423  con=value_minus(MATRIX_ELEM(G_PRO[i],pos,1), MATRIX_ELEM(ATE,pos,1));
1424  pv= vect_make(VECTEUR_NUL ,iter[pos-1], VALUE_ONE,TCST,con);
1425 
1427 
1428  lis1 =CONS(EXPRESSION, exp,lis1);
1429  for (k=j+1;k<=depth;k++)
1430  {
1431  Value v1;
1432  lis=CONS(DIMENSION,
1435  (MATRIX_ELEM(NP[i],k,1), VALUE_ONE)),
1436  NIL),
1437  lis);
1438  pos=position_one_element(P1,k);
1439  v1=sequen[i].nd[pos-1].lower+MATRIX_ELEM( sequen[i].delai,pos,1 );
1440 
1441 
1442  pv= vect_make(VECTEUR_NUL ,iter[pos-1], VALUE_ONE,itert[pos-1], MATRIX_ELEM(ATE,pos,1) ,TCST,
1443  value_uminus(v1) );
1444 
1445  vect_dump(pv);
1448 
1449  lis1 =CONS(EXPRESSION, exp,lis1);
1450  }
1451 
1452 
1454  buf_ref[i][j-1]=make_reference(name,lis1);
1455  ref[i][j-1]=name;
1456  scopy[i][j-1]=copy_statement(sequen[i].s);
1457 
1458  pos=position_one_element(P1,j);
1459  con=value_minus(MATRIX_ELEM(G_PRO[i],pos,1), MATRIX_ELEM(ATE,pos,1));
1460  pv= vect_make(VECTEUR_NUL ,iter[pos-1], VALUE_ONE,TCST,con);
1462  t= make_test(e,scopy[i][j-1],make_block_statement(NIL));
1463  s=test_to_statement(t);
1464  lis2=CONS(STATEMENT,s,lis2);
1465  c= instruction_call(statement_instruction(( scopy[i][j-1] )));
1466  m=0;
1468  if (m==0)
1469  gauche = exp;
1470  m++;
1471  }
1472  syntax_reference(expression_syntax(gauche))= buf_ref[i][j-1];
1473 
1474 
1475  }
1476 
1477  lis=CONS(DIMENSION,
1479  Value_to_expression(MATRIX_ELEM(G_PROPP[i],1,1)),
1480  NIL),
1481  NIL);
1482  pos=position_one_element(P2,1);
1483  pv= vect_make(VECTEUR_NUL ,iter[pos-1], VALUE_ONE,TCST,VALUE_ZERO);
1484 
1485 
1488 
1489 
1490  lis1 =CONS(EXPRESSION, exp,NIL);
1491  for (k=2;k<=depth;k++)
1492  {
1493  lis=CONS(DIMENSION,
1496  (MATRIX_ELEM(ATEPP,k,1),VALUE_ONE)),
1497  NIL),
1498  lis);
1499  pos=position_one_element(P2,k);
1500  pv= vect_make(VECTEUR_NUL ,iter[pos-1], VALUE_ONE,TCST,VALUE_ZERO);
1502 
1503  lis1 =CONS(EXPRESSION, exp,lis1);
1504  }
1506  buf_ref[i][depth]=make_reference(name,lis1);
1507  ref[i][depth]=name;
1508  scopy[i][depth]=copy_statement(sequen[i].s);
1509  c= instruction_call(statement_instruction(( scopy[i][depth] )));
1510  m=0;
1511  MAP(EXPRESSION,exp,{
1512  if (m==0) gauche=exp;
1513  m++;
1514  },call_arguments(c)) ;
1515  syntax_reference(expression_syntax(gauche))= buf_ref[i][depth];
1516  lis2=CONS(STATEMENT, scopy[i][depth],lis2);
1517  seq= make_sequence(lis2);
1518  ins= make_instruction_sequence(seq);
1519  sequenp[i]= instruction_to_statement(ins);
1520 
1521  };
1522  };
1523 
1524  for(i=1;i<=k1-2;i++)
1525  {
1526  expression e=NULL;
1527  Pvecteur pv;
1528  Pmatrix *temp;
1529  reference *regi[nid_nbr];
1530  int m1;
1531 
1532  for(j=1;j<=depth;j++)
1533  {
1534  Value v2;
1535  v2=value_uminus(MATRIX_ELEM(G_PRO[i-1],j,1));
1536  pv= vect_make(VECTEUR_NUL,iter[j-1], VALUE_ONE,TCST ,v2);
1538  else
1540  }
1541  temp=( Pmatrix *)malloc( sequen[i].nbr_stencil *sizeof(Pmatrix));
1542  regi[i]=( reference *)malloc( sequen[i].nbr_stencil *sizeof(reference));;
1543  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1544  {
1545  entity name;
1546  char buffer[20];
1547  //expression exp;
1548  //reference ref;
1549  temp[k]=matrix_new(depth,1);
1550  matrix_substract(temp[k],sequen[i].delai, sequen[i-1].delai);
1551  matrix_substract(temp[k], temp[k],sequen[i].st[k]);
1552  sprintf(buffer,"%s%d_%d", "R",i+1,k);
1554  make_basic(is_basic_int, (void *) 4) );
1555  regi[i][k]=make_reference(name,NIL);
1556  }
1557  for(j=0;j<=depth;j++)
1558  {
1559  expression droite = expression_undefined, expt;
1560  statement s1,s2,s3;
1561  sequence seq;
1562  instruction ins;
1563  call c;
1564  test t;
1565  int m,l;
1566  list lis,lisp;
1567  reference ref;
1568  s1=copy_statement(scopy[i][j]);
1570  m=0;
1571  MAP(EXPRESSION,exp,{
1572  if (m==1) droite=exp;
1573  m++;
1574  },call_arguments(c)) ;
1576  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1577  {
1578  expression exp;
1579  ref=copy_reference (buf_ref[i-1][depth]); /**** ?????? ****/
1581  for(l=0;l<=depth-1;l++)
1582  {
1583  Pvecteur pv;
1584  expression delai_plus;
1585  pv = vect_make(VECTEUR_NUL,iter[l], VALUE_ONE, TCST,-MATRIX_ELEM(temp[k],l+1,1));
1586  delai_plus=Pvecteur_to_expression(pv);
1587  replace_entity_by_expression(exp,(entity)iter[l],delai_plus);
1588  }
1589  expt=EXPRESSION( CAR(lis));
1590  lis=CDR(lis);
1592  }
1593  lis=NIL;
1594  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1595  {
1596  statement s,*stemp;
1597  stemp=( statement *)malloc( (depth+1) *sizeof(statement));
1598  for(l=0;l<=depth;l++)
1599  {
1600  int r;
1601  expression exp;
1602  reference ref;
1603 
1604  ref=copy_reference (buf_ref[i-1][l]);
1606  for (r=0;r<=depth-1;r++)
1607  {
1608  Pvecteur pv;
1609  expression delai_plus;
1610 
1611  if(r==l)
1612  {
1613  Value t;
1614  int pos;
1615  pos=position_one_element(P1,r+1);
1616  t=value_minus(MATRIX_ELEM(ATEP,r+1,1),MATRIX_ELEM(temp[k],pos,1));
1617  pv = vect_make(VECTEUR_NUL,iter[pos-1], VALUE_ONE, TCST,t);
1618  delai_plus=Pvecteur_to_expression(pv);
1619  replace_entity_by_expression(exp,(entity)iter[pos-1],delai_plus);
1620  }
1621 
1622  else
1623  {
1624  int pos;
1625  pos=position_one_element(P1,r+1);
1626  pv = vect_make(VECTEUR_NUL,iter[pos-1], VALUE_ONE, TCST,-MATRIX_ELEM(temp[k],pos,1));
1627  delai_plus=Pvecteur_to_expression(pv);
1628  replace_entity_by_expression(exp,(entity)iter[pos-1],delai_plus);
1629  }
1630  }
1631 
1632 
1633  r=0;
1634  MAP(EXPRESSION,exp,{
1635 
1636  if (r==depth)
1637  {
1638 
1639  int pos;
1640  expression delai_plus;
1641  pos=position_one_element(P1,l+1);
1642  pv= vect_make(VECTEUR_NUL ,itert[pos-1], VALUE_ONE,TCST,-VALUE_ONE);
1643  delai_plus=Pvecteur_to_expression(pv);
1644  replace_entity_by_expression(exp,(entity)itert[pos-1],delai_plus);
1645 
1646  };
1647  r++;
1648  },reference_indices(ref))
1649 
1651  };
1652  s= stemp[depth];
1653  for(l=depth-1;l>=0;l--)
1654  {
1655  int pos;
1656  Pvecteur pv2;
1657  //statement s1/*,s2*/;
1658  test t;
1659  expression exp;
1660  pos=position_one_element(P1,l+1);
1661  pv2= vect_make(VECTEUR_NUL,iter[pos-1], VALUE_ONE,TCST , -MATRIX_ELEM(temp[k],pos,1));
1663  t= make_test(exp,stemp[l],s);
1664  s=test_to_statement(t);
1665  }
1666  lis=CONS(STATEMENT,s,lis);
1667 
1668  }
1669  s3=copy_statement(s1);
1670 
1672  m=0;
1673  MAP(EXPRESSION,exp,{
1674  if (m==1) droite=exp;
1675  m++;
1676  },call_arguments(c)) ;
1678  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1679  {
1680 
1681  expression expt;
1682 
1683 
1684 
1685  expt=EXPRESSION( CAR(lisp));
1686 
1687  lisp=CDR(lisp);
1688 
1689  syntax_reference(expression_syntax(expt))=regi[i][k];
1690 
1691  }
1692 
1693 
1694 
1695  lis=CONS(STATEMENT,s3,lis);
1696  lis=gen_nreverse(lis);
1697 
1698  seq= make_sequence(lis);
1699  ins= make_instruction_sequence(seq);
1700  s2= instruction_to_statement(ins);
1701  t= make_test(e,s1,s2);
1702  scopy[i][j]=test_to_statement(t);
1703 
1704 
1705  };
1706 
1707  m1=0;
1708 
1710  MAP(STATEMENT,s,{
1711  if (m1!=0)
1712  {
1714 
1715  }
1716  m1++;
1718 
1719 
1720 
1721 
1722 
1723  };
1724  /* ********************************** */
1725 
1726  for(i= k1-1 ;i<=k1-1;i++)
1727  {
1728  expression e=NULL;
1729  Pvecteur pv;
1730  Pmatrix *temp;
1731  reference *regi[nid_nbr];
1732  //int m1;
1733  /* */
1734 
1735  expression droite = expression_undefined, expt;
1736  statement s1,s2,s3;
1737  sequence seq;
1738  instruction ins;
1739  call c;
1740  test t;
1741  int m,l;
1742  list lis,lisp;
1743  reference ref;
1744 
1745 
1746  for(j=1;j<=depth;j++)
1747  {
1748 
1749  Value v2;
1750 
1751 
1752 
1753  v2=value_uminus(MATRIX_ELEM(G_PRO[i-1],j,1));
1754 
1755  pv= vect_make(VECTEUR_NUL,iter[j-1], VALUE_ONE,TCST ,v2);
1756 
1758  else
1760 
1761  }
1762 
1763  temp=( Pmatrix *)malloc( sequen[i].nbr_stencil *sizeof(Pmatrix));
1764  regi[i]=( reference *)malloc( sequen[i].nbr_stencil *sizeof(reference));;
1765  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1766  {
1767  entity name;
1768  char buffer[20];
1769  //expression exp;
1770  //reference ref;
1771  temp[k]=matrix_new(depth,1);
1772 
1773  matrix_substract(temp[k],sequen[i].delai, sequen[i-1].delai);
1774  matrix_substract(temp[k], temp[k],sequen[i].st[k]);
1775 
1776 
1777 
1778  sprintf(buffer,"%s%d_%d", "R",i+1,k);
1780  make_basic(is_basic_int, (void *) 4) );
1781 
1782  regi[i][k]=make_reference(name,NIL);
1783 
1784 
1785 
1786  }
1787 
1788  s1=copy_statement( sequen[i].s);
1789  ps1=s1;
1791  m=0;
1792  MAP(EXPRESSION,exp,{
1793  if (m==1) droite=exp;
1794  m++;
1795  },call_arguments(c)) ;
1797  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1798  {
1799  expression exp;
1800  ref=copy_reference (buf_ref[i-1][depth]);
1802  for(l=0;l<=depth-1;l++)
1803  {
1804  Pvecteur pv;
1805  expression delai_plus;
1806  pv = vect_make(VECTEUR_NUL,iter[l], VALUE_ONE, TCST,-MATRIX_ELEM(temp[k],l+1,1));
1807  delai_plus=Pvecteur_to_expression(pv);
1808  replace_entity_by_expression(exp,(entity)iter[l],delai_plus);
1809  }
1810  expt=EXPRESSION( CAR(lis));
1811  lis=CDR(lis);
1813  }
1814  lis=NIL;
1815  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1816  {
1817  statement s,*stemp;
1818  stemp=( statement *)malloc( (depth+1) *sizeof(statement));
1819  for(l=0;l<=depth;l++)
1820  {
1821  int r;
1822  expression exp;
1823  reference ref;
1824 
1825  ref=copy_reference (buf_ref[i-1][l]);
1826 
1827 
1829  for (r=0;r<=depth-1;r++)
1830  {
1831  Pvecteur pv;
1832  expression delai_plus;
1833 
1834  if(r==l)
1835  {
1836  Value t;
1837  int pos;
1838  pos=position_one_element(P1,r+1);
1839  t=value_minus(MATRIX_ELEM(ATEP,r+1,1),MATRIX_ELEM(temp[k],pos,1));
1840  pv = vect_make(VECTEUR_NUL,iter[pos-1], VALUE_ONE, TCST,t);
1841  delai_plus=Pvecteur_to_expression(pv);
1842  replace_entity_by_expression(exp,(entity) iter[pos-1], delai_plus);
1843  }
1844 
1845  else
1846  {
1847  int pos;
1848  pos=position_one_element(P1,r+1);
1849  pv = vect_make(VECTEUR_NUL,iter[pos-1], VALUE_ONE, TCST,-MATRIX_ELEM(temp[k],pos,1));
1850  delai_plus=Pvecteur_to_expression(pv);
1851  replace_entity_by_expression(exp,(entity) iter[pos-1], delai_plus);
1852  }
1853 
1854  }
1855  r=0;
1856  MAP(EXPRESSION,exp,{
1857 
1858  if (r==depth)
1859  {
1860  int pos;
1861  expression delai_plus;
1862  pos=position_one_element(P1,l+1);
1863 
1864 
1865  pv= vect_make(VECTEUR_NUL ,itert[pos-1], VALUE_ONE,TCST,-VALUE_ONE);
1866 
1867  delai_plus=Pvecteur_to_expression(pv);
1868  replace_entity_by_expression(exp,(entity) itert[pos-1], delai_plus);
1869 
1870 
1871 
1872  };
1873  r++;
1874  },reference_indices(ref));
1875 
1877  };
1878  s= stemp[depth];
1879  for(l=depth-1;l>=0;l--)
1880  {
1881  int pos;
1882  Pvecteur pv2;
1883  //statement s1,s2;
1884  test t;
1885  expression exp;
1886  pos=position_one_element(P1,l+1);
1887  pv2= vect_make(VECTEUR_NUL,iter[pos-1], VALUE_ONE,TCST , -MATRIX_ELEM(temp[k],pos,1));
1889  t= make_test(exp,stemp[l],s);
1890  s=test_to_statement(t);
1891  }
1892  lis=CONS(STATEMENT,s,lis);
1893 
1894  }
1895  s3=copy_statement(s1);
1896  ps2=s3;
1898  m=0;
1899  MAP(EXPRESSION,exp,{
1900  if (m==1) droite=exp;
1901  m++;
1902  },call_arguments(c)) ;
1904  for(k=0;k<=sequen[i].nbr_stencil-1;k++)
1905  {
1906  expression expt;
1907  expt=EXPRESSION( CAR(lisp));
1908  lisp=CDR(lisp);
1909  syntax_reference(expression_syntax(expt))=regi[i][k];
1910  }
1911  lis=CONS(STATEMENT,s3,lis);
1912  lis=gen_nreverse(lis);
1913  seq= make_sequence(lis);
1914  ins= make_instruction_sequence(seq);
1915  s2= instruction_to_statement(ins);
1916  t= make_test(e,s1,s2);
1917  sequen[i].s=test_to_statement(t);
1918 
1919 
1920 
1921  };
1922 
1923 
1924 
1925 
1926 
1927 
1928 /* ************************** */
1929 
1930 
1931 
1932 
1933 
1934 
1935 
1936  ls=loop1;
1937  for(j=0;j<=depth-1;j++)
1938  {
1939  range range1;
1940  range1=loop_range(ls);
1941  range_lower(range1)=int_to_expression(tiled_nest[j].lower);
1942  range_upper(range1)= int_to_expression(tiled_nest[j].upper);
1944  };
1945  tiling_indice= ( Pvecteur *)malloc(depth *sizeof( Pvecteur*));
1946  plus=depth*2-1;
1947 
1948  for (pb =base_newindex; pb!=NULL; pb=pb->succ) {
1949  loop tl;
1950  switch(plus%2)
1951  {
1952  case 1:
1953  {
1954 
1955  elem_mat2=MATRIX_ELEM(A,plus/2+1,plus ) ;
1956 
1957  upper= int_to_expression(value_minus(elem_mat2,VALUE_ONE));
1958 
1959  lower= int_to_expression(0);
1960 
1962 
1963  vect_dump( tiling_indice[plus/2]);
1964 
1965 
1966  break;
1967  }
1968 
1969  case 0:
1970  {
1971  elem_mat1=MATRIX_ELEM(A,plus/2+1,plus+1);
1972  upper= int_to_expression(value_div(tiled_nest[plus/2].upper,elem_mat1));
1973  lower= int_to_expression(0);
1974 
1975  tiling_indice[plus/2]=vect_make( tiling_indice[plus/2],pb->var ,elem_mat1,TCST,VALUE_ZERO);
1976  vect_dup( tiling_indice[plus/2]);
1977 
1978  break;
1979  };
1980 
1981  default: break;
1982  }
1983 
1984  tl = make_loop((entity) vecteur_var(pb),
1986  int_to_expression(1)),
1987  s1,
1990  NIL);
1992 
1993 
1994  plus--;
1995  };
1996 
1997 
1998 
1999  /******/
2000  for (i=k1-1;i>=0;i--)
2001  {
2002  expression e1,e2,e/*,gauche=NULL,droite=NULL*/,delai_plus;
2003  test t;
2004  //call c;
2005  //int m;
2006  //Pvecteur pv;
2008  Value_to_expression( value_plus(sequen[i].nd[0].lower,
2009  MATRIX_ELEM( sequen[i].delai,1,1))));
2011  Value_to_expression( value_plus(sequen[i].nd[0].upper,
2012  MATRIX_ELEM( sequen[i].delai,1,1))));
2013  if (value_eq( value_plus(sequen[i].nd[0].lower,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].lower))
2014  {
2015  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].upper)&&
2016  value_eq(value_mod( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),
2017  MATRIX_ELEM(A,1,1)),VALUE_ZERO))
2018  e=NULL;
2019  else
2020  e=e2;
2021  }
2022  else
2023  {
2024  if (value_eq( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),tiled_nest[0].upper)&&
2025  value_eq(value_mod( value_plus(sequen[i].nd[0].upper,MATRIX_ELEM( sequen[i].delai,1,1)),
2026  MATRIX_ELEM(A,1,1)),VALUE_ZERO))
2027  e=e1;
2028 
2029  else
2030  e=and_expression(e1,e2);
2031 
2032  };
2033 
2034  for(j=0;j<=depth-1;j++)
2035  {
2036  if (j>=1)
2037  {
2039  Value_to_expression(value_plus(sequen[i].nd[j].lower,
2040  MATRIX_ELEM( sequen[i].delai,j+1,1))));
2042  Value_to_expression( value_plus(sequen[i].nd[j].upper,
2043  MATRIX_ELEM( sequen[i].delai,j+1,1))));
2044  if (value_eq( value_plus(sequen[i].nd[j].lower,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].lower))
2045  {
2046  if (! (value_eq(value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].upper)&&
2047  value_eq(value_mod( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),
2048  MATRIX_ELEM(A,j+1,2*j+1)),VALUE_ZERO)))
2049  {
2050  if (e==NULL)
2051  e=e2;
2052  else
2053  e=and_expression(e,e2);
2054  };
2055  }
2056  else
2057  {
2058  if (value_eq(value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),tiled_nest[j].upper)&&
2059  value_eq(value_mod( value_plus(sequen[i].nd[j].upper,MATRIX_ELEM( sequen[i].delai,j+1,1)),
2060  MATRIX_ELEM(A,j+1,2*j+1)),VALUE_ZERO))
2061  {
2062  if (e==NULL)
2063  e=e1;
2064  else
2065  e=and_expression(e,e1);
2066  }
2067  else
2068  {
2069  e1=and_expression(e1,e2);
2070  if(e==NULL)
2071  e=e1;
2072  else
2073  e=and_expression(e,e1);
2074  }
2075  };
2076  };
2077  };
2078  if(i<= k1-2)
2079  {
2080  if(i==0)
2081  {
2082  call c;
2083  int m ,j,l;
2085  Pvecteur pv;
2086 
2087  for(j=0;j<depth+1;j++)
2088  {
2089  c= instruction_call(statement_instruction(( scopy[i][j])));
2090  m=0;
2091  MAP(EXPRESSION,exp,{
2092  if (m==1) droite=exp;
2093  m++;
2094  },call_arguments(c)) ;
2095  for(l=0;l<=depth-1;l++)
2096  {
2097  pv = vect_make(tiling_indice[l],TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,l+1,1)));
2098  delai_plus=Pvecteur_to_expression(pv);
2099 
2101  replace_entity_by_expression(exp,(entity) sequen[i].nd[l].index, delai_plus);
2102  }
2103  }
2104  }
2105 
2106  t= make_test(e,sequenp[i],make_block_statement(NIL));
2107  }
2108  else
2109  {
2110  call c;
2111  int m ,j;
2113  Pvecteur pv;
2115  m=0;
2116  MAP(EXPRESSION,exp,{
2117  if (m==0) gauche=exp;
2118  m++;
2119  },call_arguments(c)) ;
2120  for(j=0;j<=depth-1;j++)
2121  {
2122  pv = vect_make(tiling_indice[j],TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,j+1,1)));
2123  delai_plus=Pvecteur_to_expression(pv);
2124  replace_entity_by_expression(gauche,(entity) sequen[i].nd[j].index, delai_plus);
2125  }
2127  m=0;
2128  MAP(EXPRESSION,exp,{
2129  if (m==0) gauche=exp;
2130  m++;
2131  },call_arguments(c)) ;
2132  for(j=0;j<=depth-1;j++)
2133  {
2134  pv = vect_make(tiling_indice[j],TCST,value_uminus(MATRIX_ELEM(sequen[i].delai,j+1,1)));
2135  delai_plus=Pvecteur_to_expression(pv);
2136  replace_entity_by_expression(gauche,(entity) sequen[i].nd[j].index, delai_plus);
2137  }
2138 
2139 
2140 
2142  };
2143  s=test_to_statement(t);
2144 
2145  if(i==k1-1) lis=CONS(STATEMENT,s,NIL);
2146  else lis=CONS(STATEMENT,s,lis);
2147 
2148  };
2149 
2150  seq= make_sequence(lis);
2151  ins= make_instruction_sequence(seq);
2152  s= instruction_to_statement(ins);
2154  for(j=0;j<=2*depth-1;j++)
2156  else loop_body(ls)=s;
2157 
2158 
2159  s1=permutation2(s1,P);
2160 
2161  return s1;
2162 }
reference copy_reference(reference p)
REFERENCE.
Definition: ri.c:2047
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
#define VALUE_MONE
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
struct _newgen_struct_reference_ * reference
Definition: compsec.h:14
#define CHUNK(x)
Definition: genC.h:90
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
statement make_assign_statement(expression, expression)
Definition: statement.c:583
#define NP
Definition: iabrev.h:22
void vect_dump(Pvecteur v)
void vect_dump(Pvecteur v): print sparse vector v on stderr.
Definition: io.c:304
#define lt_expression(e1, e2)
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
expression reference_to_expression(reference r)
Definition: expression.c:196
entity make_scalar_entity(const char *, const char *, basic)
entity make_scalar_entity(name, module_name, base)
Definition: variable.c:331
#define expression_undefined
Definition: ri.h:1223
#define test_true(x)
Definition: ri.h:2835
#define instruction_sequence(x)
Definition: ri.h:1514
#define instruction_test(x)
Definition: ri.h:1517
#define statement_undefined
Definition: ri.h:2419
#define nid_nbr
statement permutation2(statement s, Pmatrix P)
int position_one_element(Pmatrix P, int i)
static void derive_new_basis_une(Pbase base_oldindex, Pbase *base_newindex, entity(*new_entity)(entity, char *))
A gen_chunk is used to store every object.
Definition: genC.h:58

References A, and_expression, binary_intrinsic_expression, buffer, call_arguments, CAR, CDR, CHUNK, compute_bound_tiled_nest(), compute_delay_tiled_nest(), CONS, copy_expression(), copy_reference(), copy_statement(), depth, derive_new_basis_une(), DIMENSION, entity_empty_label(), exp, EXPRESSION, expression_syntax, expression_undefined, FOREACH, ge_expression, gen_nreverse(), get_current_module_entity(), INFO_LOOP::index, instruction_call, instruction_loop, instruction_loop_p, instruction_sequence, instruction_test, instruction_to_statement(), int_to_expression(), internal_make_new_array_variable(), is_basic_int, is_execution_sequential, is_instruction_loop, k1, le_expression, loop1, loop_body, loop_iteration_domaine_to_sc(), loop_range, loop_to_statement, INFO_LOOP::lower, lt_expression, make_assign_statement(), make_basic(), make_block_statement(), make_dimension(), make_execution(), make_instruction(), make_instruction_sequence(), make_loop(), make_range(), make_reference(), make_scalar_entity(), make_sequence(), make_test(), make_tile_index_entity_n(), malloc(), MAP, MATRIX_ELEM, matrix_fscan(), matrix_multiply(), matrix_new(), matrix_substract(), module_local_name(), NID::nbr_stencil, NID::nd, nid_nbr, NIL, NP, permutation2(), position_one_element(), print_expression(), Pvecteur_to_expression(), range_lower, range_upper, ref, reference_indices, reference_to_expression(), replace_entity_by_expression(), NID::s, s1, safe_fopen(), sequen, sequence_statements, STATEMENT, statement_instruction, statement_undefined, Svecteur::succ, syntax_call, syntax_reference, TCST, test_to_statement, test_true, tiled_nest, tiling_indice, INFO_LOOP::upper, user_request(), UU, value_div, value_eq, value_minus, value_mod, VALUE_MONE, VALUE_ONE, value_plus, Value_to_expression(), value_uminus, VALUE_ZERO, Svecteur::var, vect_dump(), vect_dup(), vect_make(), VECTEUR_NUL, and vecteur_var.

Referenced by tiling_sequence().

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

◆ tiling_sequence()

bool tiling_sequence ( string  module)
Parameters
moduleodule

Definition at line 2534 of file tiling_sequence.c.

2535 {
2536  statement stat,s1=NULL;
2538  contenu_t contenu;
2539 
2540  debug_on("STATISTICS_DEBUG_LEVEL");
2541  pips_debug(1, "considering module %s\n", module);
2543 
2544  stat = (statement) db_get_memory_resource(DBR_CODE, module, true);
2545 
2546  context.contenu = hash_table_make(hash_pointer, 0);
2547  context.depth = hash_table_make(hash_pointer, 0);
2548  context.statement_stack = stack_make(statement_domain, 0, 0);
2549 
2551  (stat, & context,
2560  NULL);
2561  contenu = (contenu_t) hash_get(context.contenu, stat);
2562  depth = (intptr_t ) hash_get(context.depth, stat);
2563 
2564  if (contenu!=is_a_stencil)
2565  {
2566  printf(" Le programme ne repond pas aux hypotheses \n");
2567  array_overflow();
2568  }
2569  else
2570  {
2571  if(!array_overflow())
2572  {
2573  int choix ;
2574  printf("--------------Choix de la transformation-------\n");
2575  printf(" 1: Fusion \n");
2576  printf(" 2: Fusion avec allocation des tampons \n");
2577  printf(" 3: Tiling \n");
2578  printf(" 4: Tiling a seul niveau avec allocation des tampons \n");
2579  printf(" 5: Tiling a deux niveaux avec allocation des tampons \n");
2580  printf(" Choix: ");
2581  if(scanf("%d", &choix)!=1)
2582  pips_user_error("Undefined variable \"choix\".\n");
2583  switch(choix)
2584  {
2585  case 1: s1=fusion();
2586  break;
2587  case 2: s1= fusion_buffer();
2588  break;
2589  case 3: s1=Hierarchical_tiling();
2590  break;
2591  case 4: s1=Tiling_buffer_allocation();
2592  break;
2593  case 5: s1=Tiling2_buffer();
2594  break;
2595  default: break;
2596  }
2597  module_reorder(s1);
2598  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module, s1);
2599  }
2600  }
2602  // reset_current_module_statement();
2603 
2604  pips_debug(1, "done.\n");
2605  debug_off();
2606  return true;
2607 }
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
Definition: genClib.c:3373
bool gen_false(__attribute__((unused)) gen_chunk *unused)
Return false and ignore the argument.
Definition: genClib.c:2796
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
#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
#define pips_user_error
Definition: misc-local.h:147
@ hash_pointer
Definition: newgen_hash.h:32
stack stack_make(int, int, int)
allocation
Definition: stack.c:246
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
#define test_domain
newgen_entity_domain_defined
Definition: ri.h:418
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define unstructured_domain
newgen_type_domain_defined
Definition: ri.h:442
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
#define whileloop_domain
newgen_variable_domain_defined
Definition: ri.h:466
#define sequence_domain
newgen_reference_domain_defined
Definition: ri.h:346
cette structure contient une pile.
static bool stmt_flt(statement s, context_p context)
static statement fusion()
cette fonction donne le code fusionne
statement Tiling_buffer_allocation()
static bool seq_flt()
static bool array_overflow()
statement Hierarchical_tiling()
static void stmt_rwt(statement s, context_p context)
static void call_rwt(call ca, context_p context)
static void loop_rwt(loop l, context_p context)
static bool loop_flt(loop l)
static void seq_rwt(sequence sq, context_p context)
static bool uns_flt()
statement Tiling2_buffer()
static void wl_rwt(context_p context)
static statement fusion_buffer()
Cette fonction donne le code fusionne avec allocation des tampons.
static void test_rwt(context_p context)
static bool test_flt()
static bool call_flt()
static void uns_rwt(context_p context)

References array_overflow(), call_domain, call_flt(), call_rwt(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, depth, expression_domain, fusion(), fusion_buffer(), gen_context_multi_recurse(), gen_false(), gen_null(), gen_true(), hash_get(), hash_pointer, hash_table_make(), Hierarchical_tiling(), intptr_t, is_a_stencil, local_name_to_top_level_entity(), loop_domain, loop_flt(), loop_rwt(), module, module_reorder(), pips_debug, pips_user_error, printf(), reset_current_module_entity(), s1, seq_flt(), seq_rwt(), sequence_domain, set_current_module_entity(), stack_make(), statement_domain, stmt_flt(), stmt_rwt(), test_domain, test_flt(), test_rwt(), Tiling2_buffer(), Tiling_buffer_allocation(), uns_flt(), uns_rwt(), unstructured_domain, whileloop_domain, and wl_rwt().

+ Here is the call graph for this function:

◆ trier()

static void trier ( Pmatrix st,
int  length 
)
static

Cette fonction trie un tableau de stencil d'un nid donne.

st est le tableau de stencils et length sa taille

Definition at line 393 of file tiling_sequence.c.

394 {
395  Value temp;
396  int i, j,k;
397  for (i=0;i<=length-2;i++)
398  for(j=i+1;j<=length-1;j++)
399  {
400  if (lexi_sup(st[i],st[j]))
401  {
402  for (k=1;k<=depth;k++)
403  {
404  temp= MATRIX_ELEM(st[j],k,1);
405  MATRIX_ELEM(st[j],k,1)= MATRIX_ELEM(st[i],k,1);
406  MATRIX_ELEM(st[i],k,1)=temp;
407  };
408  };
409  };
410 }
static bool lexi_sup(Pmatrix a, Pmatrix b)
Cette fonction retourne true si le vecteur 'a' est lexicographiquement superieur au vecteur 'b'.

References depth, lexi_sup(), and MATRIX_ELEM.

Referenced by array_overflow().

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

◆ unroll_recursive()

static void unroll_recursive ( statement  s,
int  n 
)
static

Definition at line 2252 of file tiling_sequence.c.

2254 {
2255  if (n==1)
2256  full_loop_unroll(s);
2257  else
2258  {
2259 
2261  full_loop_unroll(s);
2262  };
2263 }
void full_loop_unroll(statement loop_statement)
get rid of the loop by body replication;
Definition: loop_unroll.c:788

References full_loop_unroll(), instruction_loop, loop_body, and statement_instruction.

Referenced by Tiling2_buffer().

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

◆ uns_flt()

static bool uns_flt ( )
static

Definition at line 226 of file tiling_sequence.c.

227 {
228  return true;
229 }

Referenced by tiling_sequence().

+ Here is the caller graph for this function:

◆ uns_rwt()

static void uns_rwt ( context_p  context)
static

Definition at line 231 of file tiling_sequence.c.

232 { contenu_t contenu;
233 
234  contenu=is_a_no_stencil;
235  hash_put(context->contenu,stack_head(context->statement_stack),(void *)contenu );
236  hash_put(context->depth,stack_head(context->statement_stack), ( void *) 0);
237 }

References hash_put(), is_a_no_stencil, and stack_head().

Referenced by tiling_sequence().

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

◆ wl_rwt()

static void wl_rwt ( context_p  context)
static

Definition at line 368 of file tiling_sequence.c.

369 {
370  contenu_t contenu;
371  contenu=is_a_no_stencil;
372  hash_put(context->contenu,stack_head(context->statement_stack),(void *)contenu );
373  hash_put(context->depth,stack_head(context->statement_stack), ( void *) 0);
374 }

References hash_put(), is_a_no_stencil, and stack_head().

Referenced by tiling_sequence().

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

Variable Documentation

◆ depth

◆ first_array

entity first_array

une copie de l'un des nids de la sequence

Definition at line 83 of file tiling_sequence.c.

Referenced by array_overflow(), call_rwt(), and top_down_abc_flt().

◆ first_turn

bool first_turn =false
static

Compteurs des suffixes de nouvelles references.

first_turn permet de detecter le premier retour de la fonction loop_rwt()
overflow permet de detecter un debordemebnt dans l'un des nids

Definition at line 111 of file tiling_sequence.c.

Referenced by loop_flt(), and loop_rwt().

◆ k1

◆ k2

◆ loop1

◆ merged_nest

info_loop* merged_nest
static

la pronfondeur des nids

Definition at line 79 of file tiling_sequence.c.

Referenced by compute_bound_merged_nest(), fusion(), and fusion_buffer().

◆ overflow

bool overflow =false
static

Definition at line 111 of file tiling_sequence.c.

Referenced by array_overflow(), and VASNPRINTF().

◆ sequen

◆ tiled_nest

info_loop * tiled_nest
static

◆ tiling_indice

Pvecteur* tiling_indice
static

Definition at line 72 of file tiling_sequence.c.

Referenced by Hierarchical_tiling(), Tiling2_buffer(), and Tiling_buffer_allocation().