PIPS
io-compile.c File Reference
#include "defines-local.h"
#include "semantics.h"
#include "conversion.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
+ Include dependency graph for io-compile.c:

Go to the source code of this file.

Functions

static bool current_entity_is_used_later_p (statement stat, entity current_entity)
 HPFC module by Fabien COELHO. More...
 
static bool current_entity_is_updated_before_p (statement stat, entity current_entity)
 IN Regions(effects) are used to verify if the entity current_entity is initialized before it's used in the io statement. More...
 
static Psysteme statement_context (statement stat, tag move)
 
void hpfc_algorithm_row_echelon (Psysteme syst, list scanners, Psysteme *pcond, Psysteme *penum)
 io-compile.c More...
 
list make_list_of_dummy_variables (entity(*creation)(), int number)
 of entity More...
 
static Psysteme generate_shared_io_system (entity array, statement stat, tag move, tag act)
 
static Psysteme generate_distributed_io_system (entity array, statement stat, tag move, tag act)
 
void remove_variables_if_possible (Psysteme *psyst, list *plvars)
 
static Psysteme clean_shared_io_system (Psysteme syst, entity array, tag move)
 
void remove_variables_from_system (Psysteme *ps, list *plv)
 
void clean_the_system (Psysteme *ps, list *plrm, list *pltry)
 
static Psysteme clean_distributed_io_system (Psysteme syst, entity array, tag move)
 collect or update More...
 
static void put_variables_in_ordered_lists (Psysteme *psyst, entity array, list *plparam, list *plproc, list *plscan, list *plrebuild)
 Variables of Psysteme syst are ordered and put in different lists. More...
 
list simplify_deducable_variables (Psysteme syst, list vars, list *pleftvars)
 list simplify_deducable_variables(syst, vars, pleftvars) Psysteme syst; list vars, *pleftvars; More...
 
static list hpfc_order_specific_variables (list le, entity(*creation)())
 output 7 entities created by creation if in list le More...
 
list hpfc_order_variables (list le, bool number_first)
 list hpfc_order_variables(list) More...
 
void hpfc_algorithm_tiling (Psysteme syst, list processors, list scanners, Psysteme *pcondition, Psysteme *pproc_echelon, Psysteme *ptile_echelon)
 
void hpfc_simplify_condition (Psysteme *psc, statement stat, tag move)
 void hpfc_simplify_condition(psc, stat, move) More...
 
static Psysteme generate_io_system (entity array, statement stat, tag move, tag act)
 generates the Psystem for IOs inside the statement stat, that use entity ent which should be a variable. More...
 
static void generate_io_collect_or_update (entity array, statement stat, tag move, tag act, statement *psh, statement *psn)
 
static void add_declaration_to_host_and_link (entity array)
 add a local declaration for entity array on the host. More...
 
void io_efficient_compile (statement stat, statement *hp, statement *np)
 compile an io statement More...
 

Function Documentation

◆ add_declaration_to_host_and_link()

static void add_declaration_to_host_and_link ( entity  array)
static

add a local declaration for entity array on the host.

if entity array is dynamic, then declaration based on the primary.

already exists, just add the link

create the host entity

second link if needed

local, not passed as an argument

Definition at line 876 of file io-compile.c.

878 {
879  entity primary, host_array;
880  storage s;
881 
882  if (dynamic_entity_p(array))
883  {
884  primary = load_primary_entity(array);
885  if (bound_new_host_p(primary)) /* already exists, just add the link */
886  {
888  return;
889  }
890  }
891  else
892  primary = array;
893 
894  /* create the host entity
895  */
896  host_array = AddEntityToModule(primary, host_module);
897  store_new_host_variable(host_array, primary);
898 
899  if (primary!=array) /* second link if needed */
900  store_new_host_variable(host_array, array);
901 
902  /* local, not passed as an argument
903  */
904  s = entity_storage(host_array);
905  if (storage_formal_p(s))
906  formal_offset(storage_formal(s)) = INT_MAX;
907 }
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
Definition: compiler.c:47
bool(* dynamic_entity_p)(entity)
as expected, true if entity e is dynamic.
Definition: dynamic.c:145
void store_new_host_variable(entity new, entity old)
bool bound_new_host_p(entity)
entity load_primary_entity(entity)
entity load_new_host(entity)
entity AddEntityToModule(entity e, entity module)
!!! caution, it may not be a module, but a common...
Definition: entity.c:3171
#define formal_offset(x)
Definition: ri.h:1408
#define storage_formal_p(x)
Definition: ri.h:2522
#define entity_storage(x)
Definition: ri.h:2794
#define storage_formal(x)
Definition: ri.h:2524
static entity array

References AddEntityToModule(), array, bound_new_host_p(), dynamic_entity_p, entity_storage, formal_offset, host_module, load_new_host(), load_primary_entity(), storage_formal, storage_formal_p, and store_new_host_variable().

Referenced by io_efficient_compile().

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

◆ clean_distributed_io_system()

static Psysteme clean_distributed_io_system ( Psysteme  syst,
entity  array,
tag  move 
)
static

collect or update

??? what about the variables? some are usefull, some are constants, and others should be discarded. This selection and projection may be done here.

to be removed: PHIi... THETAi... some GAMMAi... some others coming from the *conditions

loop generation on: PSIi... some GAMMAi... some DELTAi... complementary ALPHAi... (LALPHAi?)

THETA_i's PHI_i's PSI_i's ALPHA_i's LALPHA_i's

Keep parameters !

should try to remove only variables that can be eliminated using the preconditions. Otherwise: ph1=old, 1<=old<=2, projecting old loses the right dimension...

try_remove = CONS(ENTITY, e, try_remove);

others

Parameters
arraysystem to be cleaned
moveio on array

Definition at line 373 of file io-compile.c.

377 {
378  /* ??? what about the variables?
379  * some are usefull, some are constants, and others should
380  * be discarded. This selection and projection may be done here.
381  */
382  /* to be removed:
383  * PHIi...
384  * THETAi...
385  * some GAMMAi...
386  * some others coming from the *conditions
387  *
388  * loop generation on:
389  * PSIi...
390  * some GAMMAi...
391  * some DELTAi...
392  * complementary ALPHAi... (LALPHAi?)
393  */
394  entity
395  template = array_to_template(array),
396  processor = template_to_processors(template);
397  int
398  array_dim = NumberOfDimension(array),
399  template_dim = NumberOfDimension(template),
400  processor_dim = NumberOfDimension(processor);
401  list
402  keep = NIL, try_keep = NIL, remove = NIL,
403  try_remove = base_to_list(sc_base(syst));
404 
405  pips_debug(5, "array %s, movement %s\n", entity_local_name(array),
406  (movement_collect_p(move))?"collect":"update");
407 
408  pips_assert("distributed array", array_distributed_p(array));
409 
410  /* THETA_i's
411  * PHI_i's
412  * PSI_i's
413  * ALPHA_i's
414  * LALPHA_i's
415  */
416  add_to_list_of_vars(remove, get_ith_template_dummy, template_dim);
417  add_to_list_of_vars(remove, get_ith_region_dummy, array_dim);
420  add_to_list_of_vars(try_keep, get_ith_local_dummy, array_dim);
421 
422  /* Keep parameters !
423  */
424  MAP(ENTITY, e,
425  {
426  const char* s = entity_module_name(e);
427 
428  if (strcmp(s, HPFC_PACKAGE) && strcmp(s, REGIONS_MODULE_NAME))
429  keep = CONS(ENTITY, e, keep);
430  /* should try to remove only variables that can be eliminated
431  * using the preconditions. Otherwise: ph1=old, 1<=old<=2,
432  * projecting old loses the right dimension...
433  */
434  /* try_remove = CONS(ENTITY, e, try_remove); */
435  },
436  try_remove);
437 
438  /* others
439  */
440  gen_remove(&try_remove, (entity) TCST);
441  MAP(ENTITY, e, gen_remove(&try_remove, e), keep);
442  MAP(ENTITY, e, gen_remove(&try_remove, e), try_keep);
443  MAP(ENTITY, e, gen_remove(&try_remove, e), remove);
444 
445  DEBUG_ELST(7, "keep", keep);
446  DEBUG_ELST(7, "try_keep", try_keep);
447  DEBUG_ELST(7, "try_remove", try_remove);
448  DEBUG_ELST(7, "remove", remove);
449 
450  clean_the_system(&syst, &remove, &try_remove);
451 
452  DEBUG_SYST(6, entity_name(array), syst);
453 
455  gen_free_list(try_keep);
456  gen_free_list(try_remove);
457 
458  return(syst);
459 }
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
#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
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#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 HPFC_PACKAGE
local definitions
Definition: hpfc-local.h:27
#define array_to_template(array)
#define DEBUG_SYST(D, W, S)
#define DEBUG_ELST(D, W, L)
#define template_to_processors(template)
#define add_to_list_of_vars(l, fun, n)
list of variables...
Definition: defines-local.h:89
list base_to_list(Pbase base)
Most includes are centralized here.
#define movement_collect_p(t)
entity get_ith_template_dummy(int)
entity get_ith_region_dummy(int)
entity get_ith_array_dummy(int)
entity get_ith_processor_dummy(int)
entity get_ith_local_dummy(int)
bool array_distributed_p(entity)
void clean_the_system(Psysteme *ps, list *plrm, list *pltry)
Definition: io-compile.c:360
#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
#define REGIONS_MODULE_NAME
Already defined.
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
int NumberOfDimension(entity)
Definition: size.c:588
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define entity_name(x)
Definition: ri.h:2790
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
@ keep
bj > b1 -> h1/hj = h1
Definition: union-local.h:61
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.

References add_to_list_of_vars, array, array_distributed_p(), array_to_template, base_to_list(), clean_the_system(), CONS, DEBUG_ELST, DEBUG_SYST, ENTITY, entity_local_name(), entity_module_name(), entity_name, gen_free_list(), gen_remove(), get_ith_array_dummy(), get_ith_local_dummy(), get_ith_processor_dummy(), get_ith_region_dummy(), get_ith_template_dummy(), HPFC_PACKAGE, keep, MAP, movement_collect_p, NIL, NumberOfDimension(), pips_assert, pips_debug, REGIONS_MODULE_NAME, TCST, and template_to_processors.

Referenced by generate_io_system().

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

◆ clean_shared_io_system()

static Psysteme clean_shared_io_system ( Psysteme  syst,
entity  array,
tag  move 
)
static

ALPHA_i's PHI_i's

keep parameters !

others

remove variables that have to be removed

Try to remove other unusefull variables

the noisy system is cleaned some variables are not used, they are removed here.

Definition at line 285 of file io-compile.c.

289 {
290  int array_dim = NumberOfDimension(array);
291  list keep = NIL, try_keep = NIL, remove = NIL,
292  try_remove = base_to_list(sc_base(syst));
293 
294  pips_debug(5, "array %s, movement %s\n", entity_local_name(array),
295  (movement_collect_p(move))?"collect":"update");
296 
297  /* ALPHA_i's
298  * PHI_i's
299  */
301  add_to_list_of_vars(remove, get_ith_region_dummy, array_dim);
302 
303  /* keep parameters !
304  */
305  MAP(ENTITY, e,
306  {
307  const char* s = entity_module_name(e);
308 
309  if (strcmp(s, HPFC_PACKAGE) && strcmp(s, REGIONS_MODULE_NAME))
310  keep = CONS(ENTITY, e, keep);
311  },
312  try_remove);
313 
314  /* others
315  */
316  gen_remove(&try_remove, (entity) TCST);
317  MAP(ENTITY, e, gen_remove(&try_remove, e), keep);
318  MAP(ENTITY, e, gen_remove(&try_remove, e), try_keep);
319  MAP(ENTITY, e, gen_remove(&try_remove, e), remove);
320 
321  /* remove variables that have to be removed
322  */
323  MAP(ENTITY, e,
324  sc_projection_along_variable_ofl_ctrl(&syst, (Variable) e, NO_OFL_CTRL),
325  remove);
326 
327  /* Try to remove other unusefull variables
328  */
329  remove_variables_if_possible(&syst, &try_remove);
330 
331  /* the noisy system is cleaned
332  * some variables are not used, they are removed here.
333  */
334  build_sc_nredund_2pass(&syst);
335  base_rm(sc_base(syst));
336  sc_base(syst) = BASE_NULLE;
337  sc_creer_base(syst);
338 
339  DEBUG_SYST(6, entity_name(array), syst);
340 
341  return(syst);
342 }
void remove_variables_if_possible(Psysteme *psyst, list *plvars)
Definition: io-compile.c:245
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
void build_sc_nredund_2pass(Psysteme volatile *psc)
void build_sc_nredund_2pass Psysteme *psc;
#define NO_OFL_CTRL
#define base_rm(b)
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
#define BASE_NULLE
MACROS SUR LES BASES.

References add_to_list_of_vars, array, BASE_NULLE, base_rm, base_to_list(), build_sc_nredund_2pass(), CONS, DEBUG_SYST, ENTITY, entity_local_name(), entity_module_name(), entity_name, gen_remove(), get_ith_array_dummy(), get_ith_region_dummy(), HPFC_PACKAGE, keep, MAP, movement_collect_p, NIL, NO_OFL_CTRL, NumberOfDimension(), pips_debug, REGIONS_MODULE_NAME, remove_variables_if_possible(), sc_creer_base(), and TCST.

Referenced by generate_io_system().

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

◆ clean_the_system()

void clean_the_system ( Psysteme ps,
list plrm,
list pltry 
)
Parameters
pss
plrmof entities
pltryltry

Definition at line 360 of file io-compile.c.

364 {
366  remove_variables_if_possible(ps, pltry);
367 
369  base_rm(sc_base(*ps)), sc_creer_base(*ps);
370 }
void remove_variables_from_system(Psysteme *ps, list *plv)
Definition: io-compile.c:345

References base_rm, build_sc_nredund_2pass(), remove_variables_from_system(), remove_variables_if_possible(), and sc_creer_base().

Referenced by clean_distributed_io_system(), and hpf_remapping().

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

◆ current_entity_is_updated_before_p()

static bool current_entity_is_updated_before_p ( statement  stat,
entity  current_entity 
)
static

IN Regions(effects) are used to verify if the entity current_entity is initialized before it's used in the io statement.

& OUT Regions are not used

get IN Regions(Effects) list for the io statement

list_in = load_statement_in_regions(stat);

for all IN Regions (Effects) for the statement stat, test if reference in current_effect is egal to current_entity

Definition at line 84 of file io-compile.c.

85 {
86  list list_in;
87 
88  if (get_bool_property("HPFC_IGNORE_IN_OUT_REGIONS")) /* & OUT Regions are not used*/
89  return true;
90 
91 /* get IN Regions(Effects) list for the io statement */
92 /* list_in = load_statement_in_regions(stat);*/
93 
94  list_in = load_in_effects_list(stat);
95 
96  ifdebug(2)
97  {
98  pips_debug(3, "IN regions: \n");
99  print_regions(list_in);
100  }
101 
102 /* for all IN Regions (Effects) for the statement stat,
103  test if reference in current_effect is egal to current_entity */
104 
105  MAP(EFFECT, current_effect,
106  {
107  if (effect_variable(current_effect)==current_entity)
108  return true;
109  },
110  list_in);
111 
112  return false;
113 }
static entity current_entity
Definition: alias_check.c:513
void print_regions(list)
list load_in_effects_list(statement)
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define ifdebug(n)
Definition: sg.c:47

References current_entity, EFFECT, effect_variable, get_bool_property(), ifdebug, load_in_effects_list(), MAP, pips_debug, and print_regions().

Referenced by io_efficient_compile().

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

◆ current_entity_is_used_later_p()

static bool current_entity_is_used_later_p ( statement  stat,
entity  current_entity 
)
static

HPFC module by Fabien COELHO.

OUT Regions(effects) are used to verify if the entity current_entity is read in another statement later (note that we don't need to know which statement is reading current_entity)

N & OUT Regions are not used

get OUT Regions(Effects) list for the io statement

list_out = load_statement_out_regions(stat);

for all OUT Regions (Effects) for the statement stat, test if reference in current_effect is egal to current_entity

Definition at line 47 of file io-compile.c.

48 {
49  list list_out;
50 
51  if (get_bool_property("HPFC_IGNORE_IN_OUT_REGIONS"))
52  /*IN & OUT Regions are not used*/
53  return true;
54 
55 
56 /* get OUT Regions(Effects) list for the io statement */
57 /* list_out = load_statement_out_regions(stat);*/
58 
59  list_out = load_out_effects_list(stat);
60 
61  ifdebug(2)
62  {
63  pips_debug(3, "OUT regions: \n");
64  print_regions(list_out);
65  }
66 
67 /* for all OUT Regions (Effects) for the statement stat,
68  test if reference in current_effect is egal to current_entity */
69 
70  MAP(EFFECT, current_effect,
71  {
72  if (effect_variable(current_effect)==current_entity)
73  return true;
74  },
75  list_out);
76 
77  return false;
78 }
list load_out_effects_list(statement)

References current_entity, EFFECT, effect_variable, get_bool_property(), ifdebug, load_out_effects_list(), MAP, pips_debug, and print_regions().

Referenced by io_efficient_compile().

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

◆ generate_distributed_io_system()

static Psysteme generate_distributed_io_system ( entity  array,
statement  stat,
tag  move,
tag  act 
)
static

??? bug: the preconditions may be in the regions. To update, I should have the postconditions instead, that is the statement transformer should be applied to the system.

???

??? massive memory leak polyhedron intersections

the noisy system is cleaned some variables are not used, they are removed here.

Definition at line 197 of file io-compile.c.

202 {
203  Psysteme result = SC_UNDEFINED,
204  /* ??? bug: the preconditions may be in the regions. To update, I
205  * should have the postconditions instead, that is the statement
206  * transformer should be applied to the system.
207  */
210  sother = hpfc_compute_unicity_constraints(array), /* ??? */
211  stamme = hpfc_unstutter_dummies(array),
212  contxt = statement_context(stat, move);
213 
214  /* ??? massive memory leak
215  polyhedron intersections
216 */
217  result = sc_append(sc_rn(NULL), region);
218  result = sc_append(result, dist_v);
219  result = sc_append(result, sother);
220  result = sc_append(result, stamme);
221  result = sc_append(result, contxt);
222 
223  DEBUG_SYST(8, concatenate("whole: ", entity_name(array), NULL), result);
224 
225  /* the noisy system is cleaned
226  * some variables are not used, they are removed here.
227  */
228  build_sc_nredund_2pass(&result);
229  base_rm(sc_base(result));
230  sc_base(result) = NULL;
231  sc_creer_base(result);
232 
233  DEBUG_SYST(9, "region", region);
234  DEBUG_SYST(9, "array syst", dist_v);
235  DEBUG_SYST(9, "hpf unicity", sother);
236  DEBUG_SYST(9, "unstammer", stamme);
237  DEBUG_SYST(9, "context", contxt);
238 
239  DEBUG_SYST(6, concatenate("result: ", entity_name(array), NULL), result);
240 
241  return(result);
242 }
Psysteme hpfc_compute_unicity_constraints(entity e)
Psysteme hpfc_compute_unicity_constraints(e) entity e should be an array;.
Definition: build-system.c:360
Psysteme generate_system_for_distributed_variable(entity v)
Psysteme generate_system_for_variable(v) entity v;.
Definition: build-system.c:789
effect entity_to_region(statement stat, entity ent, tag act)
effect entity_to_region(stat, ent, act) statement stat; entity ent; tag act;
Definition: build-system.c:515
Psysteme hpfc_unstutter_dummies(entity array)
Definition: build-system.c:767
#define region
simulation of the type region
#define effect_system(e)
static Psysteme statement_context(statement stat, tag move)
Definition: io-compile.c:116
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
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...

References array, base_rm, build_sc_nredund_2pass(), concatenate(), DEBUG_SYST, effect_system, entity_name, entity_to_region(), generate_system_for_distributed_variable(), hpfc_compute_unicity_constraints(), hpfc_unstutter_dummies(), region, sc_append(), sc_creer_base(), sc_rn(), and statement_context().

Referenced by generate_io_system().

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

◆ generate_io_collect_or_update()

static void generate_io_collect_or_update ( entity  array,
statement  stat,
tag  move,
tag  act,
statement psh,
statement psn 
)
static

SCANNING: Variables must be classified as:

  • parameters
  • processors
  • scanner
  • deducable

Now we have a set of equations and inequations, and we are going to organise a scanning of the data and the communications that are needed

the sorting is done again at the code generation, but this phase will ensure more determinism in the debug messages

sc_vect_sort(condition, compare_Pvecteur);

array not distributed

the sorting is done again at the code generation, but this phase will ensure more determinism in the debug messages

sc_vect_sort(condition, compare_Pvecteur);

Definition at line 769 of file io-compile.c.

776 {
777  Psysteme syst = generate_io_system(array, stat, move, act);
779 
780  pips_assert("variable and syst",
781  entity_variable_p(array) && syst!=SC_UNDEFINED);
782 
784  {
785  /* SCANNING: Variables must be classified as:
786  * - parameters
787  * - processors
788  * - scanner
789  * - deducable
790  */
791  Psysteme proc_echelon, tile_echelon, condition;
792  list parameters = NIL, processors = NIL, scanners = NIL, rebuild = NIL;
793 
794  /* Now we have a set of equations and inequations, and we are going
795  * to organise a scanning of the data and the communications that
796  * are needed
797  */
799  (&syst, array, &parameters, &processors, &scanners, &rebuild);
800 
801  hpfc_algorithm_tiling(syst, processors, scanners,
802  &condition, &proc_echelon, &tile_echelon);
803  hpfc_simplify_condition(&condition, stat, move);
804 
805  /* the sorting is done again at the code generation,
806  * but this phase will ensure more determinism in the debug messages
807  */
808  /* sc_vect_sort(condition, compare_Pvecteur); */
809  sc_sort(condition, sc_base(condition), compare_Pvecteur);
810  sc_vect_sort(proc_echelon, compare_Pvecteur);
811  sc_vect_sort(tile_echelon, compare_Pvecteur);
812 
813  if (!sc_empty_p(proc_echelon) && !sc_empty_p(tile_echelon))
814  {
816  (array, move,
817  condition, proc_echelon, tile_echelon,
818  parameters, processors, scanners, rebuild,
819  psh, psn);
820  }
821  else
822  {
823  hpfc_warning("empty io for %s\n", entity_name(array));
826  }
827  }
828  else /* array not distributed */
829  {
830  Psysteme row_echelon = SC_UNDEFINED, condition = SC_UNDEFINED;
831  list tmp = NIL, parameters = NIL, scanners = NIL, rebuild = NIL;
832 
833  pips_assert("update", movement_update_p(move));
834 
836  (&syst, array, &parameters, &tmp, &scanners, &rebuild);
837 
838  pips_assert("empty list", ENDP(tmp));
839 
840  hpfc_algorithm_row_echelon(syst, scanners, &condition, &row_echelon);
841  hpfc_simplify_condition(&condition, stat, move);
842 
843  /* the sorting is done again at the code generation,
844  * but this phase will ensure more determinism in the debug messages
845  */
846  /* sc_vect_sort(condition, compare_Pvecteur); */
847  sc_sort(condition, sc_base(condition), compare_Pvecteur);
848  sc_vect_sort(row_echelon, compare_Pvecteur);
849 
850  if (!sc_empty_p(row_echelon))
851  {
853  (array, move,
854  condition, row_echelon,
855  parameters, scanners, rebuild,
856  psh, psn);
857  }
858  else
859  {
860  hpfc_warning("empty io for %s\n", entity_name(array));
863  }
864  }
865 
867 
868  DEBUG_STAT(8, "Host", *psh);
869  DEBUG_STAT(8, "Node", *psn);
870 }
int compare_Pvecteur(Pvecteur *pv1, Pvecteur *pv2)
comparison function for Pvecteur in pips, to be used by qsort.
Definition: constraint.c:50
void reset_information_for_code_optimizations(void)
void set_information_for_code_optimizations(Psysteme)
I could keep the system for further optimizations...
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
statement make_continue_statement(entity)
Definition: statement.c:953
#define hpfc_warning
WARNING.
#define DEBUG_STAT(D, W, S)
#define movement_update_p(t)
void generate_io_statements_for_distributed_arrays(entity, tag, Psysteme, Psysteme, Psysteme, list, list, list, list, statement *, statement *)
void generate_io_statements_for_shared_arrays(entity, tag, Psysteme, Psysteme, list, list, list, statement *, statement *)
static void put_variables_in_ordered_lists(Psysteme *psyst, entity array, list *plparam, list *plproc, list *plscan, list *plrebuild)
Variables of Psysteme syst are ordered and put in different lists.
Definition: io-compile.c:470
void hpfc_simplify_condition(Psysteme *psc, statement stat, tag move)
void hpfc_simplify_condition(psc, stat, move)
Definition: io-compile.c:724
void hpfc_algorithm_row_echelon(Psysteme syst, list scanners, Psysteme *pcond, Psysteme *penum)
io-compile.c
Definition: io-compile.c:127
void hpfc_algorithm_tiling(Psysteme syst, list processors, list scanners, Psysteme *pcondition, Psysteme *pproc_echelon, Psysteme *ptile_echelon)
Definition: io-compile.c:689
static Psysteme generate_io_system(entity array, statement stat, tag move, tag act)
generates the Psystem for IOs inside the statement stat, that use entity ent which should be a variab...
Definition: io-compile.c:740
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define entity_undefined
Definition: ri.h:2761
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
void sc_vect_sort(Psysteme s, int(*compare)(Pvecteur *, Pvecteur *))
the name is self explanatory, I guess.
Definition: sc_unaires.c:116
void sc_sort(Psysteme sc, Pbase sort_base, int(*compare)(Pvecteur *, Pvecteur *))
SORT a Psysteme according to sort_base and compare (given to qsort).
Definition: sc_unaires.c:137

References array, array_distributed_p(), compare_Pvecteur(), DEBUG_STAT, ENDP, entity_name, entity_undefined, entity_variable_p, generate_io_statements_for_distributed_arrays(), generate_io_statements_for_shared_arrays(), generate_io_system(), hpfc_algorithm_row_echelon(), hpfc_algorithm_tiling(), hpfc_simplify_condition(), hpfc_warning, make_continue_statement(), movement_update_p, NIL, pips_assert, put_variables_in_ordered_lists(), reset_information_for_code_optimizations(), sc_empty_p(), sc_sort(), sc_vect_sort(), and set_information_for_code_optimizations().

Referenced by io_efficient_compile().

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

◆ generate_io_system()

static Psysteme generate_io_system ( entity  array,
statement  stat,
tag  move,
tag  act 
)
static

generates the Psystem for IOs inside the statement stat, that use entity ent which should be a variable.

Definition at line 740 of file io-compile.c.

745 {
746  Psysteme result = SC_UNDEFINED;
747 
748  pips_assert("variable", entity_variable_p(array));
749 
751  {
752  result = generate_distributed_io_system(array, stat, move, act);
753  result = clean_distributed_io_system(result, array, move);
754  }
755  else
756  {
757  result = generate_shared_io_system(array, stat, move, act);
758  result = clean_shared_io_system(result, array, move);
759  }
760 
762 
763  DEBUG_SYST(2, concatenate("array ", entity_name(array), NULL), result);
764 
765  return result;
766 }
static Psysteme generate_distributed_io_system(entity array, statement stat, tag move, tag act)
Definition: io-compile.c:197
static Psysteme clean_shared_io_system(Psysteme syst, entity array, tag move)
Definition: io-compile.c:285
static Psysteme generate_shared_io_system(entity array, statement stat, tag move, tag act)
Definition: io-compile.c:156
static Psysteme clean_distributed_io_system(Psysteme syst, entity array, tag move)
collect or update
Definition: io-compile.c:373

References array, array_distributed_p(), clean_distributed_io_system(), clean_shared_io_system(), compare_Pvecteur(), concatenate(), DEBUG_SYST, entity_name, entity_variable_p, generate_distributed_io_system(), generate_shared_io_system(), pips_assert, and sc_vect_sort().

Referenced by generate_io_collect_or_update().

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

◆ generate_shared_io_system()

static Psysteme generate_shared_io_system ( entity  array,
statement  stat,
tag  move,
tag  act 
)
static

??? bug post with region

the noisy system is cleaned some variables are not used, they are removed here.

Definition at line 156 of file io-compile.c.

161 {
162  Psysteme
163  result = SC_UNDEFINED, /* ??? bug post with region */
164  region = effect_system(entity_to_region(stat, array, act)),
166  stamme = hpfc_unstutter_dummies(array),
167  contxt = statement_context(stat, move);
168 
169  pips_assert("distributed array", !array_distributed_p(array));
170 
171  result = sc_append(sc_rn(NULL), region);
172  result = sc_append(result, a_decl);
173  result = sc_append(result, stamme);
174  result = sc_append(result, contxt);
175 
176  DEBUG_SYST(8, concatenate("whole: ", entity_name(array), NULL), result);
177 
178  /* the noisy system is cleaned
179  * some variables are not used, they are removed here.
180  */
181  sc_nredund(&result);
182  base_rm(sc_base(result));
183  sc_base(result) = NULL;
184  sc_creer_base(result);
185 
186  DEBUG_SYST(7, "region", region);
187  DEBUG_SYST(7, "array declaration", a_decl);
188  DEBUG_SYST(7, "unstammer", stamme);
189  DEBUG_SYST(7, "context", contxt);
190 
191  DEBUG_SYST(6, concatenate("result: ", entity_name(array), NULL), result);
192 
193  return result;
194 }
Psysteme entity_to_declaration_constraints(entity e, tag what)
gives back the constraints due to the declarations.
Definition: build-system.c:285

References array, array_distributed_p(), base_rm, concatenate(), DEBUG_SYST, effect_system, entity_name, entity_to_declaration_constraints(), entity_to_region(), hpfc_unstutter_dummies(), pips_assert, region, sc_append(), sc_creer_base(), sc_rn(), and statement_context().

Referenced by generate_io_system().

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

◆ hpfc_algorithm_row_echelon()

void hpfc_algorithm_row_echelon ( Psysteme  syst,
list  scanners,
Psysteme pcond,
Psysteme penum 
)

io-compile.c

this should improve conditions?

Parameters
systyst
scannerscanners
pcondcond
penumenum

Definition at line 127 of file io-compile.c.

132 {
133  Pbase base = entity_list_to_base(scanners);
134  algorithm_row_echelon_generic(syst, base, pcond, penum,
135  get_bool_property("HPFC_REDUNDANT_SYSTEMS_FOR_REMAPS"));
136  /* this should improve conditions? */
137  sc_find_equalities(pcond);
138  base_rm(base);
139 }
bdt base
Current expression.
Definition: bdt_read_paf.c:100
Pbase entity_list_to_base(list l)
Definition: entity.c:2860
void algorithm_row_echelon_generic(Psysteme scn, Pbase base_index, Psysteme *pcondition, Psysteme *penumeration, bool redundancy)
each variable should be at least within one <= and one >=; scn IS NOT modified.
void sc_find_equalities(Psysteme *ps)
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89

References algorithm_row_echelon_generic(), base, base_rm, entity_list_to_base(), get_bool_property(), and sc_find_equalities().

Referenced by generate_io_collect_or_update(), hpf_remapping(), and processor_loop().

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

◆ hpfc_algorithm_tiling()

void hpfc_algorithm_tiling ( Psysteme  syst,
list  processors,
list  scanners,
Psysteme pcondition,
Psysteme pproc_echelon,
Psysteme ptile_echelon 
)
Parameters
systyst
processorsrocessors
scannerscanners
pconditioncondition
pproc_echelonproc_echelon
ptile_echelontile_echelon

Definition at line 689 of file io-compile.c.

696 {
697  Pbase
698  outer = entity_list_to_base(processors),
699  inner = entity_list_to_base(scanners);
700 
701  DEBUG_SYST(8, "initial system", syst);
702 
703  algorithm_tiling(syst, outer, inner,
704  pcondition, pproc_echelon, ptile_echelon);
705 
706  DEBUG_SYST(3, "condition", *pcondition);
707  DEBUG_BASE(3, "proc vars", outer);
708  DEBUG_SYST(3, "processors", *pproc_echelon);
709  DEBUG_BASE(3, "tile vars", inner);
710  DEBUG_SYST(3, "tiles", *ptile_echelon);
711 
712  base_rm(outer);
713  base_rm(inner);
714 }
#define DEBUG_BASE(D, W, B)
void algorithm_tiling(Psysteme syst, Pbase outer, Pbase inner, Psysteme *pcondition, Psysteme *ptile_enum, Psysteme *piter_enum)

References algorithm_tiling(), base_rm, DEBUG_BASE, DEBUG_SYST, and entity_list_to_base().

Referenced by generate_io_collect_or_update().

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

◆ hpfc_order_specific_variables()

static list hpfc_order_specific_variables ( list  le,
entity(*)()  creation 
)
static

output 7 entities created by creation if in list le

of entity

Definition at line 605 of file io-compile.c.

608 {
609  list result = NIL;
610  int i;
611 
612  for(i=7; i>=1; i--)
613  {
614  entity dummy = creation(i);
615 
616  if (gen_in_list_p(dummy, le))
617  result = CONS(ENTITY, dummy, result);
618  }
619 
620  return(result);
621 }
int dummy
A dummy file, to prevent empty libraries from breaking builds.
Definition: dummy.c:41
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734

References CONS, ENTITY, gen_in_list_p(), and NIL.

Referenced by hpfc_order_variables().

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

◆ hpfc_order_variables()

list hpfc_order_variables ( list  le,
bool  number_first 
)

list hpfc_order_variables(list)

the input list of entities is ordered so that: PSI_i's, GAMMA_i's, DELTA_i's, IOTA_i's, ALPHA_i's, LALPHA_i's...

reverse!

Parameters
lee
number_firstumber_first

Definition at line 629 of file io-compile.c.

632 {
633  list result = NIL;
634 
635  result =
636  gen_nconc(result,
638 
639  if (number_first)
640  {
641  int i;
642  list l = NIL, lr = NIL;
643 
644  for (i=7; i>0; i--)
649  l))));
650 
651  MAP(ENTITY, e,
652  {
653  if (gen_in_list_p(e, le)) lr = CONS(ENTITY, e, lr); /* reverse! */
654  },
655  l);
656 
657  gen_free_list(l);
658  result = gen_nconc(result, lr);
659  }
660  else
661  {
662  result =
663  gen_nconc(result,
665 
666  result =
667  gen_nconc(result,
669 
670  result =
671  gen_nconc(result,
673 
674  result =
675  gen_nconc(result,
677  }
678 
679  result =
680  gen_nconc(result,
682 
683  pips_assert("same length", gen_length(result)==gen_length(le));
684 
685  return(result);
686 }
size_t gen_length(const list l)
Definition: list.c:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
entity get_ith_cycle_dummy(int)
entity get_ith_shift_dummy(int)
entity get_ith_block_dummy(int)
static list hpfc_order_specific_variables(list le, entity(*creation)())
output 7 entities created by creation if in list le
Definition: io-compile.c:605

References CONS, ENTITY, gen_free_list(), gen_in_list_p(), gen_length(), gen_nconc(), get_ith_array_dummy(), get_ith_block_dummy(), get_ith_cycle_dummy(), get_ith_local_dummy(), get_ith_processor_dummy(), get_ith_shift_dummy(), hpfc_order_specific_variables(), MAP, NIL, and pips_assert.

Referenced by put_variables_in_ordered_lists().

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

◆ hpfc_simplify_condition()

void hpfc_simplify_condition ( Psysteme psc,
statement  stat,
tag  move 
)

void hpfc_simplify_condition(psc, stat, move)

remove conditions that are not usefull from *psc, i.e. that are redundent with pre/post conditions depending on when the movement is done

Parameters
pscsc
stattat
moveove

Definition at line 724 of file io-compile.c.

728 {
729  Psysteme
730  pstrue = statement_context(stat, move),
731  cleared = extract_nredund_subsystem(*psc, pstrue);
732 
733  *psc = (sc_rm(*psc), cleared);
734 }
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
Psysteme extract_nredund_subsystem(Psysteme s1, Psysteme s2)
Psysteme extract_nredund_subsystem(s1, s2) Psysteme s1, s2;.

References extract_nredund_subsystem(), sc_rm(), and statement_context().

Referenced by generate_io_collect_or_update().

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

◆ io_efficient_compile()

void io_efficient_compile ( statement  stat,
statement hp,
statement np 
)

compile an io statement

returned Node code

of effect

not implemented

Parameters
stattat
hpstatement to compile
npreturned Host code

Definition at line 911 of file io-compile.c.

915 {
916  list
917  /* of effect */ entities = load_rw_effects_list(stat),
918  lh_collect = NIL, lh_io = NIL, lh_update = NIL,
919  ln_collect = NIL, ln_io = NIL, ln_update = NIL;
920  statement sh, sn;
921 
922  debug_on("HPFC_IO_DEBUG_LEVEL");
923  pips_debug(1, "compiling!\n");
924  pips_debug(2, "statement %" _intFMT " (%p), %zd arrays\n",
925  statement_number(stat), stat, gen_length(entities));
926 
927  // quicker for continue and so...
928  if (empty_code_p(stat))
929  {
930  pips_debug(3, "empty statement\n");
931  *hp = copy_statement(stat);
932  *np = copy_statement(stat);
933  debug_off();
934  return;
935  }
936 
937  // for each effect e on that statement
938  FOREACH(effect, e, entities)
939  {
941  pips_debug(3, "variable %s\n", entity_name(array));
942 
943  if (io_effect_entity_p(array)) // skip LUNS
944  continue;
945 
946  action act = effect_action(e);
948 
949  pips_assert("avoid replicated array I/O", /* not implemented */
951 
952  if ((!array_distributed_p(array)) && action_read_p(act))
953  {
954  pips_debug(7, "skipping array %s movements - none needed\n",
955  entity_name(array));
956  continue;
957  }
958 
959  // add array declaration on host if necessary
962 
963  // collect data if necessary
964  if (array_distributed_p(array) &&
966  (action_read_p(act) ||
967  (action_write_p(act) &&
968  approximation_may_p(apr) &&
969  !get_bool_property("HPFC_IGNORE_MAY_IN_IO"))))
970  {
972  action_tag(act), &sh, &sn);
973  lh_collect = CONS(STATEMENT, sh, lh_collect);
974  ln_collect = CONS(STATEMENT, sn, ln_collect);
975  }
976 
977  // update data if necessary
978  // action = write and data may be used later (out regions)
980  {
982  action_tag(act), &sh, &sn);
983  lh_update = CONS(STATEMENT, sh, lh_update);
984  ln_update = CONS(STATEMENT, sn, ln_update);
985  }
986  }
987 
988  lh_io = CONS(STATEMENT, copy_statement(stat), NIL);
989 
990  if (get_bool_property("HPFC_SYNCHRONIZE_IO"))
991  {
992  // could do it only for write statements
994 
995  lh_io = CONS(STATEMENT, hpfc_make_call_statement(synchro, NIL), lh_io);
996  ln_io = CONS(STATEMENT, hpfc_make_call_statement(synchro, NIL), ln_io);
997  }
998 
999  *hp = make_block_statement(gen_nconc(lh_collect,
1000  gen_nconc(lh_io,
1001  lh_update)));
1002  *np = make_block_statement(gen_nconc(ln_collect,
1003  gen_nconc(ln_io,
1004  ln_update)));
1005 
1006  DEBUG_STAT(9, "Host", *hp);
1007  DEBUG_STAT(9, "Node", *np);
1008 
1009  debug_off();
1010 }
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
list load_rw_effects_list(statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
bool io_effect_entity_p(entity)
Definition: effects.c:496
#define effect_action(x)
Definition: effects.h:642
#define approximation_may_p(x)
Definition: effects.h:363
#define action_write_p(x)
Definition: effects.h:314
#define action_tag(x)
Definition: effects.h:310
#define action_read_p(x)
Definition: effects.h:311
#define effect_approximation(x)
Definition: effects.h:644
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
#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
bool empty_code_p(statement)
statement.c
Definition: statement.c:86
bool replicated_p(entity e)
replicated_p
Definition: hpfc-util.c:96
#define SYNCHRO
#define is_movement_update
#define is_movement_collect
Efficient I/O tags.
entity hpfc_name_to_entity(const char *)
Definition: run-time.c:817
statement hpfc_make_call_statement(entity, list)
statement hpfc_make_call_statement(e, l) generate a call statement to function e, with expression lis...
Definition: run-time.c:318
static bool current_entity_is_updated_before_p(statement stat, entity current_entity)
IN Regions(effects) are used to verify if the entity current_entity is initialized before it's used i...
Definition: io-compile.c:84
static void add_declaration_to_host_and_link(entity array)
add a local declaration for entity array on the host.
Definition: io-compile.c:876
static bool current_entity_is_used_later_p(statement stat, entity current_entity)
HPFC module by Fabien COELHO.
Definition: io-compile.c:47
static void generate_io_collect_or_update(entity array, statement stat, tag move, tag act, statement *psh, statement *psn)
Definition: io-compile.c:769
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define _intFMT
Definition: newgen_types.h:57
#define reference_variable(x)
Definition: ri.h:2326
#define statement_number(x)
Definition: ri.h:2452
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References _intFMT, action_read_p, action_tag, action_write_p, add_declaration_to_host_and_link(), approximation_may_p, array, array_distributed_p(), bound_new_host_p(), CONS, copy_statement(), current_entity_is_updated_before_p(), current_entity_is_used_later_p(), debug_off, debug_on, DEBUG_STAT, effect_action, effect_any_reference, effect_approximation, empty_code_p(), entity_name, FOREACH, gen_length(), gen_nconc(), generate_io_collect_or_update(), get_bool_property(), hpfc_make_call_statement(), hpfc_name_to_entity(), io_effect_entity_p(), is_movement_collect, is_movement_update, load_rw_effects_list(), make_block_statement(), NIL, pips_assert, pips_debug, reference_variable, replicated_p(), STATEMENT, statement_number, and SYNCHRO.

Referenced by hpf_compiler().

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

◆ make_list_of_dummy_variables()

list make_list_of_dummy_variables ( entity(*)()  creation,
int  number 
)

of entity

Definition at line 143 of file io-compile.c.

146 {
147  list result = NIL;
148 
149  for(;number>0;number--)
150  result = CONS(ENTITY, creation(number), result);
151 
152  return result;
153 }

References CONS, ENTITY, and NIL.

◆ put_variables_in_ordered_lists()

static void put_variables_in_ordered_lists ( Psysteme psyst,
entity  array,
list plparam,
list plproc,
list plscan,
list plrebuild 
)
static

Variables of Psysteme syst are ordered and put in different lists.

Especially, deducable variables are listed, the equalities that allow to rebuild them are also listed, and they are removed from the original system by exact integer projection.

Other variables are (should be) the parameters, the processors, and the variables to be used to scan polyhedron.

just in case

parameters: those variables that are not dummies...

processors

scanners and deducables

return results

lscan is implicitely ordered

Definition at line 470 of file io-compile.c.

477 {
478  int processor_dim = (array_distributed_p(array) ?
480  dim = -1;
481  list
482  all = base_to_list(sc_base(*psyst)),
483  lparam = NIL, lproc = NIL, lscan = NIL, lrebuild = NIL;
484 
485  gen_remove(&all, (entity) TCST); /* just in case */
486 
487  pips_debug(5, "considering %zd variables\n", gen_length(all));
488 
489  /* parameters: those variables that are not dummies...
490  */
491  MAP(ENTITY, v,
492  if (!entity_hpfc_dummy_p(v)) lparam = CONS(ENTITY, v, lparam),
493  all);
494 
495  MAP(ENTITY, e, gen_remove(&all, e), lparam);
496 
497  /* processors
498  */
499  for(dim=processor_dim; dim>=1; dim--)
500  {
501  entity
503 
504  lproc = CONS(ENTITY, dummy, lproc);
505  gen_remove(&all, dummy);
506  }
507 
508  /* scanners and deducables
509  */
510  lrebuild =
513  true)),
514  &lscan);
515 
516  /* return results
517  */
518  *plparam = lparam,
519  *plproc = lproc,
520  *plscan = lscan, /* lscan is implicitely ordered */
521  *plrebuild = lrebuild;
522 
523  gen_free_list(all);
524 
525  DEBUG_ELST(4, "params", lparam);
526  DEBUG_ELST(4, "procs", lproc);
527  DEBUG_ELST(4, "scanners", lscan);
528 
529  ifdebug(4)
530  {
532 
533  fprintf(stderr, "deducables:\n ");
534  MAP(EXPRESSION, ex,
535  {
537 
538  fprintf(stderr, "%s rebuilt with ", entity_local_name
540  egalite_fprint(stderr, pc, (string(*)(Variable))entity_local_name);
541  },
542  lrebuild);
543  }
544 
545  build_sc_nredund_2pass(psyst);
546  sc_base(*psyst) = (base_rm(sc_base(*psyst)), BASE_NULLE);
547  sc_creer_base(*psyst);
548 
549  DEBUG_SYST(4, entity_name(array), *psyst);
550 }
bool entity_hpfc_dummy_p(entity e)
Variables.
Definition: build-system.c:106
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
void egalite_fprint(FILE *, Pcontrainte, char *(*)(Variable))
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define array_to_processors(array)
list hpfc_order_variables(list le, bool number_first)
list hpfc_order_variables(list)
Definition: io-compile.c:629
list simplify_deducable_variables(Psysteme syst, list vars, list *pleftvars)
list simplify_deducable_variables(syst, vars, pleftvars) Psysteme syst; list vars,...
Definition: io-compile.c:562
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define expression_normalized(x)
Definition: ri.h:1249
#define normalized_linear(x)
Definition: ri.h:1781
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Pvecteur vecteur
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

References array, array_distributed_p(), array_to_processors, BASE_NULLE, base_rm, base_to_list(), build_sc_nredund_2pass(), CONS, contrainte_make(), DEBUG_ELST, DEBUG_SYST, egalite_fprint(), ENTITY, entity_hpfc_dummy_p(), entity_local_name(), entity_name, EXPRESSION, expression_normalized, expression_reference(), fprintf(), gen_free_list(), gen_length(), gen_nreverse(), gen_remove(), get_ith_processor_dummy(), hpfc_order_variables(), ifdebug, MAP, NIL, normalized_linear, NumberOfDimension(), pips_debug, reference_variable, sc_creer_base(), simplify_deducable_variables(), TCST, Scontrainte::vecteur, and VECTEUR_NUL.

Referenced by generate_io_collect_or_update().

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

◆ remove_variables_from_system()

void remove_variables_from_system ( Psysteme ps,
list plv 
)
Parameters
pss
plvof entity (Variable)

Definition at line 345 of file io-compile.c.

348 {
349  MAP(ENTITY, e,
350  {
351  pips_debug(8, "removing variable %s\n", entity_local_name(e));
352  sc_projection_along_variable_ofl_ctrl(ps, (Variable) e, NO_OFL_CTRL);
353  },
354  *plv);
355 
356  gen_free_list(*plv), *plv=NIL;
357 }

References ENTITY, entity_local_name(), gen_free_list(), MAP, NIL, NO_OFL_CTRL, and pips_debug.

Referenced by clean_the_system().

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

◆ remove_variables_if_possible()

void remove_variables_if_possible ( Psysteme psyst,
list plvars 
)
Parameters
psystsyst
plvarslvars

Definition at line 245 of file io-compile.c.

248 {
249  Psysteme syst = *psyst;
250  list kept = NIL;
251 
252  MAP(ENTITY, e,
253  {
254  Variable var = (Variable) e;
255  Value coeff = VALUE_MONE;
256 
257  (void) contrainte_var_min_coeff(sc_egalites(syst), var, &coeff, false);
258 
259  if (value_one_p(coeff))
260  {
261  Pvecteur v = vect_new(var, VALUE_ONE);
262  bool exact = true;
263 
264  pips_debug(7, "removing variable %s\n",
265  entity_local_name((entity) var));
266 
267  sc_projection_along_variables_with_test_ofl_ctrl
268  (&syst, v, &exact, NO_OFL_CTRL);
269 
270  pips_assert("exact projection", exact);
271  vect_rm(v);
272  }
273  else
274  kept = CONS(ENTITY, (entity) var, kept);
275  },
276  *plvars);
277 
278  base_rm(sc_base(syst)), sc_base(syst) = BASE_NULLE, sc_creer_base(syst);
279 
280  *psyst = syst;
281  gen_free_list(*plvars), *plvars=kept;
282 }
#define value_one_p(val)
#define VALUE_MONE
int Value
#define VALUE_ONE
Pcontrainte contrainte_var_min_coeff(Pcontrainte, Variable, Value *, bool)
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list ...
Definition: unaires.c:345
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References BASE_NULLE, base_rm, CONS, contrainte_var_min_coeff(), ENTITY, entity_local_name(), gen_free_list(), MAP, NIL, NO_OFL_CTRL, pips_assert, pips_debug, sc_creer_base(), VALUE_MONE, VALUE_ONE, value_one_p, vect_new(), and vect_rm().

Referenced by clean_shared_io_system(), and clean_the_system().

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

◆ simplify_deducable_variables()

list simplify_deducable_variables ( Psysteme  syst,
list  vars,
list pleftvars 
)

list simplify_deducable_variables(syst, vars, pleftvars) Psysteme syst; list vars, *pleftvars;

variables from entity list vars that can be rebuilt by the Psysteme syst are removed from it and stored as an expression list which is returned. The variables that are not removed are returned as another entity list, *pleftvars. of expression

Parameters
systyst
varsars
pleftvarsleftvars

Definition at line 562 of file io-compile.c.

566 {
567  list result = NIL;
568  *pleftvars = NIL;
569 
570  MAP(ENTITY, dummy,
571  {
573  Value coeff = VALUE_ZERO;
574 
575  if (eq = eq_v_min_coeff(sc_egalites(syst), (Variable) dummy, &coeff),
576  value_one_p(coeff))
577  {
578  result =
583  vect_dup(eq->vecteur))),
584  result);
585 
586  syst = sc_variable_substitution_with_eq_ofl_ctrl(syst, eq,
587  (Variable) dummy,
588  FWD_OFL_CTRL);
589  }
590  else
591  {
592  *pleftvars = CONS(ENTITY, dummy, *pleftvars);
593  }
594  },
595  vars);
596 
597  base_rm(sc_base(syst)), sc_base(syst) = BASE_NULLE, sc_creer_base(syst);
598 
599  return(result);
600 }
normalized make_normalized(enum normalized_utype tag, void *val)
Definition: ri.c:1447
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
#define VALUE_ZERO
#define CONTRAINTE_UNDEFINED
@ is_syntax_reference
Definition: ri.h:2691
@ is_normalized_linear
Definition: ri.h:1760
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
#define FWD_OFL_CTRL
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 BASE_NULLE, base_rm, CONS, CONTRAINTE_UNDEFINED, ENTITY, eq, EXPRESSION, FWD_OFL_CTRL, is_normalized_linear, is_syntax_reference, make_expression(), make_normalized(), make_reference(), make_syntax(), MAP, NIL, sc_creer_base(), value_one_p, VALUE_ZERO, vect_dup(), and Scontrainte::vecteur.

Referenced by extract_lattice(), hpf_remapping(), and put_variables_in_ordered_lists().

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

◆ statement_context()

static Psysteme statement_context ( statement  stat,
tag  move 
)
static

Definition at line 116 of file io-compile.c.

119 {
121  ((movement_collect_p(move)) ?
124 }
#define transformer_relation(x)
Definition: ri.h:2873
#define predicate_system(x)
Definition: ri.h:2069
transformer load_statement_precondition(statement)
transformer load_statement_postcondition(statement)

References load_statement_postcondition(), load_statement_precondition(), movement_collect_p, predicate_system, and transformer_relation.

Referenced by generate_distributed_io_system(), generate_shared_io_system(), and hpfc_simplify_condition().

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