25 #include "pips_config.h"
119 string type_suffix =
"";
123 type_suffix =
"Double";
127 type_suffix =
"Float";
135 type_suffix =
"LongInt";
194 default:
pips_user_warning(
"No atomic operation for this reduction operator !\n");
209 bool found_p =
false;
225 pips_debug(1,
"Already handled statement !\n");
235 "statement ! Abort...\n");
243 pips_debug(1,
"Unsupported reduction by atomic operation profile : ");
252 pips_debug(1,
"Didn't manage to get complement expression :(\n");
286 list *replaced_statements,
290 pips_debug(1,
"Loop is parallel only with reduction, fetching reductions...\n");
295 pips_debug(1,
"Loop has a reduction ! Let's replace reductions inside\n");
303 pips_debug(1,
"No reduction replaced for this loop, make it sequential "
307 pips_debug(1,
"Unsupported reduction found ! Make it sequential "
342 set_statement_reductions(
380 (
char*) module_stat);
386 reset_statement_reductions();
398 debug_on(
"REPLACE_REDUCTION_WITH_ATOMIC_DEBUG_LEVEL");
412 debug_on(
"FLAG_PARALLEL_REDUCED_LOOPS_WITH_ATOMIC_DEBUG_LEVEL");
427 debug_on(
"FLAG_PARALLEL_REDUCED_LOOPS_WITH_ATOMIC_DEBUG_LEVEL");
bool statement_consistent_p(statement p)
language make_language_c(void)
reference copy_reference(reference p)
REFERENCE.
static reference ref
Current stmt (an integer)
static bool process_reduced_loops(const char *mod_name, process_reductions_mode mode)
static bool process_reductions_in_loop(statement loop_stat, atomic_profile *profile, list *replaced_statements, bool replace)
static atomic_profile load_atomic_profile()
struct atomic_operation atomic_operation
Define an atomic operation FIXME : should be moved under newgen management.
struct atomic_profile atomic_profile
Stucture that define the list of atomic_operations.
atomic_op
Profiles for supported atomic operations FIXME should be newgen tag.
static bool replace_reductions_in_statement(statement s, struct replace_ctx *ctx)
Replace a reduction in a statement by a pattern matching way.
static atomic_operation cuda[]
static atomic_operation reduction_to_atomic_operation(reduction r)
bool flag_parallel_reduced_loops_with_atomic(string mod_name)
Flag loop as parallel when replacement with atomic is possible without doing the replacement.
bool flag_parallel_reduced_loops_with_openmp_directives(const char *mod_name)
Flag loop as parallel with OpenMP directives taking reductions into account.
static bool process_reductions_in_openmp_loop(statement st)
static bool supported_atomic_operator_p(atomic_operation op, atomic_profile *profile)
bool replace_reduction_with_atomic(string mod_name)
Replace reduction with atomic operations.
static entity atomic_function_of_operation(atomic_operation op)
Get an atomic function that replace a reduction operator.
callees compute_callees(const statement stat)
Recompute the callees of a module statement.
struct _newgen_struct_statement_ * statement
#define ret(why, what)
true if not a remapping for old.
char * get_string_property(const char *)
#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.
statement get_current_module_statement(void)
Get the current module statement.
entity set_current_module_entity(entity)
static.c
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
instruction make_call_instruction(entity e, list l)
Build an instruction that call a function entity with an argument list.
bool loop_parallel_p(loop l)
Test if a loop is parallel.
#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)
#define CAR(pcons)
Get the value of the first element of a list.
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
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.
loop statement_loop(statement)
Get the loop of a statement.
bool statement_call_p(statement)
bool statement_loop_p(statement)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define same_string_p(s1, s2)
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
void print_statement(statement)
Print a statement on stderr.
struct _newgen_struct_reduced_loops_ * reduced_loops
#define reduced_loops_ordering(x)
bool omp_pragma_expr_for(loop l, statement stmt)
generate "pragma omp for" as a list of expressions
bool omp_pragma_expr_for_reduction(loop l, statement stmt, bool strict)
generate pragma for a reduction as a list of expressions
void print_reduction(reduction r)
void set_printed_reductions(pstatement_reductions)
void reset_printed_reductions(void)
expression get_complement_expression(statement, reference)
Return the "other part" of the reduction.
struct _newgen_struct_reductions_ * reductions
@ is_reduction_operator_bitwise_xor
@ is_reduction_operator_none
@ is_reduction_operator_min
@ is_reduction_operator_bitwise_and
@ is_reduction_operator_neqv
@ is_reduction_operator_max
@ is_reduction_operator_bitwise_or
@ is_reduction_operator_csum
@ is_reduction_operator_eqv
@ is_reduction_operator_prod
@ is_reduction_operator_or
@ is_reduction_operator_and
@ is_reduction_operator_sum
#define reduction_operator_tag(x)
#define REDUCTION_CAST(x)
#define reduction_reference(x)
#define reductions_list(x)
static const char * prefix
#define ADDRESS_OF_OPERATOR_NAME
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
entity make_empty_function(const char *name, type r, language l)
expression reference_to_expression(reference r)
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
type MakeLongIntegerResult(void)
MB.
type MakeIntegerResult(void)
type MakeRealResult(void)
type MakeDoubleprecisionResult(void)
#define loop_execution(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define expression_undefined_p(x)
#define statement_instruction(x)
@ is_execution_sequential
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
Define an atomic operation FIXME : should be moved under newgen management.
Stucture that define the list of atomic_operations.
atomic_operation * profile
The structure used to build lists in NewGen.
Keep track of what is done in replace recursion.
list * replaced_statements