PIPS
build-system.c File Reference
#include "defines-local.h"
#include "prettyprint.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
+ Include dependency graph for build-system.c:

Go to the source code of this file.

Macros

#define ALPHA_PREFIX   "ALPHA"
 
#define LALPHA_PREFIX   "LALPHA"
 
#define THETA_PREFIX   "THETA"
 
#define PSI_PREFIX   "PSI"
 
#define GAMMA_PREFIX   "GAMMA"
 
#define DELTA_PREFIX   "DELTA"
 
#define IOTA_PREFIX   "IOTA"
 
#define SIGMA_PREFIX   "SIGMA"
 
#define TMP_PREFIX   "TMP"
 
#define is_entity_array   0
 tags with a newgen look and feel More...
 
#define is_entity_template   1
 
#define is_entity_processors   2
 
#define PRIME_LETTER_FOR_VARIABLES   "p"
 
#define GET_DUMMY_VARIABLE_ENTITY(MODULE, NAME, lname)
 define to build the _dummy and _prime of a variable. More...
 
#define STORE(name)    put_dummy_and_prime(get_ith_##name##_dummy, get_ith_##name##_prime)
 
#define Psysteme_undefined   SC_UNDEFINED
 already computed constraints More...
 
#define Psysteme_undefined_p(sc)   SC_UNDEFINED_P(sc)
 

Functions

bool entity_hpfc_dummy_p (entity e)
 Variables. More...
 
static void put_dummy_and_prime (entity(*gen1)(), gen2)
 shift dummy variables to prime variables. More...
 
void hpfc_init_dummy_to_prime ()
 
void hpfc_close_dummy_to_prime ()
 
Psysteme shift_system_to_prime_variables (Psysteme s)
 
void make_hpfc_current_mappings ()
 ??? used with a temporary hack to differentiate array and templates More...
 
void free_hpfc_current_mappings ()
 
Psysteme compute_entity_to_declaration_constraints (entity ent, string suffix, string prefix)
 Psysteme compute_entity_to_constraints(ent, suffix, prefix) entity ent: variable the constraints of which are computed strings suffix and prefix: to be used in the dummy variables created. More...
 
static Psysteme hpfc_compute_entity_to_declaration_constraints (entity e, tag what)
 
Psysteme entity_to_declaration_constraints (entity e, tag what)
 gives back the constraints due to the declarations. More...
 
static Psysteme hpfc_compute_align_constraints (entity e)
 Psysteme hpfc_compute_align_constraints(e) entity e is an array. More...
 
Psysteme hpfc_compute_unicity_constraints (entity e)
 Psysteme hpfc_compute_unicity_constraints(e) entity e should be an array;. More...
 
static Psysteme hpfc_compute_distribute_constraints (entity e)
 Psysteme hpfc_compute_distribute_constraints(e) entity e should be a template;. More...
 
Psysteme entity_to_hpf_align_constraints (entity e)
 
Psysteme entity_to_hpf_distribute_constraints (entity e)
 
effect entity_to_region (statement stat, entity ent, tag act)
 effect entity_to_region(stat, ent, act) statement stat; entity ent; tag act; More...
 
Psysteme hpfc_compute_entity_to_new_declaration (entity array)
 
Psysteme entity_to_new_declaration (entity array)
 
Psysteme generate_system_for_equal_variables (int n, entity(*gen1)(int), entity(*gen2)(int))
 
Psysteme hpfc_unstutter_dummies (entity array)
 
Psysteme generate_system_for_distributed_variable (entity v)
 Psysteme generate_system_for_variable(v) entity v;. More...
 

Macro Definition Documentation

◆ ALPHA_PREFIX

#define ALPHA_PREFIX   "ALPHA"

Definition at line 42 of file build-system.c.

◆ DELTA_PREFIX

#define DELTA_PREFIX   "DELTA"

Definition at line 47 of file build-system.c.

◆ GAMMA_PREFIX

#define GAMMA_PREFIX   "GAMMA"

Definition at line 46 of file build-system.c.

◆ GET_DUMMY_VARIABLE_ENTITY

#define GET_DUMMY_VARIABLE_ENTITY (   MODULE,
  NAME,
  lname 
)
Value:
entity get_ith_##lname##_dummy(int i) \
{ \
return get_ith_dummy(MODULE, NAME, i); \
} \
entity get_ith_##lname##_prime(int i) \
{ \
}
#define PRIME_LETTER_FOR_VARIABLES
Definition: build-system.c:114
#define MODULE
Definition: readmakefile.c:173
#define NAME
Definition: readmakefile.c:188
entity get_ith_dummy(string, string, int)
Returns a numbered entity the name of which is suffix + number, the module of which is prefix.
Definition: variable.c:1711
static int lname(char *s, int look_for_entry)
check for keywords for subprograms return 0 if comment card, 1 if found name and put in arg string.
Definition: split_file.c:283

define to build the _dummy and _prime of a variable.

Definition at line 118 of file build-system.c.

◆ IOTA_PREFIX

#define IOTA_PREFIX   "IOTA"

Definition at line 48 of file build-system.c.

◆ is_entity_array

#define is_entity_array   0

tags with a newgen look and feel

Definition at line 53 of file build-system.c.

◆ is_entity_processors

#define is_entity_processors   2

Definition at line 55 of file build-system.c.

◆ is_entity_template

#define is_entity_template   1

Definition at line 54 of file build-system.c.

◆ LALPHA_PREFIX

#define LALPHA_PREFIX   "LALPHA"

Definition at line 43 of file build-system.c.

◆ PRIME_LETTER_FOR_VARIABLES

#define PRIME_LETTER_FOR_VARIABLES   "p"

Definition at line 114 of file build-system.c.

◆ PSI_PREFIX

#define PSI_PREFIX   "PSI"

Definition at line 45 of file build-system.c.

◆ Psysteme_undefined

#define Psysteme_undefined   SC_UNDEFINED

already computed constraints

Definition at line 183 of file build-system.c.

◆ Psysteme_undefined_p

#define Psysteme_undefined_p (   sc)    SC_UNDEFINED_P(sc)

Definition at line 184 of file build-system.c.

◆ SIGMA_PREFIX

#define SIGMA_PREFIX   "SIGMA"

Definition at line 49 of file build-system.c.

◆ STORE

#define STORE (   name)     put_dummy_and_prime(get_ith_##name##_dummy, get_ith_##name##_prime)

Definition at line 152 of file build-system.c.

◆ THETA_PREFIX

#define THETA_PREFIX   "THETA"

Definition at line 44 of file build-system.c.

◆ TMP_PREFIX

#define TMP_PREFIX   "TMP"

Definition at line 50 of file build-system.c.

Function Documentation

◆ compute_entity_to_declaration_constraints()

Psysteme compute_entity_to_declaration_constraints ( entity  ent,
string  suffix,
string  prefix 
)

Psysteme compute_entity_to_constraints(ent, suffix, prefix) entity ent: variable the constraints of which are computed strings suffix and prefix: to be used in the dummy variables created.


DECLARATION CONSTRAINTS GENERATION

computes the constraints due to the declarations. ! usefull

system may be empty for scalars ???

now the dummy is to be used to generate two inequalities: -dummy + lower <= 0 and dummy - upper <= 0

Parameters
entnt
suffixuffix
prefixrefix

Definition at line 220 of file build-system.c.

223 {
225  int dim_number = 1;
226  Psysteme new_system = sc_new();
227 
228  pips_assert("variable", entity_variable_p(ent));
229 
230  /* system may be empty for scalars ???
231  */
232  pips_debug(5, "entity %s, [%s,%s]\n", entity_name(ent), prefix, suffix);
233 
234  MAP(DIMENSION, dim,
235  {
236  entity dummy = get_ith_dummy(prefix, suffix, dim_number);
237  int ilower;
238  int iupper;
240  (dimension_lower(dim), &ilower);
242  (dimension_upper(dim), &iupper);
243 
244  pips_assert("extent known", blower && bupper);
245 
246  /* now the dummy is to be used to generate two inequalities:
247  * -dummy + lower <= 0 and dummy - upper <= 0
248  */
250  (new_system,
252  dummy, VALUE_MONE,
253  TCST, int_to_value(ilower))));
255  (new_system,
257  dummy, VALUE_ONE,
258  TCST, int_to_value(-iupper))));
259  dim_number++;
260  },
261  dims);
262 
263  sc_creer_base(new_system);
264  return new_system;
265 }
bool hpfc_integer_constant_expression_p(expression e, int *pi)
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define VALUE_MONE
#define VALUE_ONE
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
int dummy
A dummy file, to prevent empty libraries from breaking builds.
Definition: dummy.c:41
#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 pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
static const char * prefix
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#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 dimension_upper(x)
Definition: ri.h:982
#define variable_dimensions(x)
Definition: ri.h:3122
#define entity_type(x)
Definition: ri.h:2792
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#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 contrainte_make(), DIMENSION, dimension_lower, dimension_upper, entity_name, entity_type, entity_variable_p, get_ith_dummy(), hpfc_integer_constant_expression_p(), int_to_value, MAP, pips_assert, pips_debug, prefix, sc_add_inegalite(), sc_creer_base(), sc_new(), TCST, type_variable, VALUE_MONE, VALUE_ONE, variable_dimensions, vect_make(), and VECTEUR_NUL.

Referenced by hpfc_compute_entity_to_declaration_constraints().

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

◆ entity_hpfc_dummy_p()

bool entity_hpfc_dummy_p ( entity  e)

Variables.

build-system.c

  • array dimensions (PHIs)
  • template dimensions
  • processor dimensions
  • cycles and offsets
  • local array dimensions
  • indexes and others coming thru the regions

Inequations to be defined

  • array declaration
  • template declaration
  • processors arrangement declaration
  • local offsets within a block
  • local declarations
  • regions accessed by the statement

Equations to be defined

  • alignement
  • distribution
  • local <-> global?
  • processor linearization?

Remarks

  • offset to be computed
  • access functions are not needed (hidden by regions)
  • how to be sure that something can be done?
  • will newgen structures be necessary to build the systems?
  • will I have to remove some variables (indexes ?)
  • one equation to be added for replicated dimensions. variable names:

ALPHA{1-7}: array dimensions, THETA{1-7}: template dimensions, PSI{1-7}: processor dimensions, SIGMA{1-7}: auxiliary variable, GAMMA{1-7}: cycles, DELTA{1-7}: local offsets, LALPHA{1-7}: local array dimensions, if specified...

plus "PRIME" versions


HPF CONSTRAINTS GENERATION

Definition at line 106 of file build-system.c.

108 {
110 }
#define HPFC_PACKAGE
local definitions
Definition: hpfc-local.h:27
#define same_string_p(s1, s2)
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092

References entity_module_name(), HPFC_PACKAGE, and same_string_p.

Referenced by put_variables_in_ordered_lists().

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

◆ entity_to_declaration_constraints()

Psysteme entity_to_declaration_constraints ( entity  e,
tag  what 
)

gives back the constraints due to the declarations.

Uses a demand driven approach: computed systems are stored in the declaration_constraints mapping for later search.

Parameters
whathat

Definition at line 285 of file build-system.c.

288 {
289  Psysteme p = load_entity_declaration_constraints(e+what);
290  pips_assert("variable", entity_variable_p(e));
291 
292  if (Psysteme_undefined_p(p))
293  {
295  store_entity_declaration_constraints(e+what, p);
296  }
297 
298  DEBUG_SYST(9, concatenate("entity ", entity_name(e), NULL), p);
299 
300  return p;
301 }
static Psysteme hpfc_compute_entity_to_declaration_constraints(entity e, tag what)
Definition: build-system.c:268
#define Psysteme_undefined_p(sc)
Definition: build-system.c:184
#define DEBUG_SYST(D, W, S)
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183

References concatenate(), DEBUG_SYST, entity_name, entity_variable_p, hpfc_compute_entity_to_declaration_constraints(), pips_assert, and Psysteme_undefined_p.

Referenced by generate_shared_io_system(), generate_system_for_distributed_variable(), GENERATION(), and processor_loop().

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

◆ entity_to_hpf_align_constraints()

Psysteme entity_to_hpf_align_constraints ( entity  e)

Definition at line 480 of file build-system.c.

481 {
482  Psysteme p = load_entity_hpf_align_constraints(e);
483 
484  pips_assert("distributed variable", array_distributed_p(e));
485 
486  if (Psysteme_undefined_p(p))
487  {
489  store_entity_hpf_align_constraints(e, p);
490  }
491 
492  return p;
493 }
static Psysteme hpfc_compute_align_constraints(entity e)
Psysteme hpfc_compute_align_constraints(e) entity e is an array.
Definition: build-system.c:310
bool array_distributed_p(entity)

References array_distributed_p(), hpfc_compute_align_constraints(), pips_assert, and Psysteme_undefined_p.

Referenced by generate_system_for_distributed_variable().

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

◆ entity_to_hpf_distribute_constraints()

Psysteme entity_to_hpf_distribute_constraints ( entity  e)

Definition at line 495 of file build-system.c.

496 {
497  Psysteme p = load_entity_hpf_distribute_constraints(e);
498 
499  pips_assert("template", entity_template_p(e));
500 
501  if (Psysteme_undefined_p(p))
502  {
504  store_entity_hpf_distribute_constraints(e, p);
505  }
506 
507  return p;
508 }
static Psysteme hpfc_compute_distribute_constraints(entity e)
Psysteme hpfc_compute_distribute_constraints(e) entity e should be a template;.
Definition: build-system.c:407
bool entity_template_p(entity)

References entity_template_p(), hpfc_compute_distribute_constraints(), pips_assert, and Psysteme_undefined_p.

Referenced by generate_system_for_distributed_variable().

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

◆ entity_to_new_declaration()

Psysteme entity_to_new_declaration ( entity  array)
Parameters
arrayrray

Definition at line 732 of file build-system.c.

734 {
735  Psysteme p = load_entity_new_declaration_constraints(array);
736 
737  pips_assert("distributed array", array_distributed_p(array));
738 
739  if (Psysteme_undefined_p(p))
740  {
742  store_entity_new_declaration_constraints(array, p);
743  }
744 
745  return p;
746 }
Psysteme hpfc_compute_entity_to_new_declaration(entity array)
Definition: build-system.c:533
static entity array

References array, array_distributed_p(), hpfc_compute_entity_to_new_declaration(), pips_assert, and Psysteme_undefined_p.

Referenced by generate_system_for_distributed_variable().

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

◆ entity_to_region()

effect entity_to_region ( statement  stat,
entity  ent,
tag  act 
)

effect entity_to_region(stat, ent, act) statement stat; entity ent; tag act;

gives the region of ent with action act in statement stat.

Parameters
stattat
entnt
actct

Definition at line 515 of file build-system.c.

519 {
521 
522  MAP(EFFECT, e,
523  if ((reference_variable(effect_any_reference(e))==ent) &&
524  ((int) action_tag(effect_action(e))==act)) return(e),
525  l);
526 
527  return(effect_undefined);
528 }
list load_statement_local_regions(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_action(x)
Definition: effects.h:642
#define effect_undefined
Definition: effects.h:614
#define action_tag(x)
Definition: effects.h:310
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#define reference_variable(x)
Definition: ri.h:2326

References action_tag, EFFECT, effect_action, effect_any_reference, effect_undefined, load_statement_local_regions(), MAP, and reference_variable.

Referenced by generate_distributed_io_system(), and generate_shared_io_system().

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

◆ free_hpfc_current_mappings()

void free_hpfc_current_mappings ( void  )

Definition at line 200 of file build-system.c.

201 {
202  free_declaration_constraints_map();
203  free_hpf_align_constraints_map();
204  free_hpf_distribute_constraints_map();
205  free_new_declaration_constraints_map();
206 }

Referenced by reset_resources_for_module().

+ Here is the caller graph for this function:

◆ generate_system_for_distributed_variable()

Psysteme generate_system_for_distributed_variable ( entity  v)

Psysteme generate_system_for_variable(v) entity v;.

what: generates a system for DISTRIBUTED variable v. how: uses the declarations of v, t, p and align and distribute, and new declarations. input: entity (variable) v output: the built system, which is a new allocated system. side effects:

  • uses many functions that build and store systems... bugs or features:

Definition at line 789 of file build-system.c.

791 {
792  Psysteme result = sc_rn(NULL);
793  entity t, p;
794 
795  pips_assert("distributed array", array_distributed_p(v));
796 
799 
800  result = sc_append(result, entity_to_declaration_constraints(v, 0));
801  result = sc_append(result, entity_to_declaration_constraints(t, 1));
802  result = sc_append(result, entity_to_declaration_constraints(p, 2));
803  result = sc_append(result, entity_to_hpf_align_constraints(v));
804  result = sc_append(result, entity_to_hpf_distribute_constraints(t));
805  result = sc_append(result, entity_to_new_declaration(v));
806 
807  base_rm(sc_base(result)), sc_base(result) = NULL, sc_creer_base(result);
808 
809  return(result);
810 }
Psysteme entity_to_hpf_align_constraints(entity e)
Definition: build-system.c:480
Psysteme entity_to_declaration_constraints(entity e, tag what)
gives back the constraints due to the declarations.
Definition: build-system.c:285
Psysteme entity_to_hpf_distribute_constraints(entity e)
Definition: build-system.c:495
Psysteme entity_to_new_declaration(entity array)
Definition: build-system.c:732
#define align_template(x)
Definition: hpf.h:98
#define distribute_processors(x)
Definition: hpf.h:176
distribute load_hpf_distribution(entity)
align load_hpf_alignment(entity)
Psysteme sc_rn(Pbase b)
Psysteme sc_rn(Pbase b): build a Psysteme without constraints to define R^n, where n is b's dimension...
Definition: sc_alloc.c:336
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
#define base_rm(b)

References align_template, array_distributed_p(), base_rm, distribute_processors, entity_to_declaration_constraints(), entity_to_hpf_align_constraints(), entity_to_hpf_distribute_constraints(), entity_to_new_declaration(), load_hpf_alignment(), load_hpf_distribution(), pips_assert, sc_append(), sc_creer_base(), and sc_rn().

Referenced by generate_distributed_io_system(), and generate_remapping_system().

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

◆ generate_system_for_equal_variables()

Psysteme generate_system_for_equal_variables ( int  n,
entity(*)(int gen1,
entity(*)(int gen2 
)

Definition at line 751 of file build-system.c.

755 {
756  Psysteme s = sc_rn(NULL);
757 
758  for(; n>0; n--)
760  (vect_make(VECTEUR_NUL, gen1(n), VALUE_ONE,
761  gen2(n), VALUE_MONE, TCST, VALUE_ZERO)));
762 
763  sc_creer_base(s); return s;
764 }
#define VALUE_ZERO
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389

References contrainte_make(), sc_add_egalite(), sc_creer_base(), sc_rn(), TCST, VALUE_MONE, VALUE_ONE, VALUE_ZERO, vect_make(), and VECTEUR_NUL.

Referenced by generate_remapping_system(), and hpfc_unstutter_dummies().

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

◆ hpfc_close_dummy_to_prime()

void hpfc_close_dummy_to_prime ( void  )

Definition at line 168 of file build-system.c.

169 {
170  close_dummy_to_prime();
171 }

Referenced by compile_module().

+ Here is the caller graph for this function:

◆ hpfc_compute_align_constraints()

static Psysteme hpfc_compute_align_constraints ( entity  e)
static

Psysteme hpfc_compute_align_constraints(e) entity e is an array.

compute the align equations:

theta_i - a phi_j - b == 0

Definition at line 310 of file build-system.c.

312 {
313  align al = load_hpf_alignment(e);
314  entity template = align_template(al);
315  Psysteme new_system = sc_new();
316  int i;
317 
318  pips_assert("distributed array", array_distributed_p(e));
319 
320  for(i=1 ; i<=NumberOfDimension(template) ; i++)
321  {
322  entity theta = get_ith_template_dummy(i);
324 
325  if (a!=alignment_undefined)
326  {
327  int adim = alignment_arraydim(a),
329  Pvecteur
331  theta, VALUE_ONE,
333 
334  if (adim==0)
335  {
336  sc_add_egalite(new_system, contrainte_make(v));
337  }
338  else
339  {
340  entity phi = get_ith_array_dummy(adim);
341  int rate = HpfcExpressionToInt(alignment_rate(a));
342 
343  v = vect_make(v, phi, int_to_value(-rate), TCST, VALUE_ZERO);
344  sc_add_egalite(new_system, contrainte_make(v));
345  }
346  }
347  }
348 
349  sc_creer_base(new_system);
350  return(new_system);
351 }
#define alignment_undefined
Definition: hpf.h:108
#define alignment_constant(x)
Definition: hpf.h:140
#define align_alignment(x)
Definition: hpf.h:96
#define alignment_rate(x)
Definition: hpf.h:138
#define alignment_arraydim(x)
Definition: hpf.h:134
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
Definition: hpfc-util.c:569
alignment FindAlignmentOfTemplateDim(list lal, int dim)
Definition: hpfc-util.c:389
entity get_ith_template_dummy(int)
entity get_ith_array_dummy(int)
int NumberOfDimension(entity)
Definition: size.c:588
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89

References align_alignment, align_template, alignment_arraydim, alignment_constant, alignment_rate, alignment_undefined, array_distributed_p(), contrainte_make(), FindAlignmentOfTemplateDim(), get_ith_array_dummy(), get_ith_template_dummy(), HpfcExpressionToInt(), int_to_value, load_hpf_alignment(), NumberOfDimension(), pips_assert, sc_add_egalite(), sc_creer_base(), sc_new(), TCST, VALUE_ONE, VALUE_ZERO, vect_make(), and VECTEUR_NUL.

Referenced by entity_to_hpf_align_constraints().

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

◆ hpfc_compute_distribute_constraints()

static Psysteme hpfc_compute_distribute_constraints ( entity  e)
static

Psysteme hpfc_compute_distribute_constraints(e) entity e should be a template;.

the constraints due to the distribution are defined:

theta_i - theta_i0 == Nj Pj gamma_j + Nj (psi_j - psi_j0) + delta_j delta_j >= 0 delta_j < Nj ??? if block distribution: gamma_j == 0 ??? not distributed template dimensions are skipped... ??? if cyclic(1) distribution: delta_j == 0

-delta_j <= 0

delta_j - (N_j - 1) <= 0

theta_i - Nj psi_j - Nj Pj gamma_j - delta_j + Nj psi_j0 - theta_i0 == 0

if block distributed gamma_j == 0

if cyclic(1) distributed delta_j == 0

Definition at line 407 of file build-system.c.

409 {
410  Psysteme new_system = sc_new();
412  entity proc = distribute_processors(di);
413  list ld = distribute_distribution(di);
414  int j, i;
415 
416  pips_assert("template", entity_template_p(e));
417 
418  for(j=1 ; j<=NumberOfDimension(proc) ; j++)
419  {
421  d = FindDistributionOfProcessorDim(ld, j, &i);
422  entity
423  theta = get_ith_template_dummy(i),
424  psi = get_ith_processor_dummy(j),
425  gamma = get_ith_cycle_dummy(j),
426  delta = get_ith_block_dummy(j);
427  int
429  theta0 = HpfcExpressionToInt
431  psi0 = HpfcExpressionToInt
433  proc_size = SizeOfIthDimension(proc, j);
434  style st = distribution_style(d);
436 
437  /* -delta_j <= 0
438  */
439  sc_add_inegalite(new_system,
441 
442  /* delta_j - (N_j - 1) <= 0
443  */
444  sc_add_inegalite(new_system,
446  (Variable) delta, VALUE_ONE,
447  TCST, int_to_value(-param+1))));
448 
449  /* theta_i - Nj psi_j - Nj Pj gamma_j - delta_j + Nj psi_j0 - theta_i0
450  * == 0
451  */
453  (Variable) theta, VALUE_ONE,
454  (Variable) psi, int_to_value(-param),
455  (Variable) gamma, int_to_value(-(param*proc_size)),
456  (Variable) delta, VALUE_MONE,
457  TCST, int_to_value((param*psi0)-theta0));
458 
459  sc_add_egalite(new_system, contrainte_make(v));
460 
461  /* if block distributed
462  * gamma_j == 0
463  */
464  if (style_block_p(st))
465  sc_add_egalite(new_system,
467 
468  /* if cyclic(1) distributed
469  * delta_j == 0
470  */
471  if (style_cyclic_p(st) && (param==1))
472  sc_add_egalite(new_system,
474 
475  }
476  sc_creer_base(new_system);
477  return(new_system);
478 }
#define distribution_style(x)
Definition: hpf.h:210
#define distribute_distribution(x)
Definition: hpf.h:174
#define distribution_parameter(x)
Definition: hpf.h:212
#define style_block_p(x)
Definition: hpf.h:262
#define style_cyclic_p(x)
Definition: hpf.h:265
distribution FindDistributionOfProcessorDim(list ldi, int dim, int *tdim)
Definition: hpfc-util.c:421
entity get_ith_cycle_dummy(int)
entity get_ith_block_dummy(int)
entity get_ith_processor_dummy(int)
dimension entity_ith_dimension(entity, int)
Another semantics would be: is this reference r to e a kill for e? In general, this cannot be answere...
Definition: variable.c:1228
int SizeOfIthDimension(entity, int)
this function returns the size of the ith dimension of a variable e.
Definition: size.c:453
Definition: replace.c:135
#define VECTEUR_UNDEFINED
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110

References contrainte_make(), dimension_lower, distribute_distribution, distribute_processors, distribution_parameter, distribution_style, entity_ith_dimension(), entity_template_p(), FindDistributionOfProcessorDim(), get_ith_block_dummy(), get_ith_cycle_dummy(), get_ith_processor_dummy(), get_ith_template_dummy(), HpfcExpressionToInt(), int_to_value, load_hpf_distribution(), NumberOfDimension(), pips_assert, sc_add_egalite(), sc_add_inegalite(), sc_creer_base(), sc_new(), SizeOfIthDimension(), style_block_p, style_cyclic_p, TCST, VALUE_MONE, VALUE_ONE, vect_make(), vect_new(), VECTEUR_NUL, and VECTEUR_UNDEFINED.

Referenced by entity_to_hpf_distribute_constraints().

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

◆ hpfc_compute_entity_to_declaration_constraints()

static Psysteme hpfc_compute_entity_to_declaration_constraints ( entity  e,
tag  what 
)
static

Definition at line 268 of file build-system.c.

271 {
272  string local_prefix = (what==is_entity_array? ALPHA_PREFIX:
274  what==is_entity_processors? PSI_PREFIX: "ERROR");
275 
277  (e, local_prefix, HPFC_PACKAGE);
278 }
#define is_entity_processors
Definition: build-system.c:55
Psysteme compute_entity_to_declaration_constraints(entity ent, string suffix, string prefix)
Psysteme compute_entity_to_constraints(ent, suffix, prefix) entity ent: variable the constraints of w...
Definition: build-system.c:220
#define ALPHA_PREFIX
Definition: build-system.c:42
#define PSI_PREFIX
Definition: build-system.c:45
#define is_entity_template
Definition: build-system.c:54
#define THETA_PREFIX
Definition: build-system.c:44
#define is_entity_array
tags with a newgen look and feel
Definition: build-system.c:53

References ALPHA_PREFIX, compute_entity_to_declaration_constraints(), HPFC_PACKAGE, is_entity_array, is_entity_processors, is_entity_template, PSI_PREFIX, and THETA_PREFIX.

Referenced by entity_to_declaration_constraints().

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

◆ hpfc_compute_entity_to_new_declaration()

Psysteme hpfc_compute_entity_to_new_declaration ( entity  array)

LALPHAi == ALPHAi

LALPHAi = ALPHAi - ALPHAi_min + 1

(|a|==1) LALPHA_i == DELTA_j + 1 generalized to: (|a|!=1) |a| * (LALPHA_i - 1) + IOTA_j == DELTA_j 0 <= IOTA_j < |a|

IOTA is not needed

LALPHA_i == N* (GAMMA_j - GAMMA_0) + DELTA_j + 1

LALPHA_i = iceil(N,|a|) * (GAMMA_j - GAMMA_0) + SIGMA_j +1 DELTA_j = |a|*SIGMA_j + IOTA_j 0 <= IOTA_j < |a|

Parameters
arrayrray

Definition at line 533 of file build-system.c.

535 {
536  int dim = NumberOfDimension(array);
537  Psysteme syst = sc_rn(NULL);
538 
539  pips_assert("distributed array", array_distributed_p(array));
540 
541  for (; dim>0; dim--)
542  {
543  entity lalpha = get_ith_local_dummy(dim),
544  alpha = get_ith_array_dummy(dim);
545 
546  switch (new_declaration_tag(array, dim))
547  {
548  case is_hpf_newdecl_none:
549  /* LALPHAi == ALPHAi
550  */
552  (syst,
554  alpha, VALUE_ONE,
555  lalpha, VALUE_MONE,
556  TCST, VALUE_ZERO)));
557  break;
559  {
560  /* LALPHAi = ALPHAi - ALPHAi_min + 1
561  */
562  int min = 314159;
563  int max = -314159;
564 
566 
568  (syst,
570  alpha, VALUE_ONE,
571  lalpha, VALUE_MONE,
572  TCST, int_to_value(1-min))));
573 
574  break;
575  }
576  case is_hpf_newdecl_beta:
577  {
578  /* (|a|==1) LALPHA_i == DELTA_j + 1
579  * generalized to:
580  * (|a|!=1) |a| * (LALPHA_i - 1) + IOTA_j == DELTA_j
581  * 0 <= IOTA_j < |a|
582  */
583  entity delta, template = array_to_template(array);
584  int tdim, pdim, a, b, n;
585 
586  get_alignment(array, dim, &tdim, &a, &b);
587  pips_assert("aligned dimension", a!=0 && tdim!=0);
588  get_distribution(template, tdim, &pdim, &n);
589 
590  delta = get_ith_block_dummy(pdim);
591 
592  if (abs(a)==1)
593  {
594  /* IOTA is not needed */
595  sc_add_egalite(syst,
597  delta, VALUE_ONE,
598  lalpha, VALUE_MONE,
599  TCST, VALUE_ONE)));
600  }
601  else
602  {
603  entity iota = get_ith_shift_dummy(pdim);
604  Pvecteur
605  v1 = vect_make(VECTEUR_NUL,
606  (Variable) lalpha, int_to_value(abs(a)),
607  (Variable) iota, VALUE_ONE,
608  (Variable) delta, VALUE_MONE,
609  TCST, int_to_value(-abs(a)));
610 
611  sc_add_egalite(syst, contrainte_make(v1));
612  sc_add_inegalite(syst,
614  VALUE_MONE)));
616  (syst,
618  (Variable) iota, VALUE_ONE,
619  TCST, int_to_value(-(abs(a)-1)))));
620  }
621 
622  break;
623  }
625  {
626  /* LALPHA_i == N* (GAMMA_j - GAMMA_0) + DELTA_j + 1
627  */
628  entity
629  gamma = entity_undefined,
630  delta = entity_undefined,
631  template = array_to_template(array),
632  processor = template_to_processors(template);
633  int gamma_0 = 0, tdim = -1, pdim = -1, a = 0, b = 0,
634  n, plow, pup, tlow, tup, alow, aup;
635 
636  get_alignment(array, dim, &tdim, &a, &b);
637  pips_assert("stride-1 aligned", abs(a)==1 && tdim!=0);
638 
639  get_distribution(template, tdim, &pdim, &n);
640  pips_assert("distributed dimension", pdim>0 && n>0);
641 
642  get_entity_dimensions(array, dim, &alow, &aup);
643  get_entity_dimensions(template, tdim, &tlow, &tup);
644  get_entity_dimensions(processor, pdim, &plow, &pup);
645 
646  delta = get_ith_block_dummy(pdim);
647  gamma = get_ith_cycle_dummy(pdim);
648 
649  gamma_0 = (a*alow + b - tlow) % (n * (pup - plow + 1));
650 
652  (syst,
654  (VECTEUR_NUL,
655  delta, VALUE_ONE,
656  gamma, int_to_value(n),
657  lalpha, VALUE_MONE,
658  TCST, int_to_value(1-(n*gamma_0)))));
659  break;
660  }
662  {
663  /* LALPHA_i = iceil(N,|a|) * (GAMMA_j - GAMMA_0) + SIGMA_j +1
664  * DELTA_j = |a|*SIGMA_j + IOTA_j
665  * 0 <= IOTA_j < |a|
666  */
667  entity sigma = entity_undefined,
668  iota = entity_undefined,
669  gamma = entity_undefined,
670  delta = entity_undefined,
671  template = array_to_template(array),
672  processor = template_to_processors(template);
673  int gamma_0 = 0, tdim = -1, pdim = -1, a = 0, b = 0,
674  n, icn, plow, pup, tlow, tup, alow, aup;
675 
676  get_alignment(array, dim, &tdim, &a, &b);
677  pips_assert("aligned dimension", tdim!=0);
678 
679  get_distribution(template, tdim, &pdim, &n);
680  pips_assert("distributed dimension", pdim>0 && n>0);
681 
682  get_entity_dimensions(array, dim, &alow, &aup);
683  get_entity_dimensions(template, tdim, &tlow, &tup);
684  get_entity_dimensions(processor, pdim, &plow, &pup);
685 
686  sigma = get_ith_auxiliary_dummy(pdim);
687  iota = get_ith_shift_dummy(pdim);
688  delta = get_ith_block_dummy(pdim);
689  gamma = get_ith_cycle_dummy(pdim);
690 
691  gamma_0 = (a*alow + b - tlow) % (n * (pup - plow + 1));
692  icn = iceil(n, abs(a));
693 
695  (syst,
698  sigma, VALUE_ONE,
699  gamma, int_to_value(icn),
700  lalpha, VALUE_MONE,
701  TCST, int_to_value(1-(icn*gamma_0)))));
702 
704  (syst,
707  delta, VALUE_ONE,
708  sigma, int_to_value(-abs(a)),
709  iota, VALUE_MONE,
710  TCST, VALUE_ZERO)));
711 
712  sc_add_inegalite(syst,
714  VALUE_MONE)));
716  (syst,
719  (Variable) iota, VALUE_ONE,
720  TCST, int_to_value(-(abs(a)-1)))));
721  break;
722  }
723  default:
724  pips_internal_error("unexpected new declaration tag");
725  }
726  }
727 
728  sc_creer_base(syst);
729  return syst;
730 }
#define min(a, b)
#define max(a, b)
@ is_hpf_newdecl_none
Definition: hpf_private.h:665
@ is_hpf_newdecl_delta
Definition: hpf_private.h:669
@ is_hpf_newdecl_alpha
Definition: hpf_private.h:666
@ is_hpf_newdecl_beta
Definition: hpf_private.h:667
@ is_hpf_newdecl_gamma
Definition: hpf_private.h:668
void get_entity_dimensions(entity e, int dim, int *plow, int *pup)
Definition: hpfc-util.c:651
void get_alignment(entity array, int dim, int *ptdim, int *pa, int *pb)
Definition: hpfc-util.c:606
void get_distribution(entity template, int dim, int *ppdim, int *pn)
Definition: hpfc-util.c:638
tag new_declaration_tag(entity array, int dim)
Definition: declarations.c:229
void get_ith_dim_new_declaration(entity array, int i, int *pmin, int *pmax)
Definition: declarations.c:285
#define array_to_template(array)
#define iceil(a, b)
integer ceiling function
#define template_to_processors(template)
entity get_ith_shift_dummy(int)
entity get_ith_auxiliary_dummy(int)
entity get_ith_local_dummy(int)
#define pips_internal_error
Definition: misc-local.h:149
#define entity_undefined
Definition: ri.h:2761
#define abs(v)
Definition: syntax-local.h:48

References abs, array, array_distributed_p(), array_to_template, contrainte_make(), entity_undefined, get_alignment(), get_distribution(), get_entity_dimensions(), get_ith_array_dummy(), get_ith_auxiliary_dummy(), get_ith_block_dummy(), get_ith_cycle_dummy(), get_ith_dim_new_declaration(), get_ith_local_dummy(), get_ith_shift_dummy(), iceil, int_to_value, is_hpf_newdecl_alpha, is_hpf_newdecl_beta, is_hpf_newdecl_delta, is_hpf_newdecl_gamma, is_hpf_newdecl_none, max, min, new_declaration_tag(), NumberOfDimension(), pips_assert, pips_internal_error, sc_add_egalite(), sc_add_inegalite(), sc_creer_base(), sc_rn(), TCST, template_to_processors, VALUE_MONE, VALUE_ONE, VALUE_ZERO, vect_make(), vect_new(), and VECTEUR_NUL.

Referenced by entity_to_new_declaration().

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

◆ hpfc_compute_unicity_constraints()

Psysteme hpfc_compute_unicity_constraints ( entity  e)

Psysteme hpfc_compute_unicity_constraints(e) entity e should be an array;.

equations for non aligned template dimensions are computed: ???

theta_i - lower_template_i == 0

Definition at line 360 of file build-system.c.

362 {
363  align al = load_hpf_alignment(e);
364  entity template = align_template(al);
365  Psysteme new_system = sc_new();
366  int i;
367 
368  pips_assert("distributed array", array_distributed_p(e));
369 
370  for(i=1 ; i<=NumberOfDimension(template) ; i++)
371  {
372  alignment
374 
375  if (a==alignment_undefined)
376  {
377  entity
378  theta = get_ith_template_dummy(i);
379  int
380  low =
382  (dimension_lower(entity_ith_dimension(template, i)));
383 
385  (new_system,
387  theta, VALUE_ONE,
388  TCST, int_to_value(-low))));
389  }
390  }
391  sc_creer_base(new_system);
392  return(new_system);
393 }

References align_alignment, align_template, alignment_undefined, array_distributed_p(), contrainte_make(), dimension_lower, entity_ith_dimension(), FindAlignmentOfTemplateDim(), get_ith_template_dummy(), HpfcExpressionToInt(), int_to_value, load_hpf_alignment(), NumberOfDimension(), pips_assert, sc_add_egalite(), sc_creer_base(), sc_new(), TCST, VALUE_ONE, vect_make(), and VECTEUR_NUL.

Referenced by generate_distributed_io_system().

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

◆ hpfc_init_dummy_to_prime()

void hpfc_init_dummy_to_prime ( void  )

Definition at line 155 of file build-system.c.

156 {
157  init_dummy_to_prime();
158  STORE(array);
159  STORE(template);
160  STORE(processor);
161  STORE(block);
162  STORE(cycle);
163  STORE(local);
164  STORE(shift);
165  STORE(auxiliary);
166 }
#define STORE(name)
Definition: build-system.c:152

References array, and STORE.

Referenced by compile_module().

+ Here is the caller graph for this function:

◆ hpfc_unstutter_dummies()

Psysteme hpfc_unstutter_dummies ( entity  array)
Parameters
arrayrray

Definition at line 767 of file build-system.c.

769 {
770  int ndim = variable_entity_dimension(array);
771 
774 }
Psysteme generate_system_for_equal_variables(int n, entity(*gen1)(int), entity(*gen2)(int))
Definition: build-system.c:751
entity get_ith_region_dummy(int)
int variable_entity_dimension(entity)
variable_entity_dimension(entity v): returns the dimension of variable v; scalar have dimension 0.
Definition: variable.c:1293

References array, generate_system_for_equal_variables(), get_ith_array_dummy(), get_ith_region_dummy(), and variable_entity_dimension().

Referenced by generate_distributed_io_system(), and generate_shared_io_system().

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

◆ make_hpfc_current_mappings()

void make_hpfc_current_mappings ( void  )

??? used with a temporary hack to differentiate array and templates

Definition at line 192 of file build-system.c.

193 {
194  make_declaration_constraints_map();
195  make_hpf_align_constraints_map();
196  make_hpf_distribute_constraints_map();
197  make_new_declaration_constraints_map();
198 }

Referenced by set_resources_for_module().

+ Here is the caller graph for this function:

◆ put_dummy_and_prime()

static void put_dummy_and_prime ( entity (*)()  gen1,
gen2   
)
static

shift dummy variables to prime variables.

systeme s is modified.

Definition at line 144 of file build-system.c.

146 {
147  int i;
148  for(i=7; i>0; i--)
149  store_dummy_to_prime(gen1(i), gen2(i));
150 }

◆ shift_system_to_prime_variables()

Psysteme shift_system_to_prime_variables ( Psysteme  s)

Definition at line 173 of file build-system.c.

175 {
176  return sc_rename_variables(s, (bool (*)())bound_dummy_to_prime_p,
177  (Variable(*)()) load_dummy_to_prime);
178 }
Psysteme sc_rename_variables(Psysteme s, bool(*renamed_p)(), Variable(*new_variable)())
Psysteme sc_rename_variables(s, renamed_p, new_variable) Psysteme s; bool (*renamed_p)(Variable); Var...
Definition: sc.c:198

References sc_rename_variables().

Referenced by generate_remapping_system(), and processor_loop().

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