PIPS
|
#include "freia_spoc_private.h"
Go to the source code of this file.
Functions | |
bool | freia_spoc_compiler (const string) |
Warning! Do not modify this file that is automatically generated! More... | |
bool | freia_terapix_compiler (const string) |
bool | freia_aipo_compiler (const string) |
bool | freia_opencl_compiler (const string) |
bool | freia_sigmac_compiler (const string) |
bool | freia_mppa_compiler (const string) |
bool | freia_some_effects_on_images (statement) |
freia.c More... | |
expression | freia_transpose_kernel (const expression) |
Transpose a structuring element expression. More... | |
bool | freia_is_transpose_call (statement) |
Detect a call to a se transposition function and transpose the arguments. More... | |
string | freia_compile (string, statement, string) |
freia_compile: compile freia module & statement for target More... | |
list | freia_spoc_compile_calls (string, dag, sequence, list, const hash_table, hash_table, const set, FILE *, set, int) |
freia_spoc.c More... | |
list | freia_trpx_compile_calls (string, dag, sequence, list, const hash_table, hash_table, const set, FILE *, set, int) |
freia_terapix.c More... | |
list | freia_opencl_compile_calls (string, dag, sequence, list, const hash_table, hash_table, const set, FILE *, set, int, hash_table) |
freia_opencl.c More... | |
list | freia_aipo_compile_calls (string, dag, list, const hash_table, hash_table, int) |
freia_aipo.c More... | |
list | freia_sigmac_compile_calls (string, dag, sequence, list, const hash_table, hash_table, const set, FILE *, set, int, int) |
freia_sigmac.c More... | |
list | freia_mppa_compile_calls (string, dag, sequence, list, const hash_table, hash_table, const set, FILE *, set, int) |
freia_mppa.c More... | |
string | dagvtx_to_string (const dagvtx) |
dag-utils.c More... | |
statement | dagvtx_statement (const dagvtx) |
return statement if any, or NULL (for input nodes). More... | |
void | dag_statements (set, const dag) |
build the set of actual statements in d More... | |
bool | dagvtx_other_stuff_p (const dagvtx) |
a vertex with a non AIPO or image related statement. More... | |
entity | dagvtx_image (const dagvtx) |
return the produced image or NULL More... | |
_int | dagvtx_number (const dagvtx) |
returns the vertex number, i.e. More... | |
string | dagvtx_number_str (const dagvtx) |
_int | dagvtx_optype (const dagvtx) |
_int | dagvtx_opid (const dagvtx) |
string | dagvtx_function_name (const dagvtx) |
string | dagvtx_operation (const dagvtx) |
string | dagvtx_compact_operation (const dagvtx) |
int | dagvtx_ordering (const dagvtx *, const dagvtx *) |
dagvtx | dagvtx_get_producer (const dag, const dagvtx, const entity, _int) |
return (last) producer of image e for vertex sink, or NULL if none found. More... | |
void | dagvtx_nb_dump (FILE *, const string, const list) |
void | dagvtx_dump (FILE *, const string, const dagvtx) |
for dag debug. More... | |
void | dag_dump (FILE *, const string, const dag) |
for dag debug More... | |
void | dag_dot (FILE *, const string, const dag, const list, const list) |
output dag in dot format, for debug or show More... | |
void | dag_dot_dump (const string, const string, const dag, const list, const list) |
generate a "dot" format from a dag to a file. More... | |
void | dag_dot_dump_prefix (const string, const string, int, const dag, const list, const list) |
void | dag_consistency_asserts (dag) |
do some consistency checking... More... | |
void | dag_remove_vertex (dag, const dagvtx) |
remove vertex v from dag d. More... | |
dagvtx | copy_dagvtx_norec (dagvtx) |
copy a vertex, but without its successors. More... | |
bool | dagvtx_is_measurement_p (const dagvtx) |
returns whether the vertex is an image measurement operation. More... | |
void | dag_append_vertex (dag, dagvtx) |
append new vertex nv to dag d. More... | |
int | dag_computation_count (const dag) |
return the number of actual operations in dag d. More... | |
list | dag_vertex_preds (const dag, const dagvtx) |
return target predecessor vertices as a list. More... | |
void | freia_dag_optimize (dag, hash_table, list *, list *) |
remove dead image operations. More... | |
void | dag_compute_outputs (dag, const hash_table, const set, const list, bool) |
(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... | |
void | freia_hack_fix_global_ins_outs (dag, dag) |
catch some cases of missing outs between splits... More... | |
void | dag_cleanup_other_statements (dag) |
remove unneeded statements? you must know they are really un-needed! More... | |
bool | single_image_assignement_p (dag) |
??? I'm unsure about what happens to dead code in the pipeline... More... | |
list | dag_computable_vertices (dag, const set, const set, const set) |
return the vertices which may be computed from the list of available images, excluding vertices in exclude. More... | |
void | set_append_vertex_statements (set, list) |
dag | freia_build_dag (string, list, int, const hash_table, const set, const list, bool) |
build a full dag from list of statements ls. More... | |
bool | dag_no_image_operation (dag) |
tell whether we have something to do with images ??? hmmm... More... | |
statement | freia_memory_management_statement (entity, const hash_table, bool) |
void | freia_switch_image_in_statement (statement, entity, entity, bool) |
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... | |
list | dag_fix_image_reuse (dag, hash_table, const hash_table) |
fix intermediate image reuse in dag More... | |
list | dag_split_on_scalars (const dag, bool(*)(const dagvtx), dagvtx(*)(const list, bool), gen_cmp_func_t, void(*)(const dag), const set) |
split a dag on scalar dependencies only, with a greedy heuristics. More... | |
list | dag_connected_component (dag, list *, bool(*)(const dagvtx, const set, const dag)) |
extract a sublist of lv which is a connected component. More... | |
list | dag_split_connected_components (dag, set) |
build connected components More... | |
const freia_api_t * | hwac_freia_api (const char *) |
freia-utils.c More... | |
int | hwac_freia_api_index (const string) |
returns the index of the description of an AIPO function More... | |
const freia_api_t * | get_freia_api (int) |
const freia_api_t * | get_freia_api_vtx (dagvtx) |
string | what_operation (const _int type) |
string | what_operation_shape (const _int type) |
SPoC: set shape depending on hardware component used by vertex. More... | |
void | freia_spoc_set_operation (const freia_api_t *, _int *, _int *) |
??? beurk: I keep the operation as two ints for code regeneration. More... | |
list | freia_get_params (const freia_api_t *, list) |
get freia further parameters, skipping image ones More... | |
list | freia_get_vertex_params (const dagvtx) |
expression | freia_get_nth_scalar_param (const dagvtx, int) |
int | freia_max_pixel_value (void) |
list | freia_extract_params (const int, list, string_buffer, string_buffer, hash_table, int *) |
returns an allocated expression list of the parameters only (i.e. More... | |
call | freia_ok (void) |
build all is well freia constant More... | |
bool | freia_assignment_p (const entity) |
tell whether it is an assignment to ignore? More... | |
statement | freia_copy_image (const entity, const entity) |
void | hwac_replace_statement (statement, call, bool) |
replace statement contents with call to c, or continue if kill More... | |
void | hwac_kill_statement (statement) |
remove contents of statement s. More... | |
bool | freia_image_variable_p (const entity) |
rather approximative? More... | |
bool | entity_freia_api_p (const entity) |
returns whether the entity is a freia API (AIPO) function. More... | |
bool | freia_statement_aipo_call_p (const statement) |
returns whether the statement is a FREIA call. More... | |
void | freia_init_dep_cache (void) |
void | freia_close_dep_cache (void) |
bool | freia_scalar_rw_dep (const statement, const statement, list *) |
call | freia_statement_to_call (const statement) |
return the actual function call from a statement, dealing with assign and returns... More... | |
bool | is_freia_alloc (const statement) |
bool | is_freia_dealloc (const statement) |
bool | same_constant_parameters (const dagvtx, const dagvtx) |
tell whether v1 and v2 point to statements with the same parameters. More... | |
entity | freia_create_helper_function (const string, list) |
int | freia_substitute_by_helper_call (dag, set, set, list, const string, list, set, int) |
substitute those statement in ls that are in dag d and accelerated by a call to function_name(lparams) also update sets of remainings and global_remainings More... | |
void | freia_insert_added_stats (list, list, bool) |
insert statements to actual code sequence in "ls" BEWARE that ls is assumed to be in reverse order... More... | |
void | freia_add_image_arguments (list, list *) |
prepend limg images in front of the argument list limg is consummed by the operation. More... | |
hash_table | freia_build_image_occurrences (statement, set, hash_table, const hash_table) |
void | freia_clean_image_occurrences (hash_table) |
cleanup occurrence data structure More... | |
bool | freia_aipo_spoc_implemented (const freia_api_t *) |
whether api available with SPoC More... | |
bool | freia_aipo_terapix_implemented (const freia_api_t *) |
whether api available with Ter@pix More... | |
bool | freia_convolution_p (dagvtx) |
is it the convolution special case? More... | |
bool | freia_convolution_width_height (dagvtx, _int *, _int *, bool) |
get width & height of convolution More... | |
list | freia_allocate_new_images_if_needed (list, list, const hash_table, const hash_table, const hash_table) |
insert image allocation if needed, for intermediate image inserted before if an image is used only twice, then it is switched back to the initial one More... | |
int | freia_aipo_count (dag, int *, int *) |
set | freia_compute_output_images (entity, statement) |
set | freia_compute_current_output_images (void) |
void | freia_migrate_statements (sequence, const set, const set) |
bool | freia_extract_kernel_vtx (dagvtx, bool, intptr_t *, intptr_t *, intptr_t *, intptr_t *, intptr_t *, intptr_t *, intptr_t *, intptr_t *, intptr_t *) |
vertex-based version More... | |
string | helper_file_name (string, string) |
return malloc'ed "foo.database/Src/%{module}_helper_functions.c" should it depend on the target? no, because we could mix targets? More... | |
bool | freia_unroll_while (const string) |
freia_transformations.c More... | |
bool | freia_remove_scalar_ww_deps (const string) |
bool | remove_simple_scalar_pointers (const string) |
void | freia_shuffle_move_forward (statement) |
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().
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, |
const | string, | ||
const | dag, | ||
const | list, | ||
const | list | ||
) |
generate a "dot" format from a dag to a file.
string | odule |
string | ame |
list | b |
list | 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, |
const | string, | ||
int | number, | ||
const | dag, | ||
const | list, | ||
const | list | ||
) |
string | odule |
string | refix |
number | umber |
list | b |
list | 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().
void dag_dump | ( | FILE * | out, |
const | string, | ||
const | dag | ||
) |
for dag debug
out | ut |
string | 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().
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().
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().
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().
void dag_statements | ( | set | stats, |
const | dag | ||
) |
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().
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().
string dagvtx_compact_operation | ( | const | dagvtx | ) |
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().
void dagvtx_dump | ( | FILE * | out, |
const | string, | ||
const | dagvtx | ||
) |
for dag debug.
out | ut |
string | 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().
string dagvtx_function_name | ( | const | dagvtx | ) |
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().
entity dagvtx_image | ( | const | dagvtx | ) |
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().
bool dagvtx_is_measurement_p | ( | const | dagvtx | ) |
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().
void dagvtx_nb_dump | ( | FILE * | out, |
const | string, | ||
const | list | ||
) |
out | ut |
string | 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().
string dagvtx_number_str | ( | const | dagvtx | ) |
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().
string dagvtx_operation | ( | const | dagvtx | ) |
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().
_int dagvtx_opid | ( | const | dagvtx | ) |
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().
_int dagvtx_optype | ( | const | dagvtx | ) |
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().
bool dagvtx_other_stuff_p | ( | const | dagvtx | ) |
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().
statement dagvtx_statement | ( | const | dagvtx | ) |
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().
string dagvtx_to_string | ( | const | dagvtx | ) |
Definition at line 49 of file dag-utils.c.
References dagvtx_number(), and i2a().
bool entity_freia_api_p | ( | const | entity | ) |
returns whether the entity is a freia API (AIPO) function.
Definition at line 806 of file freia-utils.c.
References AIPO, entity_local_name(), and f().
Referenced by dag_append_freia_call(), fcs_call_flt(), and freia_statement_aipo_call_p().
prepend limg images in front of the argument list limg is consummed by the operation.
limg | img |
lparams | params |
Definition at line 1233 of file freia-utils.c.
References CONS, entity_to_expression(), FOREACH, gen_free_list(), gen_nconc(), gen_nreverse(), lparams, and NIL.
Referenced by freia_spoc_pipeline(), freia_terapix_call(), and opencl_compile_mergeable_dag().
list freia_aipo_compile_calls | ( | string | module, |
dag | fulld, | ||
list | ls, | ||
const | hash_table, | ||
hash_table | exchanges, | ||
int | number | ||
) |
module | odule |
fulld | ulld |
ls | s |
hash_table | ccs |
exchanges | xchanges |
number | umber |
Definition at line 48 of file freia_aipo.c.
References dag_dot_dump_prefix(), dag_fix_image_reuse(), freia_allocate_new_images_if_needed(), freia_dag_optimize(), freia_insert_added_stats(), gen_free_list(), gen_length(), hash_pointer, hash_table_free(), hash_table_make(), init, module, NIL, pips_assert, and pips_debug.
Referenced by freia_compile().
bool freia_aipo_compiler | ( | const | string | ) |
string | odule |
Definition at line 134 of file hardware_accelerator.c.
References freia_compiler(), and module.
pa | a |
pc | c |
Definition at line 1823 of file freia-utils.c.
References AIPO, dag_vertices, dagvtx_function_name(), FOREACH, and same_string_p.
Referenced by freia_opencl_compile_calls().
bool freia_aipo_spoc_implemented | ( | const freia_api_t * | api | ) |
whether api available with SPoC
api | pi |
Definition at line 1418 of file freia-utils.c.
References pips_assert, freia_api_t::spoc, spoc_not_implemented, and spoc_hw_t::used.
bool freia_aipo_terapix_implemented | ( | const freia_api_t * | api | ) |
whether api available with Ter@pix
api | pi |
Definition at line 1426 of file freia-utils.c.
References AIPO, terapix_hw_t::cost, freia_api_t::function_name, pips_assert, same_string_p, and freia_api_t::terapix.
Referenced by dagvtx_terapix_priority().
list freia_allocate_new_images_if_needed | ( | list | ls, |
list | images, | ||
const hash_table | occs, | ||
const hash_table | init, | ||
const hash_table | signatures | ||
) |
insert image allocation if needed, for intermediate image inserted before if an image is used only twice, then it is switched back to the initial one
This could/should be improved:
ls | list of statements to consider |
images | list of entities to check and maybe allocate |
init | new image -> initial image |
signatures | helper -> _int # written args ahead (may be NULL) |
ls | s |
images | mages |
occs | ccs |
init | nit |
signatures | ignatures |
Definition at line 1650 of file freia-utils.c.
References CAR, clean_stats_to_image(), CONS, E_READ, E_WRITE, entity_local_name(), entity_name, FOREACH, free_sequence(), freia_build_image_occurrences(), freia_clean_image_occurrences(), freia_memory_management_statement(), freia_switch_image_in_statement(), gen_free_list(), gen_last(), get_bool_property(), get_current_module_statement(), hash_defined_p(), hash_get(), hash_pointer, hash_put(), hash_table_make(), image_free(), init, insert_statement(), make_sequence(), NIL, only_minor_statements_in_between(), pips_assert, pips_debug, pips_user_warning, s1, sequence_statements, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, set_size(), set_to_list(), STATEMENT, statement_sequence(), and statement_sequence_p().
Referenced by freia_aipo_compile_calls(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
bool freia_assignment_p | ( | const | entity | ) |
tell whether it is an assignment to ignore?
Definition at line 703 of file freia-utils.c.
References ENTITY_ASSIGN_P, and ENTITY_BITWISE_OR_UPDATE_P.
Referenced by fcs_call_flt(), freia_statement_aipo_call_p(), freia_statement_to_call(), get_assigned_variable(), and hwac_replace_statement().
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().
hash_table freia_build_image_occurrences | ( | statement | s, |
set | image_occs_stats, | ||
hash_table | image_stats, | ||
const hash_table | signatures | ||
) |
image_occs_stats | set of statements with image occurences (may be NULL) |
signatures | helper entity -> (_int) # out args |
image_occs_stats | mage_occs_stats |
image_stats | mage_stats |
signatures | ignatures |
Definition at line 1388 of file freia-utils.c.
References check_ref(), check_stmt(), gen_context_multi_recurse(), gen_null(), hash_pointer, hash_table_make(), occs_ctx::occs, pips_debug, reference_domain, and statement_domain.
Referenced by freia_allocate_new_images_if_needed(), and freia_compile().
void freia_clean_image_occurrences | ( | hash_table | occs | ) |
cleanup occurrence data structure
occs | ccs |
Definition at line 1407 of file freia-utils.c.
References HASH_FOREACH, hash_table_free(), and set_free().
Referenced by freia_allocate_new_images_if_needed(), and freia_compile().
void freia_close_dep_cache | ( | void | ) |
Definition at line 915 of file freia-utils.c.
References dep_cache, gen_free_list(), HASH_FOREACH, hash_table_free(), pips_assert, and s1.
Referenced by freia_compile().
freia_compile: compile freia module & statement for target
module | odule |
mod_stat | od_stat |
target | arget |
Definition at line 785 of file freia.c.
References add_declaration_statement(), CAR, CDR, CONS, DAG, dagvtx_statement(), freia_info::enclosing_loops, file_readable_p(), FOREACH, forloop_domain, fprintf(), free_dag(), freia_aipo_compile_calls(), freia_aipo_p, freia_build_dag(), freia_build_image_occurrences(), freia_clean_image_occurrences(), freia_cleanup_main_sequence(), freia_cleanup_status(), freia_close_dep_cache(), freia_compute_current_output_images(), freia_image_shuffle(), freia_init_dep_cache(), freia_mppa_compile_calls(), FREIA_MPPA_INCLUDES, freia_mppa_p, freia_opencl_compile_calls(), FREIA_OPENCL_INCLUDES, freia_opencl_p, freia_shuffle_move_forward(), freia_sigmac_compile_calls(), FREIA_SIGMAC_INCLUDES, freia_sigmac_p, freia_spoc_compile_calls(), FREIA_SPOC_INCLUDES, freia_spoc_p, freia_terapix_p, freia_trpx_compile_calls(), FREIA_TRPX_INCLUDES, freia_valid_target_p, fsi_loop_flt(), fsi_loop_rwt(), fsi_seq_flt(), fsi_sort(), fsi_stmt_flt(), gen_context_multi_recurse(), gen_copy_seq(), gen_exchange_in_list(), gen_free_list(), gen_length(), gen_nreverse(), gen_null(), get_bool_property(), hash_defined_p(), HASH_FOREACH, hash_get(), hash_pointer, hash_table_free(), hash_table_make(), helper_file_name(), freia_info::in_loops, loop_domain, mod_stat, module, n_dags, NIL, pips_assert, pips_debug, pips_internal_error, pips_user_error, pips_user_warning, safe_fclose(), safe_fopen(), freia_info::seqs, freia_info::sequence, sequence_domain, sequence_statements, set_belong_p(), set_free(), set_make(), set_pointer, set_union(), statement_domain, switch_cast_to_copy(), unstructured_domain, and whileloop_domain.
Referenced by freia_compiler().
set freia_compute_current_output_images | ( | void | ) |
Definition at line 1885 of file freia-utils.c.
References freia_compute_output_images(), get_current_module_entity(), and get_current_module_statement().
Referenced by freia_compile().
module | odule |
Definition at line 1866 of file freia-utils.c.
References call_domain, FOREACH, freia_image_variable_p(), gen_context_multi_recurse(), gen_true(), module, module_functional_parameters, oi_call_rwt(), oi_stmt_rwt(), set_add_element(), set_make(), set_pointer, and statement_domain.
Referenced by freia_compute_current_output_images().
is it the convolution special case?
Definition at line 1441 of file freia-utils.c.
References dagvtx_operation(), and same_string_p.
Referenced by dag_terapix_measures(), sc_inst(), sigmac_params_decl(), terapix_gram_management(), terapix_macro_code(), and update_erosions().
get width & height of convolution
pw | w |
ph | h |
check | heck |
Definition at line 1449 of file freia-utils.c.
References CAR, CDR, EXPRESSION, expression_integer_value(), freia_get_vertex_params(), gen_length(), and pips_assert.
Referenced by dag_terapix_measures(), terapix_gram_management(), terapix_macro_code(), and update_erosions().
source | ource |
target | arget |
Definition at line 710 of file freia-utils.c.
References AIPO, call_to_statement, CONS, entity_to_expression(), local_name_to_top_level_entity(), make_call(), and NIL.
Referenced by freia_dag_optimize().
string | unction_name |
lparams | params |
Definition at line 1030 of file freia-utils.c.
References CONS, copy_type(), debug_off, debug_on, entity_function_p(), entity_type, expression_to_user_type(), FOREACH, functional_result, gen_nreverse(), local_name_to_top_level_entity(), lparams, make_dummy_unknown(), make_empty_function(), make_language_c(), make_mode_value(), make_parameter(), module_functional_parameters, NIL, pips_assert, and type_functional.
Referenced by freia_substitute_by_helper_call(), mppa_call_helper(), opencl_generate_special_kernel_ops(), and sc_delimiter().
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().
bool freia_extract_kernel_vtx | ( | dagvtx | v, |
bool | strict, | ||
intptr_t * | k00, | ||
intptr_t * | k10, | ||
intptr_t * | k20, | ||
intptr_t * | k01, | ||
intptr_t * | k11, | ||
intptr_t * | k21, | ||
intptr_t * | k02, | ||
intptr_t * | k12, | ||
intptr_t * | k22 | ||
) |
vertex-based version
strict | trict |
k00 | 00 |
k10 | 10 |
k20 | 20 |
k01 | 01 |
k11 | 11 |
k21 | 21 |
k02 | 02 |
k12 | 12 |
k22 | 22 |
Definition at line 2012 of file freia-utils.c.
References CAR, EXPRESSION, freia_extract_kernel(), and freia_get_vertex_params().
Referenced by constant_image_p(), copy_image_p(), dagvtx_constant_kernel_p(), erosion_optimization(), mppa_compile_dag(), mppa_helper_args_params(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), sc_kernel_compute_loop(), and sc_print_kernel().
list freia_extract_params | ( | const int | napi, |
list | args, | ||
string_buffer | head, | ||
string_buffer | head2, | ||
hash_table | params, | ||
int * | nparams | ||
) |
returns an allocated expression list of the parameters only (i.e.
do not include the input & output images). params maps variables (if so) to already present parameters names. the extraction function allocs new parameter names if necessary. of expression
napi | api |
args | rgs |
head | ead |
head2 | ead2 |
params | arams |
nparams | params |
Definition at line 612 of file freia-utils.c.
References freia_api_t::arg_in_types, freia_api_t::arg_misc_in, freia_api_t::arg_misc_out, freia_api_t::arg_out_types, CAR, CDR, CONS, copy_expression(), entity_undefined_p, entity_variable_p, EXPRESSION, expression_to_entity(), free(), freia_get_params(), gen_length(), gen_nreverse(), get_bool_property(), get_freia_api(), get_var(), hash_defined_p(), hash_get(), hash_put(), NIL, params, pips_assert, and sb_cat.
Referenced by freia_spoc_pipeline(), freia_terapix_call(), opencl_compile_mergeable_dag(), same_constant_parameters(), and sc_get_params_values().
expression freia_get_nth_scalar_param | ( | const | dagvtx, |
int | n | ||
) |
Definition at line 589 of file freia-utils.c.
References CAR, EXPRESSION, freia_get_vertex_params(), and gen_nthcdr().
Referenced by constant_image_p(), copy_image_p(), and propagate_constant_image().
list freia_get_params | ( | const freia_api_t * | api, |
list | args | ||
) |
get freia further parameters, skipping image ones
api | pi |
args | rgs |
Definition at line 569 of file freia-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, CDR, gen_length(), and pips_assert.
Referenced by freia_extract_params(), and freia_get_vertex_params().
list freia_get_vertex_params | ( | const | dagvtx | ) |
Definition at line 578 of file freia-utils.c.
References call_arguments, dagvtx_content, dagvtx_freia_api, freia_get_params(), freia_statement_to_call(), pips_assert, pstatement_statement, pstatement_statement_p, and vtxcontent_source.
Referenced by freia_convolution_width_height(), freia_extract_kernel_vtx(), freia_get_nth_scalar_param(), freia_terapix_call(), gram_param(), has_vtx_dynamic_params(), mppa_compile_dag(), mppa_helper_args_params(), sc_delimiter(), sc_inst(), sc_kernel_specific_agent(), sigmac_params_decl(), spoc_alu_conf(), spoc_measure_conf(), spoc_poc_conf(), spoc_th_conf(), and terapix_gram_management().
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().
bool freia_image_variable_p | ( | const | entity | ) |
rather approximative?
entity | ar |
Definition at line 768 of file freia-utils.c.
References basic_pointer, basic_pointer_p, basic_typedef, basic_typedef_p, entity_local_name(), entity_name, entity_pointer_p(), entity_type, entity_undefined, entity_variable_p, FREIA_IMAGE_TYPE, pips_debug, same_string_p, type_variable, ultimate_type(), and variable_basic.
Referenced by check_ref(), collect_images(), fis_call_flt(), freia_compute_output_images(), freia_shuffle_move_forward(), freia_some_effects_on_images(), image_ref_flt(), oi_call_rwt(), ref_count_rwt(), seq_rwt(), and set_add_scalars().
void freia_init_dep_cache | ( | void | ) |
Definition at line 909 of file freia-utils.c.
References dep_cache, hash_pointer, hash_table_make(), and pips_assert.
Referenced by freia_compile().
insert statements to actual code sequence in "ls" BEWARE that ls is assumed to be in reverse order...
ls | s |
stats | tats |
before | efore |
Definition at line 1185 of file freia-utils.c.
References _intFMT, call_arguments, call_function, CAR, CONS, ENTITY_C_RETURN_P, EXPRESSION, expression_constant_p(), find_aipo_statement(), gen_nconc(), instruction_call, instruction_call_p, instruction_to_statement(), make_instruction_sequence(), make_sequence(), NIL, pips_debug, pips_internal_error, statement_comments, statement_instruction, statement_number, STATEMENT_NUMBER_UNDEFINED, and string_undefined.
Referenced by freia_aipo_compile_calls(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
Detect a call to a se transposition function and transpose the arguments.
The expected function should have the following signature transpose_func(int kernelOut[9], const int kernelIn[9], ...)
Definition at line 499 of file freia.c.
References call_arguments, call_function, CAR, CDR, entity_initial, entity_local_name(), EXPRESSION, expression_to_entity(), expression_to_string(), freia_transpose_kernel(), gen_length(), get_string_property(), pips_assert, pips_debug, same_string_p, set_entity_initial(), statement_call(), statement_call_p(), value_expression, and value_expression_p.
Referenced by fsi_stmt_flt().
int freia_max_pixel_value | ( | void | ) |
Definition at line 594 of file freia-utils.c.
References FREIA_DEFAULT_BPP, and pips_user_error.
Referenced by constant_image_p(), and copy_image_p().
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().
void freia_migrate_statements | ( | sequence | sq, |
const | set, | ||
const | set | ||
) |
sq | q |
set | tats |
set | efore |
Definition at line 1905 of file freia-utils.c.
References CONS, FOREACH, gen_free_list(), gen_length(), gen_nconc(), gen_nreverse(), ifdebug, lend(), NIL, pips_assert, pips_debug, sequence_statements, set_belong_p(), set_fprint(), set_size(), and stat_nb().
Referenced by freia_mppa_compile_calls(), freia_opencl_compile_calls(), migrate_statements(), and sc_delimiter().
list freia_mppa_compile_calls | ( | string | , |
dag | , | ||
sequence | , | ||
list | , | ||
const | hash_table, | ||
hash_table | , | ||
const | set, | ||
FILE * | , | ||
set | , | ||
int | |||
) |
hash_table | ccs |
set | utput_images |
bool freia_mppa_compiler | ( | const | string | ) |
string | odule |
Definition at line 149 of file hardware_accelerator.c.
References freia_compiler(), and module.
call freia_ok | ( | void | ) |
build all is well freia constant
Definition at line 695 of file freia-utils.c.
References local_name_to_top_level_entity(), make_call(), and NIL.
Referenced by freia_cleanup_status(), hwac_kill_statement(), mppa_call_helper(), and sc_delimiter().
list freia_opencl_compile_calls | ( | string | module, |
dag | fulld, | ||
sequence | sq, | ||
list | ls, | ||
const | hash_table, | ||
hash_table | exchanges, | ||
const | set, | ||
FILE * | helper_file, | ||
set | helpers, | ||
int | number, | ||
hash_table | signatures | ||
) |
module | odule |
fulld | ulld |
sq | q |
ls | s |
hash_table | ccs |
exchanges | xchanges |
set | utput_images |
helper_file | elper_file |
helpers | elpers |
number | umber |
signatures | ignatures |
Definition at line 1371 of file freia_opencl.c.
References cat, choose_opencl_vertex(), dag_dot_dump_prefix(), dag_fix_image_reuse(), dag_no_image_operation(), dag_split_on_scalars(), dag_statements(), dagvtx_opencl_priority(), dagvtx_other_stuff_p(), file_readable_p(), FOREACH, fprintf(), free(), freia_aipo_count(), freia_allocate_new_images_if_needed(), freia_dag_optimize(), freia_insert_added_stats(), freia_migrate_statements(), FREIA_OPENCL_CL_INCLUDES, gen_free_list(), gen_length(), get_bool_property(), get_opencl_file_name(), hash_pointer, hash_table_free(), hash_table_make(), HELPER, i2a(), init, module, NIL, opencl_merge_and_compile(), opencl_merge_prop, pips_assert, pips_debug, safe_fclose(), safe_fopen(), set_free(), set_make(), set_pointer, set_union(), and strdup().
Referenced by freia_compile().
bool freia_opencl_compiler | ( | const | string | ) |
string | odule |
Definition at line 139 of file hardware_accelerator.c.
References freia_compiler(), and module.
bool freia_remove_scalar_ww_deps | ( | const | string | ) |
string | odule |
Definition at line 430 of file freia_transformations.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_context_recurse, gen_true2(), mod_stat, module, module_name_to_entity(), pips_debug, reset_current_module_entity(), reset_current_module_statement(), sequence_domain, set_current_module_entity(), set_current_module_statement(), and sww_seq_rwt().
vars | ars |
Definition at line 929 of file freia-utils.c.
References dep_cache, gen_copy_seq(), hash_defined_p(), hash_get(), hash_pointer, hash_put(), hash_table_make(), NIL, pips_assert, and real_freia_scalar_rw_dep().
Referenced by all_previous_stats_with_deps_are_computed(), any_scalar_dep(), and dagvtx_dot().
void freia_shuffle_move_forward | ( | statement | s | ) |
Definition at line 876 of file freia_transformations.c.
References shuffle_context::assigns, call_arguments, call_count_flt(), call_domain, call_function, CAR, shuffle_context::changed, delete_cumulated_rw_effects(), ENTITY_ASSIGN_P, EXPRESSION, expression_reference(), expression_reference_p(), FOREACH, free_instruction(), freia_image_variable_p(), gen_context_multi_recurse(), gen_context_recurse, gen_free_list(), gen_length(), gen_null2(), gen_true2(), hash_defined_p(), hash_pointer, hash_table_free(), hash_table_make(), make_continue_instruction(), NIL, pips_assert, pips_user_warning, ref_count_rwt(), reference_domain, reference_indices, reference_variable, shuffle_context::removed, seq_rwt(), sequence_domain, statement_call(), statement_call_p(), statement_instruction, and store_cumulated_rw_effects_list().
Referenced by freia_compile().
list freia_sigmac_compile_calls | ( | string | , |
dag | , | ||
sequence | , | ||
list | , | ||
const | hash_table, | ||
hash_table | , | ||
const | set, | ||
FILE * | , | ||
set | , | ||
int | , | ||
int | |||
) |
hash_table | ccs |
set | utput_images |
Referenced by freia_compile(), and sc_delimiter().
bool freia_sigmac_compiler | ( | const | string | ) |
string | odule |
Definition at line 144 of file hardware_accelerator.c.
References freia_compiler(), and module.
if so, it may be included somehow in the pipeline and just skipped, provided stat scalar dependencies are taken care of.
Definition at line 402 of file freia.c.
References effect_variable, effects_effects, FOREACH, freia_image_variable_p(), and load_cumulated_rw_effects().
Referenced by fsi_seq_flt().
list freia_spoc_compile_calls | ( | string | module, |
dag | fulld, | ||
sequence | sq, | ||
list | ls, | ||
const hash_table | occs, | ||
hash_table | exchanges, | ||
const set | output_images, | ||
FILE * | helper_file, | ||
set | helpers, | ||
int | number | ||
) |
module | |
ls | list of statements for the dag (in reverse order) |
helper | output file |
helpers | created functions |
number | current helper dag count |
of expression
module | odule |
fulld | ulld |
sq | q |
ls | of statements |
occs | ccs |
exchanges | xchanges |
output_images | utput_images |
helper_file | elper_file |
helpers | elpers |
number | umber |
Definition at line 2246 of file freia_spoc.c.
Referenced by freia_compile().
bool freia_spoc_compiler | ( | const | string | ) |
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/hwac/hwac-local.h instead, to add your own modifications. header file built by cproto hwac-local.h cproto-generated files hardware_accelerator.c
string | odule |
Definition at line 124 of file hardware_accelerator.c.
References freia_compiler(), and module.
void freia_spoc_set_operation | ( | const freia_api_t * | api, |
_int * | type, | ||
_int * | id | ||
) |
??? beurk: I keep the operation as two ints for code regeneration.
api | pi |
type | ype |
id | d |
Definition at line 545 of file freia-utils.c.
References freia_api_t::function_name, hwac_freia_api_index(), pips_assert, freia_api_t::spoc, spoc_alu, spoc_measure_0, spoc_measure_1, spoc_not_implemented, spoc_poc_0, spoc_poc_1, spoc_th_0, spoc_th_1, spoc_type_alu, spoc_type_mes, spoc_type_nop, spoc_type_poc, spoc_type_sni, spoc_type_thr, and spoc_hw_t::used.
Referenced by dag_append_freia_call().
bool freia_statement_aipo_call_p | ( | const | statement | ) |
returns whether the statement is a FREIA call.
Definition at line 814 of file freia-utils.c.
References call_arguments, call_function, CAR, CDR, ENTITY_C_RETURN_P, entity_freia_api_p(), EXPRESSION, expression_syntax, freia_assignment_p(), gen_length(), instruction_call, instruction_call_p, pips_assert, statement_instruction, syntax_call, and syntax_call_p.
Referenced by clean_list_head(), freia_cleanup_sequence_rec(), freia_reduction_variable(), fsi_seq_flt(), fsi_stmt_flt(), and set_add_scalars().
return the actual function call from a statement, dealing with assign and returns...
return NULL if not a call.
Definition at line 973 of file freia-utils.c.
References call_arguments, call_function, CAR, CDR, ENTITY_C_RETURN_P, EXPRESSION, expression_syntax, freia_assignment_p(), gen_length(), instruction_call, instruction_call_p, pips_assert, statement_instruction, syntax_call, and syntax_call_p.
Referenced by any_use_statement(), dag_append_freia_call(), dag_normalize(), dagvtx_copy_list_dot(), fcs_count(), freia_alloc_stat_p(), freia_cleanup_sequence_rec(), freia_get_vertex_params(), freia_reduction_variable(), freia_spoc_pipeline(), freia_stmt_free_p(), freia_terapix_call(), get_upper_model(), is_freia_this_call(), maybe_unroll_while_rwt(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), same_constant_parameters(), sc_get_params_values(), set_aipo_call(), and substitute_image_in_statement().
int freia_substitute_by_helper_call | ( | dag | d, |
set | global_remainings, | ||
set | remainings, | ||
list | ls, | ||
const string | function_name, | ||
list | lparams, | ||
set | helpers, | ||
int | preceeding | ||
) |
substitute those statement in ls that are in dag d and accelerated by a call to function_name(lparams) also update sets of remainings and global_remainings
the function must chose one of the statements? the current implementation is a buggy mess. it should be fully re-thought from scratch.
what should be done, is to chose the FIRST statement after the LAST dependency of the compiled statements? at least it must exist beacause one of the dependent statement must appear after that, but is it enough for all possible graph? so maybe we should do a topological sort of all the statements and reshuffle everything instead of trying to preserver the initial code as much as possible?
global_remainings | lobal_remainings |
remainings | emainings |
ls | of statement |
function_name | unction_name |
lparams | params |
helpers | elpers |
preceeding | receeding |
Definition at line 1073 of file freia-utils.c.
References _intFMT, dag_vertices, dagvtx_content, FOREACH, freia_create_helper_function(), gen_length(), hwac_replace_statement(), lparams, make_call(), pips_assert, pips_debug, pips_user_warning, pstatement_statement, pstatement_statement_p, set_add_element(), set_belong_p(), set_difference(), set_free(), set_make(), set_pointer, statement_call_p(), statement_number, and vtxcontent_source.
Referenced by freia_trpx_compile_one_dag(), and opencl_compile_mergeable_dag().
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().
bool freia_terapix_compiler | ( | const | string | ) |
string | odule |
Definition at line 129 of file hardware_accelerator.c.
References freia_compiler(), and module.
expression freia_transpose_kernel | ( | const | expression | ) |
Transpose a structuring element expression.
expression | e |
Definition at line 479 of file freia.c.
References call_arguments, call_function, expression_normalized, expression_syntax, gen_full_copy_list(), gen_nreverse(), make_call(), make_expression(), make_syntax_call(), and syntax_call.
Referenced by freia_is_transpose_call().
list freia_trpx_compile_calls | ( | string | module, |
dag | fulld, | ||
sequence | sq, | ||
list | ls, | ||
const hash_table | occs, | ||
hash_table | exchanges, | ||
const set | output_images, | ||
FILE * | helper_file, | ||
set | helpers, | ||
int | number | ||
) |
module,current | module (function) name |
ls,list | of statements taken from the sequence |
occs,occurences | of images (image -> set of statements) |
helper_file,file | to which code is to be generated |
number,number | of this statement sequence in module |
module | odule |
fulld | ulld |
sq | q |
ls | of statements |
occs | ccs |
exchanges | xchanges |
output_images | utput_images |
helper_file | elper_file |
helpers | elpers |
number | umber |
Definition at line 1808 of file freia_terapix.c.
Referenced by freia_compile().
bool freia_unroll_while | ( | const | string | ) |
string | odule |
Definition at line 269 of file freia_transformations.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, freia_unroll_while_for_spoc(), get_int_property(), mod_stat, module, module_name_to_entity(), module_reorder(), pips_debug, pips_user_warning, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), spoc_depth_prop, and stmt_renumber().
const freia_api_t* get_freia_api | ( | int | index | ) |
index | ndex |
Definition at line 477 of file freia-utils.c.
References FREIA_AIPO_API.
Referenced by commutative_operation_p(), constant_image_p(), copy_image_p(), dagvtx_compact_operation(), dagvtx_function_name(), dagvtx_is_measurement_p(), dagvtx_is_operator_p(), freia_extract_params(), freia_spoc_pipeline(), freia_terapix_call(), get_freia_api_vtx(), opencl_compile_mergeable_dag(), and propagate_constant_image().
const freia_api_t* get_freia_api_vtx | ( | dagvtx | v | ) |
Definition at line 483 of file freia-utils.c.
References dagvtx_content, get_freia_api(), and vtxcontent_opid.
Referenced by dagvtx_constant_kernel_p(), has_vtx_dynamic_params(), mppa_compile_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), sc_delimiter(), sc_inst(), sc_vtx_tostring(), sigmac_name_instances(), and sigmac_params_decl().
return malloc'ed "foo.database/Src/%{module}_helper_functions.c" should it depend on the target? no, because we could mix targets?
func_name | unc_name |
suffix | uffix |
Definition at line 2029 of file freia-utils.c.
References cat, db_get_directory_name_for_module(), free(), HELPER, and strdup().
Referenced by freia_compile(), and sc_delimiter().
const freia_api_t* hwac_freia_api | ( | const char * | function | ) |
function | unction |
Definition at line 455 of file freia-utils.c.
References FREIA_AIPO_API, freia_api_t::function_name, hash_defined_p(), hash_get(), hash_put(), hash_string, and hash_table_make().
Referenced by dag_append_freia_call(), freia_cleanup_sequence_rec(), freia_terapix_call(), hwac_freia_api_index(), reference_written_p(), sio_call_flt(), and swis_call_flt().
int hwac_freia_api_index | ( | const | string | ) |
returns the index of the description of an AIPO function
string | unction |
Definition at line 471 of file freia-utils.c.
References FREIA_AIPO_API, and hwac_freia_api().
Referenced by commutative_operation_p(), dag_normalize(), freia_spoc_set_operation(), set_aipo_call(), switch_vertex_to_a_copy(), and switch_vertex_to_assign().
void hwac_kill_statement | ( | statement | s | ) |
remove contents of statement s.
Definition at line 761 of file freia-utils.c.
References freia_ok(), and hwac_replace_statement().
Referenced by freia_dag_optimize(), freia_spoc_pipeline(), freia_terapix_call(), and opencl_compile_mergeable_dag().
replace statement contents with call to c, or continue if kill
newc | ewc |
kill | ill |
Definition at line 720 of file freia-utils.c.
References call_arguments, call_function, call_to_expression(), CAR, CDR, CONS, ENTITY_C_RETURN_P, EXPRESSION, free_call(), free_expression(), free_instruction(), freia_assignment_p(), gen_free_list(), gen_full_free_list(), gen_length(), instruction_call, instruction_call_p, make_continue_instruction(), make_instruction_call(), NIL, pips_assert, and statement_instruction.
Referenced by freia_substitute_by_helper_call(), hwac_kill_statement(), mppa_call_helper(), and sc_delimiter().
bool is_freia_alloc | ( | const | statement | ) |
Definition at line 1002 of file freia-utils.c.
References FREIA_ALLOC, and is_freia_this_call().
Referenced by freia_cmp_statement(), freia_memory_management_statement(), and get_upper_model().
bool is_freia_dealloc | ( | const | statement | ) |
Definition at line 1007 of file freia-utils.c.
References FREIA_FREE, and is_freia_this_call().
Referenced by freia_cleanup_sequence_rec(), freia_cmp_statement(), and freia_memory_management_statement().
bool remove_simple_scalar_pointers | ( | const | string | ) |
string | odule |
Definition at line 584 of file freia_transformations.c.
References address_of_scalar(), call_arguments, call_function, rssp_ctx::candidates, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, rssp_ctx::defined, rssp_ctx::dereferenced, entity_declarations, entity_initial, entity_name, expression_call(), expression_syntax, FOREACH, gen_context_multi_recurse(), gen_false(), gen_free_list(), gen_null(), gen_true(), get_current_module_entity(), hash_defined_p(), hash_get(), hash_pointer, hash_put(), hash_table_free(), hash_table_make(), rssp_ctx::invalidated, make_integer_constant_entity(), make_reference(), make_syntax_reference(), mod_stat, module, module_name_to_entity(), NIL, pips_debug, pointer_candidate_p(), rssp_ctx::points_to, reference_domain, reset_current_module_entity(), reset_current_module_statement(), rssp_ref(), set_add_element(), set_belong_p(), set_current_module_entity(), set_current_module_statement(), SET_FOREACH, set_free(), set_make(), set_pointer, sizeofexpression_domain, value_expression, and value_expression_p.
bool same_constant_parameters | ( | const | dagvtx, |
const | dagvtx | ||
) |
tell whether v1 and v2 point to statements with the same parameters.
dagvtx | 1 |
dagvtx | 2 |
Definition at line 1014 of file freia-utils.c.
References call_arguments, dagvtx_opid(), dagvtx_statement(), freia_extract_params(), freia_statement_to_call(), gen_free_list(), and lexpression_equal_p().
Referenced by freia_dag_optimize().
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().
Definition at line 499 of file freia-utils.c.
References spoc_type_alu, spoc_type_inp, spoc_type_mes, spoc_type_nop, spoc_type_oth, spoc_type_out, spoc_type_poc, spoc_type_sni, and spoc_type_thr.
Referenced by basic_spoc_conf(), comment(), dagvtx_dump(), generate_wiring(), print_op_schedule(), and where_to_perform_operation().
SPoC: set shape depending on hardware component used by vertex.
Definition at line 518 of file freia-utils.c.
References spoc_type_alu, spoc_type_inp, spoc_type_mes, spoc_type_nop, spoc_type_oth, spoc_type_out, spoc_type_poc, and spoc_type_thr.
Referenced by dagvtx_dot().