PIPS
|
#include <stdint.h>
#include <stdlib.h>
#include "genC.h"
#include "misc.h"
#include "freia.h"
#include "linear.h"
#include "pipsdbm.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "properties.h"
#include "freia_spoc_private.h"
#include "hwac.h"
Go to the source code of this file.
Data Structures | |
struct | swis_ctx |
Macros | |
#define | IMG_DEP "" |
#define | SCL_DEP "arrowhead=empty" |
#define | DOT_SUFFIX ".dot" |
#define | aipo_op_p(a, name) same_string_p(AIPO name, a->function_name) |
#define | starts_with(s1, s2) (strncmp(s1, s2, strlen(s2))==0) /**a la java */ |
Functions | |
string | dagvtx_to_string (const dagvtx v) |
dag-utils.c More... | |
statement | dagvtx_statement (const dagvtx v) |
return statement if any, or NULL (for input nodes). More... | |
void | dag_statements (set stats, const dag d) |
build the set of actual statements in d More... | |
bool | dagvtx_other_stuff_p (const dagvtx v) |
a vertex with a non AIPO or image related statement. More... | |
entity | dagvtx_image (const dagvtx v) |
return the produced image or NULL More... | |
static void | entity_list_dump (FILE *out, const string what, const list l) |
_int | dagvtx_number (const dagvtx v) |
returns the vertex number, i.e. More... | |
string | dagvtx_number_str (const dagvtx v) |
_int | dagvtx_optype (const dagvtx v) |
_int | dagvtx_opid (const dagvtx v) |
string | dagvtx_function_name (const dagvtx v) |
string | dagvtx_operation (const dagvtx v) |
string | dagvtx_compact_operation (const dagvtx v) |
int | dagvtx_ordering (const dagvtx *v1, const dagvtx *v2) |
dagvtx | dagvtx_get_producer (const dag d, const dagvtx sink, const entity e, _int before_number) |
return (last) producer of image e for vertex sink, or NULL if none found. More... | |
void | dagvtx_nb_dump (FILE *out, const string what, const list l) |
void | dagvtx_dump (FILE *out, const string name, const dagvtx v) |
for dag debug. More... | |
void | dag_dump (FILE *out, const string what, const dag d) |
for dag debug More... | |
static const char * | entity_dot_name (entity e) |
static void | dagvtx_dot_node (FILE *out, const string prefix, const dagvtx v) |
static void | dagvtx_dot_node_sb (string_buffer sb, const string prefix, const dagvtx v) |
static void | dagvtx_dot (FILE *out, const dag d, const dagvtx vtx) |
static void | dagvtx_copy_list_dot (FILE *out, const list ls, const set inputs) |
static void | dagvtx_list_dot (FILE *out, const string comment, const list l, const set used) |
static bool | dagvtx_is_operator_p (const dagvtx v, const string opname) |
static bool | dagvtx_is_copy_p (const dagvtx v) |
returns whether the vertex is an image copy operation. More... | |
void | dag_dot (FILE *out, const string what, const dag d, const list lb, const list la) |
output dag in dot format, for debug or show More... | |
void | dag_dot_dump (const string module, const string name, const dag d, const list lb, const list la) |
generate a "dot" format from a dag to a file. More... | |
void | dag_dot_dump_prefix (const string module, const string prefix, int number, const dag d, const list lb, const list la) |
static void | check_removed (const dagvtx v, const dagvtx removed) |
static int | dagvtx_cmp_entity (const dagvtx *v1, const dagvtx *v2) |
static void | vertex_list_sorted_by_entities (list l) |
void | dag_consistency_asserts (dag d) |
do some consistency checking... More... | |
static void | dag_remove_unused_inputs (dag d) |
remove unused inputs More... | |
void | dag_remove_vertex (dag d, const dagvtx v) |
remove vertex v from dag d. More... | |
dagvtx | copy_dagvtx_norec (dagvtx v) |
copy a vertex, but without its successors. More... | |
bool | dagvtx_is_measurement_p (const dagvtx v) |
returns whether the vertex is an image measurement operation. More... | |
void | dag_append_vertex (dag d, dagvtx nv) |
append new vertex nv to dag d. More... | |
int | dag_computation_count (const dag d) |
return the number of actual operations in dag d. More... | |
list | dag_vertex_preds (const dag d, const dagvtx target) |
return target predecessor vertices as a list. More... | |
static bool | gen_list_equals_p (const list l1, const list l2) |
static bool | switch_vertex_to_assign (dagvtx target, dagvtx source) |
replace target measure to a copy of source result... More... | |
static void | substitute_image_in_statement (dagvtx v, entity source, entity target, bool used) |
subtitute produced or used image in the statement of vertex v. More... | |
static void | switch_vertex_to_a_copy (dagvtx target, dagvtx source, list tpreds) |
replace target vertex by a copy of source results... More... | |
static bool | same_operation_p (const dagvtx v1, const dagvtx v2) |
static bool | commutative_operation_p (const dagvtx v1, const dagvtx v2) |
static bool | list_commuted_p (const list l1, const list l2) |
static void | unlink_copy_vertex (dag d, const entity source, dagvtx copy) |
"copy" copies "source" image in dag "d". More... | |
static bool | all_vertices_are_copies_or_measures_p (const list lv) |
static int | number_of_copies (list l) |
static expression | compute_constant (string op, expression val1, expression val2) |
compute a constant expression for FREIA ??? TODO partial eval if values are constant More... | |
static void | set_aipo_call (dagvtx v, string name, entity img, expression val) |
switch vertex statement to an aipo call More... | |
static void | set_aipo_copy (dagvtx v, entity e) |
switch vertex to a copy of an image More... | |
static bool | propagate_constant_image (dagvtx v, entity image, expression val) |
recursively propagate a constant image on a vertex More... | |
static void | set_aipo_constant (dagvtx v, expression val) |
set vertex as a constant image and propagate to successors More... | |
static expression | constant_image_p (dagvtx v) |
whether vertex generates a constant image More... | |
static entity | copy_image_p (dagvtx v) |
tell whether vertex can be assimilated to a copy e.g. More... | |
static void | propagate_constant_image_to_succs (dagvtx v, expression val) |
propagate constant image to vertex successors More... | |
static bool | dag_simplify (dag d) |
apply basic algebraic simplification to dag More... | |
static bool | dag_normalize (dag d) |
normalize, that is use less image operators only transformation is: sub_const(i, v) -> add_const(i, -v) More... | |
static int | compatible_reduction_operation (const dagvtx v1, const dagvtx v2) |
void | freia_dag_optimize (dag d, hash_table exchanges, list *lbefore, list *lafter) |
remove dead image operations. More... | |
static bool | all_mesures_p (list lv) |
return whether all vertices in list are mesures... More... | |
static set | dag_stats (dag d) |
static bool | any_use_statement (set stats) |
hmmm... More... | |
static bool | other_significant_uses (entity e, const hash_table occs, const set stats) |
static bool | variable_used_as_later_input (entity img, list ld) |
hmmm... More... | |
static bool | dag_image_is_an_input (dag d, entity img) |
void | dag_compute_outputs (dag d, const hash_table occs, const set output_images, const list ld, bool inloop) |
(re)compute the list of GLOBAL input & output images for this dag ??? BUG the output is rather an approximation should rely on used defs or out effects for the underlying sequence. More... | |
static dagvtx | find_twin_vertex (dag d, dagvtx target) |
void | freia_hack_fix_global_ins_outs (dag dfull, dag d) |
catch some cases of missing outs between splits... More... | |
void | dag_cleanup_other_statements (dag d) |
remove unneeded statements? you must know they are really un-needed! More... | |
bool | single_image_assignement_p (dag d) |
??? I'm unsure about what happens to dead code in the pipeline... More... | |
static bool | any_scalar_dep (dagvtx v, set vs) |
returns whether there is a scalar RW dependency from any vs to v More... | |
static bool | all_previous_stats_with_deps_are_computed (dag d, const set computed, dagvtx v) |
check scalar dependency from computed to v. More... | |
list | dag_computable_vertices (dag d, const set computed, const set maybe, const set currents) |
return the vertices which may be computed from the list of available images, excluding vertices in exclude. More... | |
void | set_append_vertex_statements (set s, list lv) |
static list | fs_expression_list_to_entity_list (list args, int nargs) |
convert the first n items in list args to entities. More... | |
static entity | extract_fist_item (list *lp) |
extract first entity item from list. More... | |
static void | dag_append_freia_call (dag d, statement s) |
append statement s to dag d More... | |
dag | freia_build_dag (string module, list ls, int number, const hash_table occurrences, const set output_images, const list ld, bool inloop) |
build a full dag from list of statements ls. More... | |
bool | dag_no_image_operation (dag d) |
tell whether we have something to do with images ??? hmmm... More... | |
entity | clone_variable_with_new_name (entity, const char *, const char *) |
This function build and return new variable from a variable a_variable, with name new_name. More... | |
string | compilation_unit_of_module (const char *) |
The output is undefined if the module is referenced but not defined in the workspace, for instance because its code should be synthesized. More... | |
static entity | freia_data2d_field (string field) |
static expression | do_point_to (entity var, string field_name) |
static bool | image_ref_flt (reference r, entity *image) |
static entity | get_upper_model (entity model, const hash_table occs) |
statement | freia_memory_management_statement (entity image, const hash_table occs, bool alloc) |
static entity | new_local_image_variable (entity model, const hash_table occs) |
static void | swis_ref_rwt (reference r, swis_ctx *ctx) |
static bool | swis_call_flt (call c, swis_ctx *ctx) |
void | freia_switch_image_in_statement (statement s, entity old, entity img, bool write) |
switch read or written image in statement if this is an AIPO call, only substitute output or input depending on write otherwise all occurrences are substituted More... | |
static void | switch_image_variable (dagvtx v, entity old, entity img) |
switch to new image variable in v & its direct successors More... | |
list | dag_fix_image_reuse (dag d, hash_table init, const hash_table occs) |
fix intermediate image reuse in dag More... | |
list | dag_split_on_scalars (const dag initial, bool(*alone_only)(const dagvtx), dagvtx(*choose_vertex)(const list, bool), gen_cmp_func_t priority, void(*priority_update)(const dag), const set output_images) |
split a dag on scalar dependencies only, with a greedy heuristics. More... | |
static string | dagvtx_nb (const void *s) |
list | dag_connected_component (dag d, list *plv, bool(*compat)(const dagvtx, const set, const dag)) |
extract a sublist of lv which is a connected component. More... | |
static list | copy_vertices (list lv) |
list | dag_split_connected_components (dag d, set output_images) |
build connected components More... | |
#define aipo_op_p | ( | a, | |
name | |||
) | same_string_p(AIPO name, a->function_name) |
Definition at line 951 of file dag-utils.c.
#define DOT_SUFFIX ".dot" |
Definition at line 484 of file dag-utils.c.
#define IMG_DEP "" |
Definition at line 230 of file dag-utils.c.
#define SCL_DEP "arrowhead=empty" |
Definition at line 231 of file dag-utils.c.
Definition at line 1983 of file dag-utils.c.
return whether all vertices in list are mesures...
Definition at line 1957 of file dag-utils.c.
References dagvtx_optype(), FOREACH, and spoc_type_mes.
Referenced by dag_compute_outputs().
|
static |
check scalar dependency from computed to v.
Definition at line 2274 of file dag-utils.c.
References bool_to_string(), dag_vertices, dagvtx_number(), dagvtx_statement(), FOREACH, freia_scalar_rw_dep(), gen_copy_seq(), gen_free_list(), gen_nreverse(), pips_debug, and set_belong_p().
Referenced by dag_computable_vertices().
Definition at line 931 of file dag-utils.c.
References dagvtx_is_copy_p(), dagvtx_is_measurement_p(), and FOREACH.
Referenced by freia_dag_optimize().
returns whether there is a scalar RW dependency from any vs to v
Definition at line 2239 of file dag-utils.c.
References _intFMT, bool_to_string(), dagvtx_number(), dagvtx_number_str(), dagvtx_statement(), free(), freia_scalar_rw_dep(), ifdebug, pips_debug, SET_FOREACH, set_to_string(), and statement_number.
Referenced by dag_computable_vertices().
hmmm...
this is poor, should rather rely on use-def chains.
Definition at line 1987 of file dag-utils.c.
References call_function, entity_local_name(), FREIA_ALLOC, FREIA_FREE, freia_statement_to_call(), pips_debug, same_string_p, and SET_FOREACH.
Referenced by other_significant_uses().
Definition at line 513 of file dag-utils.c.
References pips_assert.
Referenced by dag_remove_vertex(), and freia_dag_optimize().
entity clone_variable_with_new_name | ( | entity | a_variable, |
const char * | new_name, | ||
const char * | module_name | ||
) |
This function build and return new variable from a variable a_variable, with name new_name.
If an entity called new_name already exists, return NULL. New variable is added to declarations
Assert that module represent a value code
This entity does not exist, we can safely create it
new_variable = copy_entity (a_variable); entity_name(new_variable) = strdup(concatenate(module_name, MODULE_SEP_STRING, new_name, NULL));
ew_variable = find_or_create_scalar_entity (strdup(concatenate(module_name, MODULE_SEP_STRING, new_name, NULL)),module_name, is_basic_int);
This entity already exist, we return null
Definition at line 269 of file phrase_tools.c.
References a_variable, AddEntityToDeclarations(), concatenate(), copy_storage(), copy_type(), copy_value(), entity_domain, entity_initial, entity_storage, entity_type, entity_undefined, gen_find_tabulated(), make_entity, module, module_name(), module_name_to_entity(), MODULE_SEP_STRING, new_variable, pips_assert, strdup(), and value_code_p.
Referenced by new_local_image_variable().
Definition at line 875 of file dag-utils.c.
References freia_api_t::commutator, dagvtx_opid(), dagvtx_optype(), get_freia_api(), hwac_freia_api_index(), and int.
Referenced by freia_dag_optimize().
Definition at line 1395 of file dag-utils.c.
References dagvtx_compact_operation(), and same_string_p.
Referenced by freia_dag_optimize().
string compilation_unit_of_module | ( | const char * | module_name | ) |
The output is undefined if the module is referenced but not defined in the workspace, for instance because its code should be synthesized.
Fabien Coelho suggests to build a default compilation unit where all synthesized module codes would be located.
Definition at line 350 of file module.c.
References asprintf, c_module_p(), compilation_unit_name, db_get_memory_resource(), db_resource_p(), entity_undefined_p, FILE_SEP_STRING, free(), module_name(), module_name_to_entity(), pips_assert, pips_basename(), and string_undefined.
Referenced by actual_c_parser(), add_new_module_from_text(), build_real_resources(), cast_STEP_ARG(), create_module_with_statement(), entity_from_user_name(), entity_more_or_less_minimal_name(), freia_data2d_field(), generic_initializer(), inline_expression_call(), linearize_array_generic(), normalize_microcode(), outliner_file(), outliner_scan(), sort_parameters(), step_compile_generated_module(), step_parameter(), string_to_entity(), and update_referenced_entities().
|
static |
compute a constant expression for FREIA ??? TODO partial eval if values are constant
Definition at line 957 of file dag-utils.c.
References call_to_expression(), CONS, copy_expression(), entity_undefined, local_name_to_top_level_entity(), make_call(), NIL, and pips_assert.
Referenced by propagate_constant_image().
|
static |
whether vertex generates a constant image
v | vertex to consider |
Definition at line 1159 of file dag-utils.c.
References aipo_op_p, freia_api_t::arg_img_in, freia_api_t::arg_misc_in, CAR, CDR, copy_expression(), dagvtx_content, ENTITY, erosion, expression_integer_value(), freia_extract_kernel_vtx(), freia_get_nth_scalar_param(), freia_max_pixel_value(), gen_length(), get_freia_api(), int_to_expression(), pips_assert, vtxcontent_inputs, and vtxcontent_opid.
Referenced by dag_simplify().
copy a vertex, but without its successors.
Definition at line 611 of file dag-utils.c.
References copy_dagvtx(), dagvtx_succs, and NIL.
Referenced by compile_this_list(), dag_split_connected_components(), dag_split_on_scalars(), and opencl_generate_special_kernel_ops().
tell whether vertex can be assimilated to a copy e.g.
i+.0 i*.1 i/.1 i|.0 i-.0 i&i i|i i>i i<i
Definition at line 1235 of file dag-utils.c.
References aipo_op_p, freia_api_t::arg_img_in, freia_api_t::arg_misc_in, CAR, CDR, dagvtx_content, ENTITY, expression_integer_value(), freia_extract_kernel_vtx(), freia_get_nth_scalar_param(), freia_max_pixel_value(), gen_length(), get_freia_api(), pips_assert, vtxcontent_inputs, and vtxcontent_opid.
Referenced by dag_simplify(), and propagate_constant_image().
Definition at line 3024 of file dag-utils.c.
References CONS, dagvtx_number(), FOREACH, gen_nreverse(), and NIL.
Referenced by dag_split_connected_components().
append statement s to dag d
of entity
Definition at line 2427 of file dag-utils.c.
References _intFMT, freia_api_t::arg_img_in, freia_api_t::arg_img_out, call_arguments, call_function, CONS, dag_append_vertex(), dag_vertices, entity_freia_api_p(), entity_local_name(), entity_undefined, extract_fist_item(), freia_spoc_set_operation(), freia_statement_to_call(), fs_expression_list_to_entity_list(), gen_length(), gen_list_head(), hwac_freia_api(), make_dagvtx(), make_pstatement_statement(), make_vtxcontent(), NIL, out, pips_assert, pips_debug, spoc_type_oth, statement_number, vtxcontent_opid, and vtxcontent_optype.
Referenced by freia_build_dag().
append new vertex nv to dag d.
nv | v |
Definition at line 632 of file dag-utils.c.
References CONS, dag_inputs, dag_vertices, dagvtx_content, dagvtx_get_producer(), dagvtx_number(), dagvtx_succs, entity_undefined, FOREACH, gen_in_list_p(), make_dagvtx(), make_pstatement_empty(), make_vtxcontent(), NIL, pips_assert, vertex_list_sorted_by_entities(), and vtxcontent_inputs.
Referenced by compile_this_list(), dag_append_freia_call(), dag_split_connected_components(), dag_split_on_scalars(), and opencl_generate_special_kernel_ops().
void dag_cleanup_other_statements | ( | dag | d | ) |
remove unneeded statements? you must know they are really un-needed!
Definition at line 2191 of file dag-utils.c.
References dag_remove_vertex(), dag_vertices, dagvtx_other_stuff_p(), FOREACH, set_add_element(), SET_FOREACH, set_make(), and set_pointer.
Referenced by compile_this_list(), dag_split_connected_components(), dag_split_on_scalars(), and mppa_dag_split().
return the vertices which may be computed from the list of available images, excluding vertices in exclude.
return a list for determinism.
d | is the considered full dag |
computed | holds all previously computed vertices |
currents | holds those in the current pipeline @params maybe holds vertices with live images of dagvtx |
computed | omputed |
maybe | aybe |
currents | urrents |
Definition at line 2306 of file dag-utils.c.
References _intFMT, all_previous_stats_with_deps_are_computed(), any_scalar_dep(), CONS, dag_vertex_preds(), dag_vertices, dagvtx_number(), dagvtx_other_stuff_p(), FOREACH, gen_copy_seq(), gen_free_list(), gen_length(), gen_nreverse(), list_in_set_p(), NIL, pips_debug, set_add_element(), set_assign(), set_belong_p(), set_clear(), set_del_element(), SET_FOREACH, set_free(), set_make(), and set_pointer.
Referenced by dag_split_on_scalars(), dag_terapix_measures(), and opencl_merge_and_compile().
return the number of actual operations in dag d.
may be zero if only input vertices remain in the dag after optimizations.
Definition at line 665 of file dag-utils.c.
References count, dag_vertices, dagvtx_number(), and FOREACH.
Referenced by dag_split_on_scalars().
void dag_compute_outputs | ( | dag | d, |
const hash_table | occs, | ||
const set | output_images, | ||
const list | ld, | ||
bool | inloop | ||
) |
(re)compute the list of GLOBAL input & output images for this dag ??? BUG the output is rather an approximation should rely on used defs or out effects for the underlying sequence.
however, the status of chains and effects on C does not allow it at the time. again after a look at DG (FC 08/08/2011)
d | dag to consider |
occs | statement image occurences, may be NULL |
output_images | images that are output, may be NULL |
ld | list of some other dags, possibly NIL |
occs | ccs |
output_images | utput_images |
ld | d |
inloop | nloop |
Definition at line 2073 of file dag-utils.c.
References _intFMT, all_mesures_p(), bool_to_string(), dag_dump(), dag_image_is_an_input(), dag_outputs, dag_remove_vertex(), dag_stats(), dag_vertices, dagvtx_content, dagvtx_number(), dagvtx_number_str(), dagvtx_ordering(), dagvtx_succs, entity_undefined, FOREACH, formal_parameter_p(), gen_free_list(), ifdebug, other_significant_uses(), out, pips_debug, safe_entity_name(), set_add_element(), set_belong_p(), SET_FOREACH, set_fprint(), set_free(), set_make(), set_pointer, set_to_sorted_list(), variable_used_as_later_input(), and vtxcontent_out.
Referenced by compile_this_list(), dag_split_connected_components(), dag_split_on_scalars(), freia_build_dag(), and freia_spoc_pipeline().
list dag_connected_component | ( | dag | d, |
list * | plv, | ||
bool(*)(const dagvtx, const set, const dag) | compat | ||
) |
extract a sublist of lv which is a connected component.
update lv so that the extracted vertices are not there. the extracted list must keep the order of the initial list!
plv | lv |
Definition at line 2939 of file dag-utils.c.
References CAR, CONS, dag_inputs, DAGVTX, dagvtx_nb(), dagvtx_succs, FOREACH, gen_fprint(), gen_free_list(), gen_nreverse(), ifdebug, NIL, pips_debug, set_add_element(), set_append_list(), set_belong_p(), set_free(), set_make(), and set_pointer.
Referenced by dag_split_connected_components(), and opencl_merge_and_compile().
void dag_consistency_asserts | ( | dag | d | ) |
do some consistency checking...
Definition at line 531 of file dag-utils.c.
References dag_inputs, dagvtx_image(), entity_undefined, FOREACH, gen_occurences(), pips_assert, set_add_element(), set_belong_p(), set_free(), set_make(), and set_pointer.
Referenced by freia_trpx_compile_one_dag().
output dag in dot format, for debug or show
out,append | to this file |
what,name | of dag |
d,dag | to output |
out | ut |
what | hat |
lb | b |
la | a |
Definition at line 409 of file dag-utils.c.
References dag_inputs, dag_outputs, dag_vertices, dagvtx_content, dagvtx_copy_list_dot(), dagvtx_dot(), dagvtx_dot_node(), dagvtx_image(), dagvtx_is_copy_p(), dagvtx_list_dot(), dagvtx_other_stuff_p(), entity_dot_name(), entity_undefined, FOREACH, fprintf(), gen_in_list_p(), gen_length(), out, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, and vtxcontent_out.
Referenced by dag_dot_dump().
void dag_dot_dump | ( | const string | module, |
const string | name, | ||
const dag | d, | ||
const list | lb, | ||
const list | la | ||
) |
generate a "dot" format from a dag to a file.
module | odule |
name | ame |
lb | b |
la | a |
Definition at line 488 of file dag-utils.c.
References cat, dag_dot(), db_get_directory_name_for_module(), DOT_SUFFIX, fprintf(), free(), module, out, safe_fclose(), safe_fopen(), and strdup().
Referenced by dag_dot_dump_prefix(), freia_trpx_compile_one_dag(), opencl_compile_mergeable_dag(), and opencl_merge_and_compile().
void dag_dot_dump_prefix | ( | const string | module, |
const string | prefix, | ||
int | number, | ||
const dag | d, | ||
const list | lb, | ||
const list | la | ||
) |
module | odule |
prefix | refix |
number | umber |
lb | b |
la | a |
Definition at line 504 of file dag-utils.c.
References cat, dag_dot_dump(), free(), i2a(), module, prefix, and strdup().
Referenced by freia_aipo_compile_calls(), freia_build_dag(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
for dag debug
out | ut |
what | hat |
Definition at line 212 of file dag-utils.c.
References _intFMT, dag_inputs, dag_outputs, dag_vertices, dagvtx_dump(), dagvtx_nb_dump(), FOREACH, fprintf(), gen_length(), and out.
Referenced by dag_compute_outputs(), dag_split_on_scalars(), freia_build_dag(), freia_dag_optimize(), freia_trpx_compile_one_dag(), mppa_compile_dag(), opencl_compile_mergeable_dag(), and sc_delimiter().
list dag_fix_image_reuse | ( | dag | d, |
hash_table | init, | ||
const hash_table | occs | ||
) |
fix intermediate image reuse in dag
init | nit |
occs | ccs |
Definition at line 2779 of file dag-utils.c.
References CONS, dag_inputs, dag_vertices, dagvtx_image(), entity_undefined, FOREACH, gen_in_list_p(), hash_put(), init, new_local_image_variable(), NIL, seen, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, and switch_image_variable().
Referenced by freia_aipo_compile_calls(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
Definition at line 2045 of file dag-utils.c.
References bool_to_string(), dag_inputs, dagvtx_image(), entity_name, FOREACH, and pips_debug.
Referenced by dag_compute_outputs().
tell whether we have something to do with images ??? hmmm...
what about vol(cst_img()) ?
Definition at line 2500 of file dag-utils.c.
References dag_inputs, and dag_outputs.
Referenced by freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
normalize, that is use less image operators only transformation is: sub_const(i, v) -> add_const(i, -v)
Definition at line 1351 of file dag-utils.c.
References AIPO, call_arguments, call_function, CAR, CDR, dag_vertices, dagvtx_content, dagvtx_statement(), entity_local_name(), EXPRESSION, EXPRESSION_, expression_integer_value(), FOREACH, free_expression(), freia_statement_to_call(), hwac_freia_api_index(), int_to_expression(), local_name_to_top_level_entity(), MakeUnaryCall(), same_string_p, UNARY_MINUS_OPERATOR_NAME, and vtxcontent_opid.
Referenced by freia_dag_optimize().
|
static |
remove unused inputs
Definition at line 551 of file dag-utils.c.
References CONS, dag_inputs, dag_vertices, dagvtx_succs, FOREACH, gen_free_list(), gen_nreverse(), gen_remove(), and NIL.
Referenced by dag_remove_vertex().
remove vertex v from dag d.
if v isx a used computation vertex, it is substituted by an input vertex.
Definition at line 570 of file dag-utils.c.
References check_removed(), CONS, dag_inputs, dag_outputs, dag_remove_unused_inputs(), dag_vertices, dagvtx_content, dagvtx_domain, dagvtx_succs, entity_undefined, FOREACH, gen_context_recurse, gen_copy_seq(), gen_free_list(), gen_in_list_p(), gen_remove(), gen_true2(), ifdebug, input(), make_dagvtx(), make_pstatement_empty(), make_vtxcontent(), NIL, pips_assert, vertex_list_sorted_by_entities(), and vtxcontent_out.
Referenced by dag_cleanup_other_statements(), dag_compute_outputs(), dag_split_connected_components(), dag_split_on_scalars(), freia_dag_optimize(), freia_spoc_pipeline(), freia_terapix_call(), and opencl_merge_and_compile().
apply basic algebraic simplification to dag
Definition at line 1302 of file dag-utils.c.
References CAR, CDR, constant_image_p(), copy_image_p(), dag_vertex_preds(), dag_vertices, DAGVTX, dagvtx_image(), dagvtx_is_operator_p(), dagvtx_succs, FOREACH, free_expression(), gen_free_list(), gen_length(), gen_remove(), int_to_expression(), pips_assert, set_aipo_call(), set_aipo_constant(), and set_aipo_copy().
Referenced by freia_dag_optimize().
build connected components
output_images | utput_images |
Definition at line 3035 of file dag-utils.c.
References _intFMT, CONS, copy_dagvtx_norec(), copy_vertices(), dag_append_vertex(), dag_cleanup_other_statements(), dag_compute_outputs(), dag_connected_component(), dag_remove_vertex(), dag_vertices, dagvtx_nb(), FOREACH, freia_hack_fix_global_ins_outs(), gen_fprint(), gen_length(), gen_nreverse(), ifdebug, make_dag(), NIL, pips_assert, and pips_debug.
list dag_split_on_scalars | ( | const dag | initial, |
bool(*)(const dagvtx) | alone_only, | ||
dagvtx(*)(const list, bool) | choose_vertex, | ||
gen_cmp_func_t | priority, | ||
void(*)(const dag) | priority_update, | ||
const set | output_images | ||
) |
split a dag on scalar dependencies only, with a greedy heuristics.
initial | dag to split |
alone_only | whether to keep it alone (for non implemented cases) |
choose_vertex | chose a vertex from computable ones, may be NULL |
priority | how to prioritize computable vertices |
priority_update | stuff to help prioritization |
initial | nitial |
priority | riority |
output_images | utput_images |
Definition at line 2823 of file dag-utils.c.
References _intFMT, CAR, choice, CONS, copy_dag(), copy_dagvtx_norec(), current, dag_append_vertex(), dag_cleanup_other_statements(), dag_computable_vertices(), dag_computation_count(), dag_compute_outputs(), dag_dump(), dag_inputs, dag_remove_vertex(), DAGVTX, dagvtx_dump(), dagvtx_number(), FOREACH, free_dag(), freia_hack_fix_global_ins_outs(), gen_free_list(), gen_nconc(), gen_nreverse(), gen_sort_list(), ifdebug, make_dag(), NIL, pips_debug, pips_user_warning, set_add_element(), set_assign_list(), set_clear(), set_make(), set_pointer, set_size(), and single_image_assignement_p().
Referenced by freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
build the set of actual statements in d
stats | tats |
Definition at line 64 of file dag-utils.c.
References dag_vertices, dagvtx_statement(), FOREACH, set_add_element(), and set_clear().
Referenced by freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
Definition at line 1973 of file dag-utils.c.
References dag_vertices, dagvtx_statement(), FOREACH, set_add_element(), set_make(), and set_pointer.
Referenced by dag_compute_outputs().
return target predecessor vertices as a list.
the same predecessor appears twice in b = a+a build them in call order! ??? maybe I should build a cache for performance, but I would have to keep track of when dags are modified...
target | arget |
Definition at line 680 of file dag-utils.c.
References _intFMT, CAR, CDR, CONS, dag_vertices, dagvtx_content, dagvtx_image(), dagvtx_number(), dagvtx_succs, ENTITY, FOREACH, gen_in_list_p(), gen_length(), int, NIL, pips_debug, and vtxcontent_inputs.
Referenced by compute_dead_vertices(), dag_computable_vertices(), dag_simplify(), freia_dag_optimize(), image_is_needed(), mppa_compile_dag(), mppa_dag_split(), opencl_compile_mergeable_dag(), opencl_merge_and_compile(), sc_delimiter(), sc_get_port_id(), update_erosions(), and vertex_mergeable_p().
Definition at line 518 of file dag-utils.c.
References compare_entities(), dagvtx_content, and vtxcontent_out.
Referenced by vertex_list_sorted_by_entities().
Definition at line 140 of file dag-utils.c.
References freia_api_t::compact_name, dagvtx_content, get_freia_api(), and vtxcontent_opid.
Referenced by compatible_reduction_operation(), dagvtx_dot(), dagvtx_dot_node(), and dagvtx_dot_node_sb().
Definition at line 350 of file dag-utils.c.
References AIPO, call_arguments, call_function, CAR, CDR, entity_dot_name(), entity_local_name(), EXPRESSION, expression_to_entity(), FOREACH, fprintf(), freia_statement_to_call(), gen_length(), out, pips_assert, same_string_p, set_belong_p(), and src.
Referenced by dag_dot().
Definition at line 252 of file dag-utils.c.
References count, dag_vertices, dagvtx_compact_operation(), dagvtx_content, dagvtx_dot_node(), dagvtx_dot_node_sb(), dagvtx_number(), dagvtx_other_stuff_p(), dagvtx_statement(), dagvtx_succs, entity_dot_name(), entity_undefined, FOREACH, fprintf(), freia_scalar_rw_dep(), gen_free_list(), get_bool_property(), NIL, out, sb_cat, SCL_DEP, string_buffer_free(), string_buffer_make(), string_buffer_to_file(), vtxcontent_optype, vtxcontent_out, and what_operation_shape().
Referenced by dag_dot().
Definition at line 238 of file dag-utils.c.
References _intFMT, dagvtx_compact_operation(), dagvtx_number(), fprintf(), out, and prefix.
Referenced by dag_dot(), and dagvtx_dot().
|
static |
Definition at line 245 of file dag-utils.c.
References dagvtx_compact_operation(), dagvtx_number(), i2a(), prefix, and sb_cat.
Referenced by dagvtx_dot().
for dag debug.
out | ut |
name | ame |
Definition at line 186 of file dag-utils.c.
References _intFMT, dagvtx_content, dagvtx_nb_dump(), dagvtx_number(), dagvtx_operation(), dagvtx_statement(), dagvtx_succs, entity_list_dump(), fprintf(), out, safe_entity_name(), statement_number, statement_ordering, vtxcontent_inputs, vtxcontent_opid, vtxcontent_optype, vtxcontent_out, and what_operation().
Referenced by dag_dump(), dag_split_on_scalars(), dagvtx_terapix_priority(), and switch_vertex_to_a_copy().
Definition at line 126 of file dag-utils.c.
References dagvtx_content, freia_api_t::function_name, get_freia_api(), and vtxcontent_opid.
Referenced by dagvtx_operation(), and freia_aipo_count().
return (last) producer of image e for vertex sink, or NULL if none found.
this is one of the two predecessors of sink.
sink | ink |
before_number | efore_number |
Definition at line 156 of file dag-utils.c.
References _intFMT, dag_vertices, dagvtx_content, dagvtx_number(), dagvtx_succs, entity_undefined, FOREACH, gen_in_list_p(), pips_assert, pips_debug, and vtxcontent_out.
Referenced by dag_append_vertex(), dag_vertex_pred_imagelets(), freia_dag_optimize(), and unlink_copy_vertex().
return the produced image or NULL
Definition at line 82 of file dag-utils.c.
References dagvtx_content, entity_undefined, and vtxcontent_out.
Referenced by dag_consistency_asserts(), dag_dot(), dag_fix_image_reuse(), dag_image_is_an_input(), dag_simplify(), dag_vertex_preds(), init_op_schedule(), mppa_compile_dag(), mppa_helper_args_params(), sc_delimiter(), switch_vertex_to_a_copy(), and variable_used_as_later_input().
returns whether the vertex is an image copy operation.
Definition at line 399 of file dag-utils.c.
References dagvtx_is_operator_p().
Referenced by all_vertices_are_copies_or_measures_p(), dag_dot(), freia_dag_optimize(), and number_of_copies().
returns whether the vertex is an image measurement operation.
Definition at line 623 of file dag-utils.c.
References AIPO, dagvtx_content, freia_api_t::function_name, get_freia_api(), and vtxcontent_opid.
Referenced by all_vertices_are_copies_or_measures_p(), freia_dag_optimize(), mppa_compile_dag(), mppa_helper_args_params(), opencl_merge_and_compile(), sc_delimiter(), sigmac_params_decl(), and vertex_mergeable_p().
Definition at line 390 of file dag-utils.c.
References AIPO, cat, dagvtx_content, freia_api_t::function_name, get_freia_api(), opname(), same_string_p, and vtxcontent_opid.
Referenced by dag_simplify(), and dagvtx_is_copy_p().
|
static |
Definition at line 376 of file dag-utils.c.
References comment(), dagvtx_content, entity_dot_name(), FOREACH, fprintf(), out, set_belong_p(), and vtxcontent_out.
Referenced by dag_dot().
|
static |
Definition at line 2931 of file dag-utils.c.
References dagvtx_number(), and i2a().
Referenced by dag_connected_component(), and dag_split_connected_components().
out | ut |
what | hat |
Definition at line 176 of file dag-utils.c.
References _intFMT, dagvtx_number(), FOREACH, fprintf(), and out.
Referenced by dag_dump(), dagvtx_dump(), and sc_delimiter().
returns the vertex number, i.e.
the underlying statement number.
Definition at line 98 of file dag-utils.c.
References dagvtx_content, pstatement_statement, pstatement_statement_p, statement_number, and vtxcontent_source.
Referenced by all_previous_stats_with_deps_are_computed(), any_scalar_dep(), comment(), copy_vertices(), dag_append_vertex(), dag_computable_vertices(), dag_computation_count(), dag_compute_outputs(), dag_split_on_scalars(), dag_vertex_preds(), dagvtx_dot(), dagvtx_dot_node(), dagvtx_dot_node_sb(), dagvtx_dump(), dagvtx_get_producer(), dagvtx_nb(), dagvtx_nb_dump(), dagvtx_number_str(), dagvtx_opencl_priority(), dagvtx_ordering(), dagvtx_spoc_priority(), dagvtx_terapix_priority(), dagvtx_to_string(), find_twin_vertex(), freia_dag_optimize(), freia_hack_fix_global_ins_outs(), freia_spoc_pipeline(), generate_wiring(), image_is_needed(), is_consummed_by_vertex(), mppa_compile_dag(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), opencl_mergeable_p(), pixel_name(), print_op_schedule(), sc_delimiter(), substitute_image_in_statement(), switch_vertex_to_a_copy(), switch_vertex_to_assign(), unlink_copy_vertex(), and where_to_perform_operation().
Definition at line 111 of file dag-utils.c.
References dagvtx_number(), and i2a().
Referenced by any_scalar_dep(), dag_compute_outputs(), and opencl_merge_and_compile().
Definition at line 134 of file dag-utils.c.
References AIPO, and dagvtx_function_name().
Referenced by comment(), dagvtx_dump(), dagvtx_spoc_priority(), dagvtx_terapix_priority(), freia_convolution_p(), generate_wiring(), mppa_compile_dag(), print_op_schedule(), sc_delimiter(), and where_to_perform_operation().
Definition at line 121 of file dag-utils.c.
References dagvtx_content, and vtxcontent_opid.
Referenced by commutative_operation_p(), freia_spoc_pipeline(), freia_terapix_call(), mppa_call_helper(), opencl_compile_mergeable_dag(), same_constant_parameters(), same_operation_p(), sc_delimiter(), and sc_get_params_values().
Definition at line 116 of file dag-utils.c.
References dagvtx_content, and vtxcontent_optype.
Referenced by all_mesures_p(), commutative_operation_p(), dagvtx_spoc_priority(), dagvtx_terapix_priority(), freia_spoc_pipeline(), generate_wiring(), has_vtx_dynamic_params(), mppa_compile_dag(), mppa_helper_args_params(), reuse_pred_slot(), same_operation_p(), sc_delimiter(), sc_inst(), sc_kernel_compute_loop(), sc_kernel_specific_agent(), and sigmac_params_decl().
v1 | 1 |
v2 | 2 |
Definition at line 148 of file dag-utils.c.
References dagvtx_number().
Referenced by dag_compute_outputs(), and freia_mppa_compile_calls().
a vertex with a non AIPO or image related statement.
Definition at line 76 of file dag-utils.c.
References dagvtx_content, spoc_type_oth, and vtxcontent_optype.
Referenced by choose_opencl_vertex(), dag_cleanup_other_statements(), dag_computable_vertices(), dag_dot(), dagvtx_dot(), freia_opencl_compile_calls(), and freia_terapix_call().
return statement if any, or NULL (for input nodes).
Definition at line 56 of file dag-utils.c.
References dagvtx_content, pstatement_statement, pstatement_statement_p, and vtxcontent_source.
Referenced by all_previous_stats_with_deps_are_computed(), any_scalar_dep(), dag_normalize(), dag_statements(), dag_stats(), dagvtx_dot(), dagvtx_dump(), freia_compile(), migrate_statements(), mppa_call_helper(), opencl_generate_special_kernel_ops(), same_constant_parameters(), sc_delimiter(), switch_image_variable(), and switch_vertex_to_assign().
Definition at line 49 of file dag-utils.c.
References dagvtx_number(), and i2a().
|
static |
Definition at line 2533 of file dag-utils.c.
References call_to_expression(), entity_to_expression(), expression_domain, freia_data2d_field(), gen_make_list(), local_name_to_top_level_entity(), make_call(), and POINT_TO_OPERATOR_NAME.
Referenced by new_local_image_variable().
|
static |
Definition at line 233 of file dag-utils.c.
References entity_user_name().
Referenced by dag_dot(), dagvtx_copy_list_dot(), dagvtx_dot(), and dagvtx_list_dot().
Definition at line 88 of file dag-utils.c.
References FOREACH, fprintf(), out, and safe_entity_name().
Referenced by dagvtx_dump().
extract first entity item from list.
Definition at line 2417 of file dag-utils.c.
References CAR, ENTITY, gen_free_list(), and gen_list_head().
Referenced by dag_append_freia_call().
Definition at line 2148 of file dag-utils.c.
References _intFMT, dag_vertices, dagvtx_number(), FOREACH, and pips_internal_error.
Referenced by freia_hack_fix_global_ins_outs().
dag freia_build_dag | ( | string | module, |
list | ls, | ||
int | number, | ||
const hash_table | occurrences, | ||
const set | output_images, | ||
const list | ld, | ||
bool | inloop | ||
) |
build a full dag from list of statements ls.
module | |
list | of statements in sequence |
number | dag identifier in function |
occurrences | entity -> set of statements where they appear |
output_images | set of images that are output |
ld | list of other dags... (???) |
inloop | whether we might be in a loop |
module | odule |
ls | s |
number | umber |
occurrences | ccurrences |
output_images | utput_images |
ld | d |
inloop | nloop |
Definition at line 2476 of file dag-utils.c.
References dag_append_freia_call(), dag_compute_outputs(), dag_dot_dump_prefix(), dag_dump(), FOREACH, ifdebug, make_dag(), module, and NIL.
Referenced by freia_compile().
void freia_dag_optimize | ( | dag | d, |
hash_table | exchanges, | ||
list * | lbefore, | ||
list * | lafter | ||
) |
remove dead image operations.
remove AIPO copies detected as useless. remove identical operations. return list of statements to be managed outside (external copies)... ??? maybe there should be a transitive closure...
exchanges | xchanges |
lbefore | before |
lafter | after |
Definition at line 1416 of file dag-utils.c.
References _intFMT, all_vertices_are_copies_or_measures_p(), append, CAR, check_removed(), commutative_operation_p(), compatible_reduction_operation(), CONS, dag_dump(), dag_inputs, dag_normalize(), dag_outputs, dag_remove_vertex(), dag_simplify(), dag_vertex_preds(), dag_vertices, DAGVTX, dagvtx_content, dagvtx_domain, dagvtx_get_producer(), dagvtx_is_copy_p(), dagvtx_is_measurement_p(), dagvtx_number(), dagvtx_succs, ENTITY, entity_undefined, FOREACH, free_dagvtx(), freia_copy_image(), gen_context_recurse, gen_copy_seq(), gen_free_list(), gen_in_list_p(), gen_length(), gen_list_equals_p(), gen_nconc(), gen_nreverse(), gen_remove(), gen_replace_in_list(), gen_true2(), get_bool_property(), hash_defined_p(), hash_del(), hash_get(), HASH_MAP, hash_pointer, hash_put(), hash_table_free(), hash_table_make(), hwac_kill_statement(), ifdebug, int, list_commuted_p(), list_in_set_p(), NIL, number_of_copies(), pips_assert, pips_debug, pstatement_statement, pstatement_statement_p, same_constant_parameters(), same_operation_p(), set_add_element(), set_append_list(), set_belong_p(), set_clear(), set_del_element(), SET_FOREACH, set_free(), set_intersection(), set_make(), set_pointer, set_union(), spoc_type_mes, substitute_image_in_statement(), switch_vertex_to_a_copy(), switch_vertex_to_assign(), unlink_copy_vertex(), vtxcontent_inputs, vtxcontent_optype, vtxcontent_out, and vtxcontent_source.
Referenced by freia_aipo_compile_calls(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
Definition at line 2513 of file dag-utils.c.
References basic_derived, compilation_unit_of_module(), DUMMY_STRUCT_PREFIX, entity_local_name(), entity_type, entity_undefined, f(), FindOrCreateEntity(), FOREACH, FREIA_IMAGE_TYPE, get_current_module_entity(), pips_assert, pips_internal_error, same_string_p, type_struct, type_variable, TYPEDEF_PREFIX, ultimate_type(), and variable_basic.
Referenced by do_point_to().
catch some cases of missing outs between splits...
for "freia_scalar_03"... I'm not that sure about the algorithm. This should rely be based on the CHAINS/DG, but the status still seems hopeless, as too many arcs currently kept (FC 08/08/2011)
dfull | full dag |
dfull | full |
Definition at line 2166 of file dag-utils.c.
References _intFMT, dag_outputs, dag_vertices, dagvtx_number(), dagvtx_succs, find_twin_vertex(), FOREACH, gen_in_list_p(), gen_length(), gen_once(), and pips_debug.
Referenced by compile_this_list(), dag_split_connected_components(), dag_split_on_scalars(), and opencl_merge_and_compile().
statement freia_memory_management_statement | ( | entity | image, |
const hash_table | occs, | ||
bool | alloc | ||
) |
image | mage |
occs | ccs |
alloc | lloc |
Definition at line 2586 of file dag-utils.c.
References alloc(), call_arguments, call_function, CAR, ENTITY_ASSIGN_P, entity_name, EXPRESSION, gen_context_recurse, gen_null2(), hash_defined_p(), hash_get(), image_ref_flt(), is_freia_alloc(), is_freia_dealloc(), pips_assert, pips_debug, reference_domain, sequence_statements, SET_FOREACH, STATEMENT, statement_call(), statement_sequence(), and statement_sequence_p().
Referenced by freia_allocate_new_images_if_needed(), and new_local_image_variable().
switch read or written image in statement if this is an AIPO call, only substitute output or input depending on write otherwise all occurrences are substituted
old | ld |
img | mg |
write | rite |
Definition at line 2746 of file dag-utils.c.
References call_domain, gen_context_multi_recurse(), gen_null(), gen_true(), reference_domain, swis_call_flt(), and swis_ref_rwt().
Referenced by freia_allocate_new_images_if_needed(), and switch_image_variable().
convert the first n items in list args to entities.
of entity
args | of expression |
Definition at line 2398 of file dag-utils.c.
References CONS, expression_syntax, FOREACH, gen_nreverse(), NIL, pips_assert, reference_indices, reference_variable, syntax_reference, and syntax_reference_p.
Referenced by dag_append_freia_call().
Definition at line 707 of file dag-utils.c.
References CAR, CDR, and CHUNK.
Referenced by freia_dag_optimize().
|
static |
Definition at line 2560 of file dag-utils.c.
References entity_initial, freia_statement_to_call(), gen_context_recurse, gen_null2(), hash_defined_p(), hash_get(), image_ref_flt(), is_freia_alloc(), reference_domain, and SET_FOREACH.
Referenced by new_local_image_variable().
Definition at line 2547 of file dag-utils.c.
References freia_image_variable_p(), gen_recurse_stop(), and reference_variable.
Referenced by freia_memory_management_statement(), and get_upper_model().
Definition at line 888 of file dag-utils.c.
References CAR, CDR, CHUNKP, gen_length(), and pips_assert.
Referenced by freia_dag_optimize().
|
static |
Definition at line 2626 of file dag-utils.c.
References alloc(), asprintf, call_to_expression(), clone_variable_with_new_name(), do_point_to(), entity_initial, entity_local_name(), entity_storage, entity_to_expression(), expression_domain, formal_parameter_p(), free(), free_storage(), free_value(), FREIA_ALLOC, freia_memory_management_statement(), gen_make_list(), get_current_module_entity(), get_upper_model(), insert_statement(), int_to_expression(), local_name_to_top_level_entity(), make_assign_statement(), make_call(), make_storage_rom(), make_value_expression(), module_local_name(), pips_assert, and ref.
Referenced by dag_fix_image_reuse().
l | of dagvtx |
Definition at line 941 of file dag-utils.c.
References dagvtx_is_copy_p(), and FOREACH.
Referenced by freia_dag_optimize().
|
static |
Definition at line 2009 of file dag-utils.c.
References any_use_statement(), entity_name, hash_get(), pips_assert, pips_debug, set_difference(), set_free(), set_make(), and set_pointer.
Referenced by dag_compute_outputs().
|
static |
recursively propagate a constant image on a vertex
v | starting vertex |
image | which is constant |
val | actual value of all image pixels |
Definition at line 1055 of file dag-utils.c.
References aipo_op_p, BITWISE_AND_OPERATOR_NAME, BITWISE_XOR_OPERATOR_NAME, CAR, CDR, compute_constant(), copy_image_p(), dagvtx_content, ENTITY, expression_undefined, freia_get_nth_scalar_param(), gen_length(), gen_occurences(), get_freia_api(), int_to_expression(), pips_assert, propagate_constant_image_to_succs(), set_aipo_call(), set_aipo_constant(), set_aipo_copy(), vtxcontent_inputs, and vtxcontent_opid.
Referenced by propagate_constant_image_to_succs().
|
static |
propagate constant image to vertex successors
Definition at line 1031 of file dag-utils.c.
References CONS, dagvtx_content, dagvtx_succs, FOREACH, gen_nreverse(), NIL, propagate_constant_image(), seen, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, and vtxcontent_out.
Referenced by propagate_constant_image(), and set_aipo_constant().
Definition at line 866 of file dag-utils.c.
References dagvtx_opid(), and dagvtx_optype().
Referenced by freia_dag_optimize().
|
static |
switch vertex statement to an aipo call
v | vertex to modify |
name | function short name to switch to, must be an AIPO function |
img | possible image argument, may be entity_undefined or NULL |
val | possible scalar argument, may be expression undefined or NULL |
Definition at line 974 of file dag-utils.c.
References AIPO, call_arguments, call_function, cat, CONS, copy_expression(), dagvtx_content, entity_to_expression(), entity_undefined, expression_undefined, free(), freia_statement_to_call(), gen_free_list(), hwac_freia_api_index(), local_name_to_top_level_entity(), NIL, pips_assert, pstatement_statement, pstatement_statement_p, same_string_p, spoc_type_alu, spoc_type_nop, strdup(), vtxcontent_inputs, vtxcontent_opid, vtxcontent_optype, vtxcontent_out, and vtxcontent_source.
Referenced by dag_simplify(), propagate_constant_image(), set_aipo_constant(), and set_aipo_copy().
|
static |
set vertex as a constant image and propagate to successors
Definition at line 1149 of file dag-utils.c.
References entity_undefined, propagate_constant_image_to_succs(), and set_aipo_call().
Referenced by dag_simplify(), and propagate_constant_image().
switch vertex to a copy of an image
Definition at line 1016 of file dag-utils.c.
References set_aipo_call().
Referenced by dag_simplify(), and propagate_constant_image().
lv | v |
Definition at line 2385 of file dag-utils.c.
References dagvtx_content, FOREACH, pstatement_statement, pstatement_statement_p, set_add_element(), and vtxcontent_source.
Referenced by freia_trpx_compile_one_dag(), and opencl_compile_mergeable_dag().
??? I'm unsure about what happens to dead code in the pipeline...
??? BUG the code may not work properly when image variable are reused within a pipe. The underlying issues are subtle and would need careful thinking: the initial code is correct, the dag representation is correct, but the generated code may reorder dag vertices so that reused variables are made to interact one with the other. Maybe I should recreate output variables in the generated code for every pipeline. this would imply a cleanup phase to removed unused images at the end. I would really need an SSA form on images? this function checks the assumption before proceeding further.
Definition at line 2217 of file dag-utils.c.
References dag_vertices, dagvtx_content, entity_undefined, FOREACH, out, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, and vtxcontent_out.
Referenced by dag_split_on_scalars().
|
static |
subtitute produced or used image in the statement of vertex v.
v | vertex |
source | image variable to replace |
target | new image variable to use |
used | whether to replace used image (input, forward propagation) or procuded image (output, backward propagation) |
Definition at line 772 of file dag-utils.c.
References _intFMT, freia_api_t::arg_img_in, freia_api_t::arg_img_out, call_arguments, CAR, CDR, dagvtx_content, dagvtx_freia_api, dagvtx_number(), entity_name, EXPRESSION, expression_reference(), expression_reference_p(), freia_statement_to_call(), gen_length(), pips_assert, pips_debug, pstatement_statement, pstatement_statement_p, reference_variable, and vtxcontent_source.
Referenced by freia_dag_optimize(), switch_vertex_to_a_copy(), and unlink_copy_vertex().
Definition at line 2707 of file dag-utils.c.
References freia_api_t::arg_img_in, freia_api_t::arg_img_out, freia_api_t::arg_misc_in, freia_api_t::arg_misc_out, call_arguments, call_function, CAR, CDR, entity_local_name(), EXPRESSION, gen_length(), gen_recurse_stop(), hwac_freia_api(), pips_assert, and swis_ctx::write.
Referenced by freia_switch_image_in_statement().
Definition at line 2701 of file dag-utils.c.
References swis_ctx::new, swis_ctx::old, and reference_variable.
Referenced by freia_switch_image_in_statement().
switch to new image variable in v & its direct successors
Definition at line 2758 of file dag-utils.c.
References dagvtx_content, dagvtx_statement(), dagvtx_succs, FOREACH, freia_switch_image_in_statement(), gen_replace_in_list(), pips_assert, vtxcontent_inputs, and vtxcontent_out.
Referenced by dag_fix_image_reuse().
replace target vertex by a copy of source results...
target | to be removed |
source | does perform the same computation |
tpreds | target predecessors to be added to source |
Definition at line 823 of file dag-utils.c.
References _intFMT, AIPO, CONS, dagvtx_content, dagvtx_dump(), dagvtx_image(), dagvtx_number(), dagvtx_succs, FOREACH, gen_free_list(), gen_list_patch(), gen_nconc(), gen_once(), gen_remove(), hwac_freia_api_index(), ifdebug, NIL, pips_debug, spoc_type_nop, substitute_image_in_statement(), vtxcontent_inputs, vtxcontent_opid, and vtxcontent_optype.
Referenced by freia_dag_optimize().
replace target measure to a copy of source result...
target | to be removed/replaced because redundant |
source | to be kept |
Definition at line 725 of file dag-utils.c.
References _intFMT, call_arguments, call_function, CAR, CDR, dagvtx_content, dagvtx_number(), dagvtx_statement(), dereference_expression(), EXPRESSION, expression_domain, expression_equal_p(), gen_free_list(), gen_make_list(), hwac_freia_api_index(), local_name_to_top_level_entity(), NIL, pips_debug, spoc_type_oth, statement_call(), vtxcontent_inputs, vtxcontent_opid, and vtxcontent_optype.
Referenced by freia_dag_optimize().
"copy" copies "source" image in dag "d".
remove it properly (forward copy propagation)
Definition at line 898 of file dag-utils.c.
References _intFMT, dagvtx_content, dagvtx_get_producer(), dagvtx_number(), dagvtx_succs, FOREACH, gen_free_list(), gen_list_patch(), gen_once(), NIL, pips_debug, substitute_image_in_statement(), vtxcontent_inputs, and vtxcontent_out.
Referenced by freia_dag_optimize().
hmmm...
Definition at line 2026 of file dag-utils.c.
References bool_to_string(), dag_inputs, dagvtx_image(), entity_name, FOREACH, and pips_debug.
Referenced by dag_compute_outputs().
|
static |
Definition at line 524 of file dag-utils.c.
References dagvtx_cmp_entity(), and gen_sort_list().
Referenced by dag_append_vertex(), and dag_remove_vertex().