27 #if defined(BUILDER_COARSE_GRAIN_PARALLELIZATION) || \
28 defined(BUILDER_COARSE_GRAIN_PARALLELIZATION_WITH_REDUCTION)
31 #include "pips_config.h"
69 #include "pips-libs.h"
77 #ifdef HAVE_PIPS_reductions_LIBRARY
85 #ifndef PIPS_WERROR_COMPILATION
86 #warning "compiling coarse_grain_parallelization without reductions"
94 typedef struct coarse_grain_ctx {
97 bool parallelized_at_least_one_loop;
98 bool use_reductions_p;
110 static bool whole_loop_parallelize(
loop l, coarse_grain_ctx *ctx)
129 pips_debug(1,
"non feasible inner statement -> SEQUENTIAL LOOP\n");
144 bool may_conflicts_p =
false;
156 if (ctx->use_reductions_p) {
157 #ifdef HAVE_PIPS_reductions_LIBRARY
159 pips_debug(1,
"Fetching reductions for this loop\n");
163 pips_debug(1,
"Ignoring dependences on %s for this loop\n",
174 fprintf(stderr,
"original invariant regions:\n");
187 && !(ctx->use_reductions_p &&
set_belong_p(lreductions,e))
235 fprintf(stderr,
"testing conflict from:\n");
253 NIL, &gs, &levelsop, &gsop);
258 fprintf(stderr,
"\tno dependence\n");
261 fprintf(stderr,
"\tdependence at levels: ");
268 fprintf(stderr,
"\tdependence cone:\n");
271 fprintf(stderr,
"\tcorresponding linear system:\n");
276 if (!
ENDP(levelsop)) {
277 fprintf(stderr,
"\topposite dependence at levels: ");
284 fprintf(stderr,
"\tdependence cone:\n");
287 fprintf(stderr,
"\tcorresponding linear system:\n");
294 if (!
ENDP(levels) || !
ENDP(levelsop)) {
295 may_conflicts_p =
true;
316 if(ctx->use_reductions_p) {
317 #ifdef HAVE_PIPS_reductions_LIBRARY
318 pips_debug(1,
"PARALLEL LOOP WITH REDUCTIONS\n");
329 ctx->parallelized_at_least_one_loop =
true;
345 if (ctx->use_reductions_p) {
363 static void coarse_grain_loop_parallelization(
365 coarse_grain_ctx *ctx)
384 coarse_grain_parallelization_main(
386 bool use_reductions_p)
392 if(use_reductions_p) {
393 #ifdef HAVE_PIPS_reductions_LIBRARY
438 debug_on(
"COARSE_GRAIN_PARALLELIZATION_DEBUG_LEVEL");
441 coarse_grain_ctx ctx = { 0,
NIL,
false, use_reductions_p };
442 coarse_grain_loop_parallelization(module_stat, &ctx);
455 if(use_reductions_p) {
456 #ifdef HAVE_PIPS_reductions_LIBRARY
457 reset_statement_reductions();
472 if(ctx.parallelized_at_least_one_loop || locals_changed) {
488 return coarse_grain_parallelization_main(
module_name,
false);
491 #ifdef HAVE_PIPS_reductions_LIBRARY
505 return coarse_grain_parallelization_main(
module_name,
true);
void free_conflict(conflict p)
conflict make_conflict(effect a1, effect a2, cone a3)
reduced_loops make_reduced_loops(list a)
dg_vertex_label vertex_label
Psysteme sg_to_sc_chernikova(Ptsg sg)
struct _newgen_struct_statement_ * statement
#define CONFLICT(x)
CONFLICT.
#define conflict_source(x)
#define conflict_undefined
#define region_write_p(reg)
#define region_entity(reg)
#define region_system(reg)
#define region_read_p(reg)
useful region macros
list load_invariant_rw_effects_list(statement)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
void reset_invariant_rw_effects(void)
void set_invariant_rw_effects(statement_effects)
void reset_cumulated_rw_effects(void)
bool update_loops_locals(const char *, statement)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
entity effect_entity(effect)
cproto-generated files
bool store_effect_p(effect)
const char * module_name(const char *s)
Return the module part of an entity name.
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_chunk_undefined_p(c)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
entity set_current_module_entity(entity)
static.c
gen_chunk * gen_get_ancestor(int, const void *)
return the first ancestor object found of the given type.
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
bool loop_sequential_p(loop l)
Test if a loop is sequential.
bool loop_parallel_p(loop l)
Test if a loop is parallel.
void print_parallelization_statistics(const char *module, const char *msg, statement s)
Print out the number of sequential versus parallel loops.
#define ENDP(l)
Test if a list is empty.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#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
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
void * gen_find_eq(const void *item, const list seq)
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
bool statement_may_contain_exiting_intrinsic_call_p(statement)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_internal_error
bool set_belong_p(const set, const void *)
set set_make(set_type)
Create an empty set of any type but hash_private.
set set_add_element(set, const set, const void *)
struct _newgen_struct_reduced_loops_ * reduced_loops
struct _newgen_struct_reductions_ * reductions
#define REDUCTION(x)
REDUCTION.
#define reduction_reference(x)
#define reductions_list(x)
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...
bool same_entity_p(entity e1, entity e2)
predicates on entities
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
bool thread_safe_variable_p(entity v)
#define loop_execution(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define statement_ordering(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define reference_indices(x)
@ is_execution_sequential
#define STATEMENT(x)
STATEMENT.
list TestCoupleOfReferences(list n1, Psysteme sc1 __attribute__((unused)), statement s1, effect ef1, reference r1, list n2, Psysteme sc2 __attribute__((unused)), statement s2, effect ef2, reference r2, list llv, Ptsg *gs __attribute__((unused)), list *levelsop __attribute__((unused)), Ptsg *gsop __attribute__((unused)))
void ResetLoopCounter(void)
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
transformer load_statement_precondition(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
#define SG_UNDEFINED_P(sg)
void sg_rm(Ptsg sg)
void sg_rm(Ptsg sg): liberation de l'espace memoire occupe par un systeme generateur
void sg_fprint_as_dense(FILE *f, Ptsg sg, Pbase b)
void sg_fprint_as_dense(FILE * f, Ptsg sg): impression d'un systeme generateur
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
static int depth
la sequence de nids
char *(* get_variable_name_t)(Variable)