PIPS
tiling.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include "genC.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "matrice.h"
#include "tiling.h"
+ Include dependency graph for tiling.c:

Go to the source code of this file.

Functions

tiling loop_nest_to_tile (Psysteme sc, int ls, Pbase base_index, int first_parallel_level, int last_parallel_level, int perfect_nested_level)
 Code Generation for Distributed Memory Machines. More...
 

Function Documentation

◆ loop_nest_to_tile()

tiling loop_nest_to_tile ( Psysteme  sc,
int  ls,
Pbase  base_index,
int  first_parallel_level,
int  last_parallel_level,
int  perfect_nested_level 
)

Code Generation for Distributed Memory Machines.

tiling.c

Functions to decide a specific tiling for a loop nest

File: tiling.c

PUMA, ESPRIT contract 2701

Francois Irigoin, Corinne Ancourt, Lei Zhou 1991 loop_nest_to_tile():

Because the number of elements per bank ligne is usefull to optimize the tiling, parameter ls is used temporarily to build it. Because ls is the number of bytes of each bank ligne, it is divided by the assumed number of bytes needed for the
location of one element (4 for int and real)

build the diagonal matrix: ls x I

build origin tile vector as the first iteration to minimize the number of partial tiles (heuristics)

vect_chg_coeff(&porigin,var,min);

Parameters
scc
lss
base_indexase_index
first_parallel_levelirst_parallel_level
last_parallel_levelast_parallel_level
perfect_nested_levelerfect_nested_level

Definition at line 58 of file tiling.c.

65 {
66 
67  tiling tile;
68  matrice M;
69  Pvecteur porigin = VECTEUR_NUL;
70  Pvecteur pv;
71  int vs = vect_size((Pvecteur)(base_index));
72  Psysteme sc_proj;
73  Value min,max;
74  bool faisable;
75  int i;
76 
77  /* Because the number of elements per bank ligne is usefull to
78  optimize the tiling, parameter ls is used temporarily to build it.
79  Because ls is the number of bytes of each bank ligne, it is
80  divided by the assumed number of bytes needed for the
81  location of one element (4 for int and real) */
82 
83  int lsd = ls/4;
84 
85  /* build the diagonal matrix: ls x I */
86 
87  M = matrice_new(vs,vs);
88  matrice_nulle(M,vs,vs);
89  for (i =1; i<= vs && i < first_parallel_level; i++)
90  ACCESS(M,vs,i,i) = VALUE_ONE;
91  for (; i<= vs && i <= last_parallel_level; i++)
92  ACCESS(M,vs,i,i) = int_to_value(lsd);
93  for (i = MIN(perfect_nested_level+1,last_parallel_level+1); i<= vs; i++)
94  ACCESS(M,vs,i,i) = VALUE_CONST(999);
95 
96 
97  /* build origin tile vector as the first iteration to minimize
98  the number of partial tiles (heuristics) */
99 
100  for (pv = base_index; !VECTEUR_NUL_P(pv); pv = pv->succ) {
101  Variable var = vecteur_var(pv);
102  sc_proj = sc_dup(sc);
103  faisable = sc_minmax_of_variable(sc_proj,var, &min, &max);
104  if (faisable)
105  /* vect_chg_coeff(&porigin,var,min);*/
106  vect_chg_coeff(&porigin,var,VALUE_ONE);
107  else
108  pips_internal_error("illegal empty iteration domain");
109 
110  }
111 
112  tile = make_tiling(M, porigin);
113  return tile;
114 }
tiling make_tiling(matrice a1, Pvecteur a2)
Definition: tiling.c:56
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define VALUE_CONST(val)
#define MIN(x, y)
minimum and maximum if they are defined somewhere else, they are very likely to be defined the same w...
int Value
#define VALUE_ONE
#define min(a, b)
#define max(a, b)
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77
Value * matrice
package matrice
Definition: matrice-local.h:71
void matrice_nulle(matrice Z, int n, int m)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrice.c:311
#define pips_internal_error
Definition: misc-local.h:149
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, Value *pmax)
void sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour tr...
Definition: sc_eval.c:143
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
#define vecteur_var(v)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define VECTEUR_NUL_P(v)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143

References ACCESS, int_to_value, make_tiling(), matrice_new, matrice_nulle(), max, min, MIN, pips_internal_error, sc_dup(), sc_minmax_of_variable(), Svecteur::succ, VALUE_CONST, VALUE_ONE, vect_chg_coeff(), vect_size(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

Referenced by loop_nest_to_wp65_code().

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