25 #include "pips_config.h"
38 #include "resources.h"
59 for(*psize=1; dim>0; dim--)
91 for(*psize=1, i=fortran_way ? dim : 1 ;
92 fortran_way ? i>0 : i<=dim;
93 i+= fortran_way ? -1 : 1)
236 for (i=p2dim; i>0; i--)
258 for (i=p1dim; i>0; i--)
263 for (i=p2dim; i>0; i--)
318 Psysteme condition, enumeration, known, simpler;
319 statement define_psis, compute_lid, oth_loop, if_guard;
325 compute_lid = (lid) ?
494 #define ret(name) result = name; break
504 bool is_lazy = what &
LZY,
505 is_buff = what &
BUF;
604 is_lazy ?
"lazy" :
"not lazy",
605 is_buff ?
"bufferized" :
"not bufferized");
628 bool is_buffer, is_lazy;
633 what = (is_lazy ?
LZY :
NLZ) + (is_buffer ?
BUF :
NBF) + t;
635 prel =
gen(what+
PRE,
src, trg, lid, proc,
637 inner =
gen(what+
INL,
src, trg, lid, proc,
639 postl =
gen(what+
PST,
src, trg, lid, proc,
652 t==
CPY ?
"copy" : t==
SND ?
"send" : t==
RCV ?
"receiv" :
653 t==
BRD ?
"broadcast" :
"?",
"ing\n", NULL));
696 statement copy, recv, send, receive, cont, result;
699 pips_debug(3,
"%s taking care of processor cyclic distribution\n",
700 dist_p ?
"actually" :
"not");
717 (procs, l, lp, p_src, p_trg, lid, NULL,
741 (sd, l, lpproc, p_src, p_trg, lid, is_buffer ? trg : NULL,
755 (procs, lp, l, p_trg, p_src, lid, NULL,
773 asprintf(&
buffer,
"! remapping %s[%"PRIdPTR
"]: %s[%"PRIdPTR
"] -> %s[%"PRIdPTR
"]\n",
918 if (
array != butthisone)
1012 already_seen =
CONS(
ENTITY, primary, already_seen);
1041 bool proc_distribution_p;
1042 list l, lp, ll, lrm, ld, lo, left, scanners,
1075 DEBUG_SYST(4,
"without deducables system", p);
1080 if (proc_distribution_p)
gen_remove(&lo, lambda);
1106 if (sc_egalites(proc))
1107 hpfc_warning(
"lattice extraction not implemented (proc)\n");
1113 if (sc_egalites(enume))
1126 (
src, trg, proc, enume, l, lp, scanners, ld, lddc, proc_distribution_p));
1193 debug_on(
"PRETTYPRINT_DEBUG_LEVEL");
1310 debug_on(
"HPFC_REMAPPING_DEBUG_LEVEL");
call make_call(entity a1, list a2)
reference make_reference(entity a1, list a2)
test make_test(expression a1, statement a2, statement a3)
void free_statement(statement p)
struct _newgen_struct_entity_ * entity
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
Psysteme entity_to_declaration_constraints(entity e, tag what)
gives back the constraints due to the declarations.
Psysteme generate_system_for_equal_variables(int n, entity(*gen1)(int), entity(*gen2)(int))
Psysteme shift_system_to_prime_variables(Psysteme s)
Psysteme generate_system_for_distributed_variable(entity v)
Psysteme generate_system_for_variable(v) entity v;.
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
void reset_information_for_code_optimizations(void)
statement systeme_to_loop_nest(Psysteme, list, statement, entity)
sc is used to generate the loop nest bounds for variables vars.
void set_information_for_code_optimizations(Psysteme)
I could keep the system for further optimizations...
statement generate_optional_if(Psysteme, statement)
statement generate_optional_if(sc, stat)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
void gen_free(gen_chunk *obj)
version without shared_pointers.
statement hpfc_compute_lid(entity lid, entity proc, entity(*creation)(), entity array)
statement st_compute_lid(proc)
statement hpfc_lazy_guard(bool snd, statement then)
returns if (LAZY_{SEND,RECV}) then
statement generate_deducables(list le)
statement generate_deducables(list le)
statement hpfc_lazy_packing(entity array, entity lid, entity(*creation)(), bool pack, bool lazy)
the lazy issues.
statement define_node_processor_id(entity proc, entity(*creation)(int))
builds a statement VAR_i = MYPOS(i, proc_number) // i=1 to proc dimension
statement hpfc_generate_message(entity ld, bool send, bool lazy)
expression make_reference_expression(entity e, entity(*creation)())
statement hpfc_initsend(bool lazy)
statement hpfc_buffer_initialization(bool is_send, _UNUSED_ bool is_lazy, bool job_was_done)
statement hpfc_broadcast_if_necessary(entity array, entity trg, entity lid, entity proc, bool is_lazy)
lazy or not...
statement hpfc_lazy_buffer_packing(entity src, entity trg, entity lid, entity proc, entity(*array_dim)(), bool is_send, bool is_lazy)
lazy in actually sending or not the packed buffer immediatly...
statement make_block_statement(list)
Make a block statement from a list of statement.
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#define ENDP(l)
Test if a list is empty.
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define NIL
The empty list (nil in Lisp)
void gen_map(gen_iter_func_t fp, const list l)
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
list gen_copy_seq(list l)
Copy a list structure.
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
void gen_free_list(list l)
free the spine of the list
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
statement make_assign_statement(expression, expression)
void insert_comments_to_statement(statement, const char *)
Insert a comment string (if non empty) at the beginning of the comments of a statement.
void update_object_for_module(void *obj, entity module)
#define RENAMING(x)
RENAMING.
void get_entity_dimensions(entity e, int dim, int *plow, int *pup)
bool replicated_p(entity e)
replicated_p
bool processors_dim_replicated_p(_UNUSED_ entity p, entity a, int i)
true if array a is replicated on processors p i-th dimension.
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
FILE * hpfc_fopen(string name)
void hpfc_fclose(FILE *f, string name)
list list_of_distributed_arrays_for_module(entity module)
returns the list of entities that are 'local' to module
#define array_to_template(array)
#define DEBUG_SYST(D, W, S)
#define array_to_processors(array)
#define what_stat_debug(level, stat)
#define DEBUG_ELST(D, W, L)
#define template_to_processors(template)
#define hpfc_warning
WARNING.
#define DEBUG_STAT(D, W, S)
#define primary_entity_p(a)
#define add_to_list_of_vars(l, fun, n)
list of variables...
list base_to_list(Pbase base)
Most includes are centralized here.
#define set_logical(var, b)
void add_remapping_as_computed(renaming r, list vars)
variables to be declared
void add_remapping_as_used(renaming x)
bool remapping_already_computed_p(renaming x)
list of already computed remappings...
entity get_ith_array_prime(int)
entities load_dynamic_hpf(entity)
entity hpfc_name_to_entity(const char *)
entity get_ith_template_dummy(int)
entity load_similar_mapping(entity)
entity get_ith_cycle_dummy(int)
void clean_the_system(Psysteme *, list *, list *)
list load_renamings(statement)
entity get_ith_processor_prime(int)
entity get_ith_array_dummy(int)
entity get_ith_template_prime(int)
entity load_primary_entity(entity)
entity get_ith_cycle_prime(int)
entity get_ith_local_prime(int)
entity get_ith_block_dummy(int)
entity get_ith_processor_dummy(int)
void hpfc_algorithm_row_echelon(Psysteme, list, Psysteme *, Psysteme *)
io-compile.c
entity get_ith_local_dummy(int)
bool bound_dynamic_hpf_p(entity)
list simplify_deducable_variables(Psysteme, list, list *)
list simplify_deducable_variables(syst, vars, pleftvars) Psysteme syst; list vars,...
entity get_ith_block_prime(int)
entity get_ith_temporary_dummy(int)
intptr_t load_hpf_number(entity)
entities load_maybeuseful_mappings(statement)
void extract_lattice(Psysteme, list, list *, list *)
lattice_extraction.c
string db_get_directory_name_for_module(const char *name)
returns the allocated and mkdir'ed directory for module name
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_internal_error
void push_performance_spy(void)
perf_spy.c
void pop_performance_spy(FILE *, string)
string concatenate(const char *,...)
Return the concatenation of the given strings.
void(* gen_iter_func_t)(void *)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
#define WORKSPACE_SRC_SPACE
text Text_Statement(entity, int, statement)
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
static statement if_different_pe_and_not_twin(entity src, entity lid, statement strue, statement sfalse)
to be generated: IF (MYLID.NE.LID[.AND.NOT.HPFC_TWIN_P(an, LID)]) THEN true ELSE false ENDIF
static Pcontrainte partial_linearization(entity array, bool distributed, entity var, int *psize, entity(*create_var)(int))
HPFC module by Fabien COELHO.
static statement generate_remapping_guard(entity src, entity trg, statement the_code)
Runtime descriptors management around the remapping code.
statement generate_all_liveness(entity primary, bool val)
static statement update_runtime_for_remapping(entity trg)
static statement generate_dynamic_liveness_management(statement s)
static expression live_mapping_expression(int index)
returns LIVEMAPPING(index)
static Psysteme generate_remapping_system(entity src, entity trg)
returns the full remapping system, including the source and target mappings systems,...
#define CPY
in the following functions tag t controls the code generation, depending of what is to be generated (...
static statement generate_all_liveness_but(entity primary, bool val, entity butthisone)
static text protected_text_statement(statement s)
static statement broadcast(entity src, entity lid, entity proc, Psysteme sr, list ldiff, bool lazy)
builds the diffusion loop.
static Psysteme generate_work_sharing_system(entity src, entity trg)
load-balancing equation as suggested in the A-274 report.
static string remapping_file_name(renaming remap)
file name for storing the remapping code.
static statement remapping_stats(int t, Psysteme s, Psysteme sr, list ll, list ldiff, list ld, entity lid, entity src, entity trg)
generates a remapping loop nest (copy/send/receive/broadcast) basically a loop on elements with pre/i...
static statement set_live_status(entity trg, _UNUSED_ bool val)
static statement generate_dynamic_liveness_for_primary(entity primary, list tokeep)
static statement generate_remapping_include(renaming r)
just a hack because pips does not have 'include'
static void loop_rwt(loop l)
static void generate_hpf_remapping_file(renaming r)
static list list_of_referenced_entities(statement s)
static expression mylid_ne_lid(entity lid)
static statement gen(int what, entity src, entity trg, entity lid, entity proc, entity(*create_src)(), entity(*create_trg)(), Psysteme sr, list ldiff)
arguments: all that may be useful to generate some code
statement root_statement_remapping_inits(statement root)
returns the initialization statement: must initialize the status and liveness of arrays
static void remapping_variables(Psysteme s, entity a1, entity a2, list *pl, list *plp, list *pll, list *plrm, list *pld, list *plo)
??? assumes that there are no parameters.
static statement generate_remapping_code(entity src, entity trg, Psysteme procs, Psysteme locals, list l, list lp, list ll, list ldiff, list ld, bool dist_p)
generates a full remapping code, given the systems and indexes to be used in the different loops.
static list l_found
quick recursion to find the entities referenced in a statement.
static statement processor_loop(Psysteme s, _UNUSED_ list l_psi, list l_oth, entity psi, entity oth, entity lid, entity array, entity(*create_psi)(), entity(*create_oth)(), statement body, bool sh)
to be generated: ??? the Proc cycle should be deduce directly in some case...
void remapping_compile(statement s, statement *hsp, statement *nsp)
void remapping_compile(s, hsp, nsp) statement s, *hsp, *nsp;
static void reference_rwt(reference r)
static statement hpf_remapping(entity src, entity trg)
remaps src to trg.
static statement elements_loop(Psysteme s, list ll, list ld, statement body)
to be generated:
Pcontrainte full_linearization(entity obj, entity var, int *psize, entity(*create_var)(int), bool fortran_way, int initial_offset)
builds a linarization equation of the dimensions of obj.
static statement set_array_status_to_target(entity trg)
#define ret(name)
I have to deal with a 4D space to generate some code:
#define test_to_statement(t)
#define and_expression(e1, e2)
#define ne_expression(e1, e2)
#define eq_expression(e1, e2)
#define not_expression(e)
#define make_empty_statement
An alias for make_empty_block_statement.
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...
const char * entity_module_name(entity e)
See comments about module_name().
Pbase entity_list_to_base(list l)
expression reference_to_expression(reference r)
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression bool_to_expression(bool b)
expression call_to_expression(call c)
Build an expression that call a function or procedure.
int element_number(basic, list)
END_EOLE.
int NumberOfDimension(entity)
int variable_entity_dimension(entity)
variable_entity_dimension(entity v): returns the dimension of variable v; scalar have dimension 0.
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define reference_domain
newgen_range_domain_defined
#define variable_dimensions(x)
#define variable_basic(x)
#define statement_undefined
#define STATEMENT(x)
STATEMENT.
void sc_separate_on_vars(Psysteme s, Pbase b, Psysteme *pwith, Psysteme *pwithout)
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
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 ...
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Psysteme extract_nredund_subsystem(Psysteme s1, Psysteme s2)
Psysteme extract_nredund_subsystem(s1, s2) Psysteme s1, s2;.
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
void print_text(FILE *fd, text t)
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...