25 #include "pips_config.h"
42 #include "constants.h"
70 #define sys_debug(level, msg, sc) \
72 pips_debug(level, msg); \
73 sc_fprint(stderr, sc, (get_variable_name_t) entity_local_name); \
87 debug(8,
"build_image_base",
"begin\n");
107 debug(8,
"build_image_base",
"end\n");
117 for (pv =
sb; pv !=NULL;
118 (void)
fprintf(stderr,
"%s_%s,",
136 update_basis(scbase,index_base,const_base,image_base,bank_indices,tile_indices,lindex,lvar_coeff_nunit,lvar_coeff_unit,loop_body_offsets,loop_body_indices, bank_code,ppid)
144 Pbase *lvar_coeff_nunit;
145 Pbase *lvar_coeff_unit;
146 Pbase *loop_body_offsets;
147 Pbase *loop_body_indices;
154 debug(8,
"update_basis",
"begin\n");
156 (void)
fprintf(stderr,
"BASIS PRINTING: \n");
157 (void)
fprintf(stderr,
" sc_base :");
159 (void)
fprintf(stderr,
" const_base :");
161 (void)
fprintf(stderr,
" bank_indices ");
163 (void)
fprintf(stderr,
" index_base");
165 (void)
fprintf(stderr,
" tile_indices");
167 (void)
fprintf(stderr,
" loop_body_indices");
188 *lvar_coeff_nunit =
base_dup(scbase);
198 for (pv1 = *image_base;
205 *lvar_coeff_unit =
base_dup(*lvar_coeff_nunit);
213 *loop_body_offsets =
base_dup(tile_indices);
215 (void)
fprintf(stderr,
"New BASIS:");
217 (void)
fprintf(stderr,
" base lindex:");
219 (void)
fprintf(stderr,
" base index:");
221 (void)
fprintf(stderr,
" lvar_coeff_nunit:");
223 (void)
fprintf(stderr,
" lvar_coeff_unit:");
226 debug(8,
"update_basis",
"end\n");
238 Pbase *new_tile_indices;
247 for (j=1,pv=tile_indices; pv!=NULL;j++,pv=pv->
succ) {
251 *new_tile_indices =pv2 ;
277 sc_add_ineg(ps1,pc2);
279 sc_add_ineg(ps2,pc2);
289 sc_add_ineg(ps2,pc2);
336 Pbase loop_body_indices,
341 Psysteme sc_proj,*list_of_systems,sc_proj2,sc_image2,sc_on_constants;
360 Pbase loop_body_offsets;
369 #define maxscinfosize 100
376 debug(3,
"movement_computation",
"begin\n");
400 sc_image2 =
sc_dup(sc_image);
401 sc_proj =
sc_dup(sc_image2);
412 bank_indices,tile_indices,&lindex,&lvar_coeff_nunit,
413 &lvar_coeff_unit,&loop_body_offsets,&loop_body_indices,
419 sys_debug(2,
"Domain before Projection :\n",sc_proj);
431 sys_debug(2,
" After FM projection :\n", sc_proj);
434 sc_proj->
base, index_base,
437 pips_debug(2,
" After FM projection and sort:\n");
447 sc_proj = sc_integer_projection_along_variables(
448 sc_image2,sc_proj, index_base, lvar_coeff_nunit, sc_info,dim_h2,n);
459 sys_debug(2,
" Before contrainte sort :\n",sc_proj);
464 sc_proj->
base, index_base,
467 sys_debug(5,
" After contrainte sort:\n",sc_proj);
471 sys_debug(5,
"After Integer Projection :\n",sc_proj);
475 sc_proj2 =
sc_dup(sc_proj);
477 sys_debug(4,
"sc_proj2 [dup] = \n", sc_proj2);
481 for (pv1 = const_base2; pv1 != NULL; pv1 = pv1->
succ)
484 sc_proj = sc_projection_on_list_of_variables
485 (sc_image2, image_base, lindex);
489 sys_debug(4,
"sc_proj2 [inter] = \n", sc_proj2);
492 sys_debug(4,
"sc_proj2 [norm] = \n", sc_proj2);
494 sys_debug(9,
"sc_image2 [minmax] = \n", sc_image2);
496 sys_debug(4,
"sc_proj2 [minmax] = \n", sc_proj2);
501 sys_debug(2,
"Iterat. Domain Before redundancy elimin.:\n",sc_proj2);
507 sc_proj2->
base, index_base,
510 sys_debug(2,
"Iterat. Domain After 1rst sort:\n",sc_proj2);
514 sys_debug(2,
" After redundancy elimination :\n",sc_proj2);
526 for (pv1 = tile_indices; pv1!=NULL; pv1=pv1->
succ)
528 for (pv1 = bank_indices; pv1!=NULL; pv1=pv1->
succ)
530 for (pv1 = ppid; pv1!=NULL; pv1=pv1->
succ)
537 for (i = 1; sc_on_constants != NULL && i <=
vect_size(image_base);i++) {
543 pips_debug(8,
"Constraints on the %d-th var.:\n",i);
548 var_id = (bank_code) ?
vect_dup(ppid) :
552 loop_body_offsets,var_id,
553 list_of_systems,index_base,n,sc_info);
560 debug(3,
"movement_computation",
"end\n");
572 Psysteme sc_image_computation(
module,entity_var,sc_domain,sc_array_function, index_base,const_base,proc_id,bank_indices,tile_indices,new_tile_indices,pn,bn,ls,n,dim_h)
584 Pbase *new_tile_indices;
611 debug(3,
"sc_image_computation",
"begin\n");
619 if (!sc_faisabilite(sc_domain2))
620 (void)
fprintf(stderr,
"systeme non faisable en reels \n");
625 bank_indices,entity_var);
626 sc_domain2 =
sc_append(sc_domain2,sc_machine);
634 for (pv = index_base;
639 pips_debug(8,
"\n constant basis - sc_image_computation:");
646 for (pv1 = index_base, ma=0;
648 ma ++, pv1 = pv1->
succ);
649 for (pv1 = *const_base, mb=1;
651 mb ++, pv1 = pv1->succ);
655 n2 = sc_array_function->
nb_ineq;
680 *const_base,
F,F0,n2,ma,mb);
686 (void)
fprintf(stderr,
" matrice F\n");
691 (void)
fprintf(stderr,
" matrice P\n");
693 (void)
fprintf(stderr,
" matrice Q\n");
698 *dim_h =
dim_H(HERM,n2,ma);
703 (void)
fprintf(stderr,
" matrix of new iteration domain \n");
707 for (i = 1; i<= ma;i++) {
711 pvi = new_index_base;
718 *const_base,R,
B,n1,ma,mb);
719 list_new_var = new_index_base;
720 for (i = 1,pc=sc_array_function->
inegalites,pbv = list_new_var;
723 if (
vect_size(pc->vecteur) == 1 && pc->vecteur->var ==
TCST) {
730 TCST,pc->vecteur->val);
742 pips_debug(3,
" New Matrix for Array Function \n");
748 new_index_base,*const_base,
768 debug(3,
"sc_image_computation",
"end\n");
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
#define value_uminus(val)
unary operators on values
Pvecteur vect_rename(Pvecteur v, Pbase b, char *(*variable_name)(Variable))
Pvecteur vect_rename(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its coo...
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
int search_higher_rank(Pvecteur vect, Pbase base)
int search_higher_rank(): this fonction returns the rank of the variable of higher rank in the vecteu...
Psysteme build_sc_machine(int pn, int bn, int ls, Psysteme sc_array_function, entity proc_id, Pbase bank_indices, entity entity_var)
PACKAGE MOVEMENTS.
#define A(i, j)
comp_matrice.c
void constraint_distribution(Psysteme sc, Psysteme *bound_systems, Pbase index_base, int sc_info[][4])
Distribution of the constraints of the system sc into several systems.
#define CONTRAINTE_UNDEFINED_P(c)
#define CONTRAINTE_UNDEFINED
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
void eq_set_vect_nul(Pcontrainte)
void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == ...
#define CAR(pcons)
Get the value of the first element of a list.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
float_t space[SIZE][SIZE]
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
int vect_size(Pvecteur v)
package vecteur - reductions
void wp65_debug_print_text(entity m, statement s)
include "values.h"
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Value * matrice
package matrice
int dim_H(matrice H, int n, int m)
Calcul de la dimension de la matrice de Hermite H.
void matrice_hermite(Value *MAT, int n, int m, Value *P, Value *H, Value *Q, Value *det_p, Value *det_q)
package matrice
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r)
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r): multiply rational matrix...
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
void matrice_identite(matrice, int, int)
void matrice_identite(matrice ID, int n, int level) Construction d'une sous-matrice identite dans ID(...
void matrice_fprint(FILE *, matrice, int, int)
matrice_io.c
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
void print_fullname_base(Pbase sb)
void update_basis(Pbase scbase, Pbase *index_base, Pbase *const_base, Pbase *image_base, Pbase bank_indices, Pbase tile_indices, Pbase *lindex, Pbase *lvar_coeff_nunit, Pbase *lvar_coeff_unit, Pbase *loop_body_offsets, Pbase *loop_body_indices, bool bank_code, Pbase ppid)
Update all the basis needed for data movement generation.
#define sys_debug(level, msg, sc)
build the base of the image domain.
Pbase variables_in_declaration_list(entity __attribute__((unused)) module, code ce)
Psysteme elim_redund_sc_with_sc(Psysteme sc1, Psysteme sc2, Pbase index_base, int dim)
Build the system of inequations of sc1 no-redundant with system sc2.
Psysteme sc_image_computation(entity module, entity entity_var, Psysteme sc_domain, Psysteme sc_array_function, Pbase index_base, Pbase *const_base, entity proc_id, Pbase bank_indices, Pbase tile_indices, Pbase *new_tile_indices, int pn, int bn, int ls, int *n, int *dim_h)
This function computes the system of constraints characterizing the image by the array function of th...
void sort_tile_indices(Pbase tile_indices, Pbase *new_tile_indices, matrice Q, int m)
Sort the tile indices base, such that the indices correspond to the tile indices of the array element...
Pbase build_image_base(bool bank_code, Pbase proc_id, Pbase bank_indices, Pbase tile_indices)
cproto-generated files
statement movement_computation(entity module, bool used_def, bool bank_code, bool receive_code, entity private_entity, Psysteme sc_image, Pbase const_base, Pbase bank_indices, Pbase tile_indices, Pbase ppid, Pbase loop_body_indices, int n, int dim_h)
Calcul des nouvelles bornes des boucles et de la nouvelle fonction d'acces a une reference d'un table...
#define COLUMN_MAJOR
Package movements
statement bound_generation(entity module, bool bank_code, bool receive_code, entity ent, Pbase loop_body_indices, Pbase var_id, Psysteme *lsystem, Pbase index_base, int n, int sc_info[][4])
Generation of the new loop nest characterizing the new domain.
Variable sc_add_new_variable_name(entity, Psysteme)
sc_add_variable.c
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
code entity_code(entity e)
const char * entity_module_name(entity e)
See comments about module_name().
#define code_declarations(x)
#define statement_undefined
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new, get_variable_name_t variable_name)
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new): reecriture du systeme s r...
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Psysteme sc_init_with_sc(Psysteme sc)
This function returns a new empty system which has been initialized with the same dimension and base ...
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
void build_sc_nredund_1pass(Psysteme volatile *ps)
Computation of a new system sc from the system ps, where each constraint of the system ps is added to...
bool ineq_redund_with_sc_p(Psysteme sc, Pcontrainte ineq)
This function returns true if the inequation ineq is redundant for the system ps and false otherwise.
Psysteme build_integer_sc_nredund(volatile Psysteme ps, Pbase index_base, int tab_info[][4], int loop_level, int dim_h __attribute__((unused)), int n __attribute__((unused)))
Computation of a new system sc from the system ps, where each constraint of the system ps is added to...
void sc_rm_empty_constraints(Psysteme ps, bool process_equalities)
package sc: elimination de redondance simple
void sc_minmax_of_variables(Psysteme ps1, Psysteme ps2, Pbase b)
This function uses sc_minmax_of_variable to compute the min and max of each variable belonging to bas...
void sc_integer_projection_information(Psysteme sc, Pbase index_base, int sc_info[][4], int dim_h, int n)
This function gives information about the variables and the constraints of the system.
bool var_with_unity_coeff_p(Psysteme sc, Variable var)
This function returns true: if all positive OR all negative coefficients of the variable var in the s...
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3)
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3): calcul d'un systeme de contraintes s...
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Pcontrainte contrainte_sort(Pcontrainte c, Pbase base, Pbase sort_base, bool inner_first, bool complex_first)
void loop_sc_to_matrices(Psysteme, Pbase, Pbase, matrice, matrice, int, int, int)
Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie...
void matrices_to_loop_sc(Psysteme, Pbase, Pbase, matrice, matrice, int, int, int)
struct Scontrainte * succ
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define BASE_UNDEFINED_P(b)
#define VECTEUR_UNDEFINED
char *(* get_variable_name_t)(Variable)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define BASE_NULLE
MACROS SUR LES BASES.
#define VECTEUR_UNDEFINED_P(v)
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...
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
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...